Grammatischer Fix bei Almosen-Message

Kein frühzeitiges Erhöhen der Runde für Monster.

- http://eressea.upb.de/mantis/bug_view_page.php?bug_id=0000170
  FOLGE folgt jetzt auch FAHREnden Einheiten
This commit is contained in:
Enno Rehling 2004-07-09 13:41:14 +00:00
parent d048baa4c7
commit 0e98c36075
5 changed files with 69 additions and 57 deletions

View File

@ -1377,7 +1377,6 @@ sp_denyattack(fighter * fi, int level, double power, spell * sp)
} }
/* bewegung erst am Ende des Kampfes, zusammen mit den normalen /* bewegung erst am Ende des Kampfes, zusammen mit den normalen
* Flüchtlingen */ * Flüchtlingen */
/* travel(r, mage, fi->run.region, 1); */
/* wir tun so, als wäre die Person geflohen */ /* wir tun so, als wäre die Person geflohen */
fset(fi, FIG_NOLOOT); fset(fi, FIG_NOLOOT);

View File

@ -966,7 +966,54 @@ roadto(const region * r, direction_t dir)
return true; return true;
} }
void static const char *
direction_name(const region * from, const region * to, const struct locale * lang)
{
direction_t dir = reldirection(from, to);
if (dir<MAXDIRECTIONS && dir>=0) return locale_string(lang, directions[dir]);
if (dir==D_SPECIAL) {
spec_direction *sd = special_direction(from, to);
return sd->keyword;
}
assert(!"invalid direction");
return NULL;
}
static int
notify_followers(region * r, unit * target, const region_list * route)
{
int followers = 0;
unit *up;
for (up=r->units;up;up=up->next) {
if (fval(up, UFL_FOLLOWING) && !fval(up, UFL_LONGACTION)) {
const attrib * a = a_findc(up->attribs, &at_follow);
if (a && a->data.v==target) {
/* wir basteln ihm ein NACH */
const region_list * rlist = route;
region * from = r;
strcpy(buf, locale_string(up->faction->locale, keywords[K_MOVE]));
while (rlist!=NULL) {
strcat(strcat(buf, " "), direction_name(from, rlist->data, up->faction->locale));
from = rlist->data;
rlist = rlist->next;
}
set_order(&up->thisorder, parse_order(buf, up->faction->locale));
free_order(up->thisorder); /* parse_order & set_order have each increased the refcount */
++followers;
}
}
}
return followers;
}
/** traveling without ships
* The travel unction returns the number of followers - in case it's non-null,
* the loop through the units in the region needs to be repeated
* to exceute the newly made MOVE commands of followers
*/
int
travel(unit * u, region * next, int flucht, region_list ** routep) travel(unit * u, region * next, int flucht, region_list ** routep)
{ {
region *first = u->region; region *first = u->region;
@ -979,6 +1026,7 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
region_list **iroute = &route; region_list **iroute = &route;
static boolean init = false; static boolean init = false;
static const curse_type * speed_ct; static const curse_type * speed_ct;
int followers = 0;
if (routep) *routep = NULL; if (routep) *routep = NULL;
if (!init) { if (!init) {
@ -1000,38 +1048,38 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
{ /* Die Einheit kann nicht fliegen, ist im Ozean, und will an Land */ { /* Die Einheit kann nicht fliegen, ist im Ozean, und will an Land */
if (!(u->race->flags & RCF_SWIM) && old_race(u->race) != RC_AQUARIAN) { if (!(u->race->flags & RCF_SWIM) && old_race(u->race) != RC_AQUARIAN) {
cmistake(u, u->thisorder, 44, MSG_MOVE); cmistake(u, u->thisorder, 44, MSG_MOVE);
return; return 0;
} else { } else {
if (u->ship && get_item(u, I_HORSE) > 0) { if (u->ship && get_item(u, I_HORSE) > 0) {
cmistake(u, u->thisorder, 67, MSG_MOVE); cmistake(u, u->thisorder, 67, MSG_MOVE);
return; return 0;
} }
} }
} else if (rterrain(current)!=T_OCEAN) { } else if (rterrain(current)!=T_OCEAN) {
/* An Land kein NACH wenn in dieser Runde Schiff VERLASSEN! */ /* An Land kein NACH wenn in dieser Runde Schiff VERLASSEN! */
if (leftship(u) && is_guarded(current, u, GUARD_LANDING)) { if (leftship(u) && is_guarded(current, u, GUARD_LANDING)) {
cmistake(u, u->thisorder, 70, MSG_MOVE); cmistake(u, u->thisorder, 70, MSG_MOVE);
return; return 0;
} }
if (u->ship && !flucht && u->race->flags & RCF_SWIM) { if (u->ship && !flucht && u->race->flags & RCF_SWIM) {
cmistake(u, u->thisorder, 143, MSG_MOVE); cmistake(u, u->thisorder, 143, MSG_MOVE);
return; return 0;
} }
} else if (rterrain(next) == T_OCEAN && u->ship && fval(u->ship, SF_MOVED)) { } else if (rterrain(next) == T_OCEAN && u->ship && fval(u->ship, SF_MOVED)) {
cmistake(u, u->thisorder, 13, MSG_MOVE); cmistake(u, u->thisorder, 13, MSG_MOVE);
return; return 0;
} }
switch (canwalk(u)) { switch (canwalk(u)) {
case 1: case 1:
cmistake(u, u->thisorder, 57, MSG_MOVE); cmistake(u, u->thisorder, 57, MSG_MOVE);
return; return 0;
case 2: case 2:
cmistake(u, u->thisorder, 56, MSG_MOVE); cmistake(u, u->thisorder, 56, MSG_MOVE);
return; return 0;
case 3: case 3:
cmistake(u, u->thisorder, 42, MSG_MOVE); cmistake(u, u->thisorder, 42, MSG_MOVE);
return; return 0;
} }
/* wir suchen so lange nach neuen Richtungen, wie es geht. Diese werden /* wir suchen so lange nach neuen Richtungen, wie es geht. Diese werden
@ -1156,7 +1204,7 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
destroy_unit(u); destroy_unit(u);
if (routep) *routep = route; if (routep) *routep = route;
else free_regionlist(route); else free_regionlist(route);
return; return 0;
} }
} }
/* Ozeanfelder können nur von Einheiten mit Schwimmen und ohne /* Ozeanfelder können nur von Einheiten mit Schwimmen und ohne
@ -1290,7 +1338,9 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
if (can_survive(ut, current)) { if (can_survive(ut, current)) {
travel_route(ut, ut->region, route); travel_route(ut, ut->region, route);
move_unit(ut, current, NULL); move_unit(ut, current, NULL);
// FOLGE! if (fval(ut, UFL_FOLLOWED) && route!=NULL) {
followers += notify_followers(first, ut, route);
}
} else { } else {
cmistake(u, u->thisorder, 287, MSG_MOVE); cmistake(u, u->thisorder, 287, MSG_MOVE);
cmistake(ut, ut->thisorder, 230, MSG_MOVE); cmistake(ut, ut->thisorder, 230, MSG_MOVE);
@ -1326,7 +1376,7 @@ travel(unit * u, region * next, int flucht, region_list ** routep)
if (fval(u, UFL_FOLLOWING)) caught_target(current, u); if (fval(u, UFL_FOLLOWING)) caught_target(current, u);
if (routep) *routep = route; if (routep) *routep = route;
else free_regionlist(route); else free_regionlist(route);
return; return followers;
} }
static boolean static boolean
@ -1711,19 +1761,6 @@ get_captain(const ship * sh)
return NULL; return NULL;
} }
static const char *
direction_name(const region * from, const region * to, const struct locale * lang)
{
direction_t dir = reldirection(from, to);
if (dir<MAXDIRECTIONS && dir>=0) return locale_string(lang, directions[dir]);
if (dir==D_SPECIAL) {
spec_direction *sd = special_direction(from, to);
return sd->keyword;
}
assert(!"invalid direction");
return NULL;
}
/* Segeln, Wandern, Reiten /* Segeln, Wandern, Reiten
* when this routine returns a non-zero value, movement for the region needs * when this routine returns a non-zero value, movement for the region needs
* to be done again because of followers that got new MOVE orders. * to be done again because of followers that got new MOVE orders.
@ -1738,6 +1775,7 @@ move(unit * u, boolean move_on_land)
region * r = u->region; region * r = u->region;
region_list * route = NULL; region_list * route = NULL;
region * r2 = movewhere(r, u); region * r2 = movewhere(r, u);
int followers = 0;
if (r2==NULL) { if (r2==NULL) {
cmistake(u, u->thisorder, 71, MSG_MOVE); cmistake(u, u->thisorder, 71, MSG_MOVE);
@ -1746,7 +1784,7 @@ move(unit * u, boolean move_on_land)
else if (u->ship && fval(u, UFL_OWNER)) { else if (u->ship && fval(u, UFL_OWNER)) {
route = sail(u, r2, move_on_land); route = sail(u, r2, move_on_land);
} else { } else {
travel(u, r2, 0, &route); followers += travel(u, r2, 0, &route);
} }
if (i_get(u->items, &it_demonseye)) { if (i_get(u->items, &it_demonseye)) {
@ -1765,32 +1803,10 @@ move(unit * u, boolean move_on_land)
set_order(&u->thisorder, NULL); set_order(&u->thisorder, NULL);
if (fval(u, UFL_FOLLOWED) && route!=NULL) { if (fval(u, UFL_FOLLOWED) && route!=NULL) {
int followers = 0; return followers + notify_followers(r, u, route);
unit *up;
for (up=r->units;up;up=up->next) {
if (fval(up, UFL_FOLLOWING) && !fval(up, UFL_LONGACTION)) {
const attrib * a = a_findc(up->attribs, &at_follow);
if (a && a->data.v==u) {
/* wir basteln ihm ein NACH */
region_list * rlist = route;
region * from = r;
strcpy(buf, locale_string(up->faction->locale, keywords[K_MOVE]));
while (rlist!=NULL) {
strcat(strcat(buf, " "), direction_name(from, rlist->data, up->faction->locale));
from = rlist->data;
rlist = rlist->next;
}
set_order(&up->thisorder, parse_order(buf, up->faction->locale));
free_order(up->thisorder); /* parse_order & set_order have each increased the refcount */
++followers;
}
}
}
return followers;
} }
if (route!=NULL) free_regionlist(route); if (route!=NULL) free_regionlist(route);
return 0; return followers;
} }
typedef struct piracy_data { typedef struct piracy_data {

View File

@ -51,7 +51,7 @@ extern int personcapacity(const struct unit *u);
extern direction_t getdirection(const struct locale *); extern direction_t getdirection(const struct locale *);
extern void movement(void); extern void movement(void);
extern void travel(struct unit * u, struct region * r2, int flucht, struct region_list** routep); extern int travel(struct unit * u, struct region * r2, int flucht, struct region_list** routep);
extern struct unit *is_guarded(struct region * r, struct unit * u, unsigned int mask); extern struct unit *is_guarded(struct region * r, struct unit * u, unsigned int mask);
extern int enoughsailors(const struct ship * sh, const struct region * r); extern int enoughsailors(const struct ship * sh, const struct region * r);
extern boolean canswim(struct unit *u); extern boolean canswim(struct unit *u);

View File

@ -1547,9 +1547,6 @@ readfaction(FILE * F)
convertunique(f); convertunique(f);
#endif #endif
f->magiegebiet = (magic_t)ri(F); f->magiegebiet = (magic_t)ri(F);
if (!playerrace(f->race)) {
f->lastorders = turn+1;
}
f->karma = ri(F); f->karma = ri(F);
f->flags = ri(F); f->flags = ri(F);
freset(f, FFL_OVERRIDE); freset(f, FFL_OVERRIDE);

View File

@ -2317,7 +2317,7 @@
<arg name="amount" type="int"/> <arg name="amount" type="int"/>
<arg name="to" type="faction"/> <arg name="to" type="faction"/>
</type> </type>
<text locale="de">"$faction($from) gibt $faction($to) ein Almosen von $int($amount) Silber."</text> <text locale="de">"$faction($from) gibt ein Almosen von $int($amount) Silber an $faction($to)."</text>
<text locale="fr">"$faction($from) donates $int($amount) silver to $faction($to)."</text> <text locale="fr">"$faction($from) donates $int($amount) silver to $faction($to)."</text>
<text locale="en">"$faction($from) donates $int($amount) silver to $faction($to)."</text> <text locale="en">"$faction($from) donates $int($amount) silver to $faction($to)."</text>
</message> </message>
@ -2424,7 +2424,7 @@
<arg name="recipient" type="unit"/> <arg name="recipient" type="unit"/>
<arg name="amount" type="int"/> <arg name="amount" type="int"/>
</type> </type>
<text locale="de">"$unit($unit) gibt $unit($recipient) $int($amount) Dumpfbackenbrot."</text> <text locale="de">"$unit($unit) gibt $int($amount) Dumpfbackenbrot an $unit($recipient)."</text>
</message> </message>
<message name="recruit" section="events"> <message name="recruit" section="events">
<type> <type>