forked from github/server
remove dead phoenix feature.
This commit is contained in:
parent
eee4fa9e91
commit
ce7eb9663a
|
@ -1118,14 +1118,6 @@
|
||||||
<text locale="de">Trollhörner</text>
|
<text locale="de">Trollhörner</text>
|
||||||
<text locale="en">troll horns</text>
|
<text locale="en">troll horns</text>
|
||||||
</string>
|
</string>
|
||||||
<string name="phoenixfeather">
|
|
||||||
<text locale="de">Feder des Phönix</text>
|
|
||||||
<text locale="en">feather of the phoenix</text>
|
|
||||||
</string>
|
|
||||||
<string name="phoenixfeather_p">
|
|
||||||
<text locale="de">Federn des Phönix</text>
|
|
||||||
<text locale="en">feathers of the phoenix</text>
|
|
||||||
</string>
|
|
||||||
|
|
||||||
<!--Resourcen -->
|
<!--Resourcen -->
|
||||||
<string name="money">
|
<string name="money">
|
||||||
|
@ -3195,23 +3187,6 @@
|
||||||
<text locale="en">young dragon</text>
|
<text locale="en">young dragon</text>
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
<string name="phoenix">
|
|
||||||
<text locale="de">Phönix</text>
|
|
||||||
<text locale="en">phoenix</text>
|
|
||||||
</string>
|
|
||||||
<string name="phoenix_p">
|
|
||||||
<text locale="de">Phönixe</text>
|
|
||||||
<text locale="en">phoenixes</text>
|
|
||||||
</string>
|
|
||||||
<string name="phoenix_d">
|
|
||||||
<text locale="de">Phönixen</text>
|
|
||||||
<text locale="en">phoenixes</text>
|
|
||||||
</string>
|
|
||||||
<string name="phoenix_x">
|
|
||||||
<text locale="de">Phönix</text>
|
|
||||||
<text locale="en">phoenix</text>
|
|
||||||
</string>
|
|
||||||
|
|
||||||
<string name="illusion">
|
<string name="illusion">
|
||||||
<text locale="de">Illusion</text>
|
<text locale="de">Illusion</text>
|
||||||
<text locale="en">illusion</text>
|
<text locale="en">illusion</text>
|
||||||
|
|
|
@ -8090,27 +8090,6 @@
|
||||||
<text locale="en">"The plank of $ship($ship) are inscribed with strange runes. ($int36($id))"</text>
|
<text locale="en">"The plank of $ship($ship) are inscribed with strange runes. ($int36($id))"</text>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="phoenixcompass_confusion" section="magic">
|
|
||||||
<type>
|
|
||||||
<arg name="unit" type="unit"/>
|
|
||||||
<arg name="region" type="region"/>
|
|
||||||
<arg name="command" type="order"/>
|
|
||||||
</type>
|
|
||||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Kompassnadel springt wild hin und her und es lässt sich keine Richtung erkennen."</text>
|
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The needle jumps wildly and there is no specific direction recognizable."</text>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message name="phoenixcompass_success" section="magic">
|
|
||||||
<type>
|
|
||||||
<arg name="unit" type="unit"/>
|
|
||||||
<arg name="region" type="region"/>
|
|
||||||
<arg name="command" type="order"/>
|
|
||||||
<arg name="dir" type="int"/>
|
|
||||||
</type>
|
|
||||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Kompassnadel zeigt nach $direction($dir)."</text>
|
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The needle points $direction($dir)."</text>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message name="disrupt_astral" section="magic">
|
<message name="disrupt_astral" section="magic">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
|
|
|
@ -8,7 +8,6 @@ SET(_FILES
|
||||||
artrewards.c
|
artrewards.c
|
||||||
demonseye.c
|
demonseye.c
|
||||||
itemtypes.c
|
itemtypes.c
|
||||||
phoenixcompass.c
|
|
||||||
seed.c
|
seed.c
|
||||||
speedsail.c
|
speedsail.c
|
||||||
weapons.c
|
weapons.c
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
#include "xerewards.h"
|
#include "xerewards.h"
|
||||||
#include "artrewards.h"
|
#include "artrewards.h"
|
||||||
#include "phoenixcompass.h"
|
|
||||||
#include "weapons.h"
|
#include "weapons.h"
|
||||||
#include "seed.h"
|
#include "seed.h"
|
||||||
|
|
||||||
|
@ -26,7 +25,6 @@ void register_itemtypes(void)
|
||||||
register_weapons();
|
register_weapons();
|
||||||
register_xerewards();
|
register_xerewards();
|
||||||
register_artrewards();
|
register_artrewards();
|
||||||
register_phoenixcompass();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_itemtypes(void)
|
void init_itemtypes(void)
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <platform.h>
|
|
||||||
#include <kernel/config.h>
|
|
||||||
#include "phoenixcompass.h"
|
|
||||||
|
|
||||||
/* kernel includes */
|
|
||||||
#include <kernel/item.h>
|
|
||||||
#include <kernel/race.h>
|
|
||||||
#include <kernel/region.h>
|
|
||||||
#include <kernel/faction.h>
|
|
||||||
#include <kernel/unit.h>
|
|
||||||
#include <kernel/messages.h>
|
|
||||||
|
|
||||||
/* util includes */
|
|
||||||
#include <util/functions.h>
|
|
||||||
#include <util/rand.h>
|
|
||||||
#include <util/rng.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
static int
|
|
||||||
use_phoenixcompass(struct unit *u, const struct item_type *itype,
|
|
||||||
int amount, struct order *ord)
|
|
||||||
{
|
|
||||||
region *r;
|
|
||||||
unit *closest_phoenix = NULL;
|
|
||||||
int closest_phoenix_distance = INT_MAX;
|
|
||||||
bool confusion = false;
|
|
||||||
direction_t direction;
|
|
||||||
unit *u2;
|
|
||||||
direction_t closest_neighbour_direction = 0;
|
|
||||||
const race *rc_phoenix = rc_find("phoenix");
|
|
||||||
|
|
||||||
if (rc_phoenix == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* find the closest phoenix. */
|
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
|
||||||
if (u_race(u2) == rc_phoenix) {
|
|
||||||
if (closest_phoenix == NULL) {
|
|
||||||
closest_phoenix = u2;
|
|
||||||
closest_phoenix_distance =
|
|
||||||
distance(u->region, closest_phoenix->region);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
int dist = distance(u->region, r);
|
|
||||||
if (dist < closest_phoenix_distance) {
|
|
||||||
closest_phoenix = u2;
|
|
||||||
closest_phoenix_distance = dist;
|
|
||||||
confusion = false;
|
|
||||||
}
|
|
||||||
else if (dist == closest_phoenix_distance) {
|
|
||||||
confusion = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* no phoenix found at all.* if confusion == true more than one phoenix
|
|
||||||
* at the same distance was found and the device is confused */
|
|
||||||
|
|
||||||
if (closest_phoenix == NULL
|
|
||||||
|| closest_phoenix->region == u->region || confusion) {
|
|
||||||
add_message(&u->faction->msgs, msg_message("phoenixcompass_confusion",
|
|
||||||
"unit region command", u, u->region, ord));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* else calculate the direction. this is tricky. we calculate the
|
|
||||||
* neighbouring region which is closest to the phoenix found. hardcoded
|
|
||||||
* for readability. */
|
|
||||||
|
|
||||||
for (direction = 0; direction < MAXDIRECTIONS; ++direction) {
|
|
||||||
region *neighbour;
|
|
||||||
int closest_neighbour_distance = INT_MAX;
|
|
||||||
|
|
||||||
neighbour = r_connect(u->region, direction);
|
|
||||||
if (neighbour != NULL) {
|
|
||||||
int dist = distance(neighbour, closest_phoenix->region);
|
|
||||||
if (dist < closest_neighbour_distance) {
|
|
||||||
closest_neighbour_direction = direction;
|
|
||||||
closest_neighbour_distance = dist;
|
|
||||||
}
|
|
||||||
else if (dist == closest_neighbour_distance && rng_int() % 100 < 50) {
|
|
||||||
/* there can never be more than two neighbours with the same
|
|
||||||
* distance (except when you are standing in the same region
|
|
||||||
* as the phoenix, but that case has already been handled).
|
|
||||||
* therefore this simple solution is correct */
|
|
||||||
closest_neighbour_direction = direction;
|
|
||||||
closest_neighbour_distance = dist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add_message(&u->faction->msgs, msg_message("phoenixcompass_success",
|
|
||||||
"unit region command dir",
|
|
||||||
u, u->region, ord, closest_neighbour_direction));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_phoenixcompass(void)
|
|
||||||
{
|
|
||||||
register_item_use(use_phoenixcompass, "use_phoenixcompass");
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
|
||||||
Katja Zedel <katze@felidae.kn-bremen.de
|
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef H_ITM_PHOENIXCOMPASS
|
|
||||||
#define H_ITM_PHOENIXCOMPASS
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void register_phoenixcompass(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue