From 0e98c360753f21a0db3d03c1dd5d9a1a47ba0f8d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 9 Jul 2004 13:41:14 +0000 Subject: [PATCH] =?UTF-8?q?Grammatischer=20Fix=20bei=20Almosen-Message=20K?= =?UTF-8?q?ein=20fr=C3=BChzeitiges=20Erh=C3=B6hen=20der=20Runde=20f=C3=BCr?= =?UTF-8?q?=20Monster.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - http://eressea.upb.de/mantis/bug_view_page.php?bug_id=0000170 FOLGE folgt jetzt auch FAHREnden Einheiten --- src/common/kernel/combatspells.c | 1 - src/common/kernel/movement.c | 116 ++++++++++++++++++------------- src/common/kernel/movement.h | 2 +- src/common/kernel/save.c | 3 - src/res/messages.xml | 4 +- 5 files changed, 69 insertions(+), 57 deletions(-) diff --git a/src/common/kernel/combatspells.c b/src/common/kernel/combatspells.c index e1daa42a1..086a19d00 100644 --- a/src/common/kernel/combatspells.c +++ b/src/common/kernel/combatspells.c @@ -1377,7 +1377,6 @@ sp_denyattack(fighter * fi, int level, double power, spell * sp) } /* bewegung erst am Ende des Kampfes, zusammen mit den normalen * Flüchtlingen */ - /* travel(r, mage, fi->run.region, 1); */ /* wir tun so, als wäre die Person geflohen */ fset(fi, FIG_NOLOOT); diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 20daee85e..1a20a280a 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -966,7 +966,54 @@ roadto(const region * r, direction_t dir) 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=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) { region *first = u->region; @@ -979,6 +1026,7 @@ travel(unit * u, region * next, int flucht, region_list ** routep) region_list **iroute = &route; static boolean init = false; static const curse_type * speed_ct; + int followers = 0; if (routep) *routep = NULL; 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 */ if (!(u->race->flags & RCF_SWIM) && old_race(u->race) != RC_AQUARIAN) { cmistake(u, u->thisorder, 44, MSG_MOVE); - return; + return 0; } else { if (u->ship && get_item(u, I_HORSE) > 0) { cmistake(u, u->thisorder, 67, MSG_MOVE); - return; + return 0; } } } else if (rterrain(current)!=T_OCEAN) { /* An Land kein NACH wenn in dieser Runde Schiff VERLASSEN! */ if (leftship(u) && is_guarded(current, u, GUARD_LANDING)) { cmistake(u, u->thisorder, 70, MSG_MOVE); - return; + return 0; } if (u->ship && !flucht && u->race->flags & RCF_SWIM) { cmistake(u, u->thisorder, 143, MSG_MOVE); - return; + return 0; } } else if (rterrain(next) == T_OCEAN && u->ship && fval(u->ship, SF_MOVED)) { cmistake(u, u->thisorder, 13, MSG_MOVE); - return; + return 0; } switch (canwalk(u)) { case 1: cmistake(u, u->thisorder, 57, MSG_MOVE); - return; + return 0; case 2: cmistake(u, u->thisorder, 56, MSG_MOVE); - return; + return 0; case 3: cmistake(u, u->thisorder, 42, MSG_MOVE); - return; + return 0; } /* 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); if (routep) *routep = route; else free_regionlist(route); - return; + return 0; } } /* 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)) { travel_route(ut, ut->region, route); move_unit(ut, current, NULL); - // FOLGE! + if (fval(ut, UFL_FOLLOWED) && route!=NULL) { + followers += notify_followers(first, ut, route); + } } else { cmistake(u, u->thisorder, 287, 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 (routep) *routep = route; else free_regionlist(route); - return; + return followers; } static boolean @@ -1711,19 +1761,6 @@ get_captain(const ship * sh) 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=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 * 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. @@ -1738,6 +1775,7 @@ move(unit * u, boolean move_on_land) region * r = u->region; region_list * route = NULL; region * r2 = movewhere(r, u); + int followers = 0; if (r2==NULL) { 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)) { route = sail(u, r2, move_on_land); } else { - travel(u, r2, 0, &route); + followers += travel(u, r2, 0, &route); } if (i_get(u->items, &it_demonseye)) { @@ -1765,32 +1803,10 @@ move(unit * u, boolean move_on_land) set_order(&u->thisorder, NULL); if (fval(u, UFL_FOLLOWED) && route!=NULL) { - 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==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; + return followers + notify_followers(r, u, route); } if (route!=NULL) free_regionlist(route); - return 0; + return followers; } typedef struct piracy_data { diff --git a/src/common/kernel/movement.h b/src/common/kernel/movement.h index 6f627ad4c..59bc8eac0 100644 --- a/src/common/kernel/movement.h +++ b/src/common/kernel/movement.h @@ -51,7 +51,7 @@ extern int personcapacity(const struct unit *u); extern direction_t getdirection(const struct locale *); 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 int enoughsailors(const struct ship * sh, const struct region * r); extern boolean canswim(struct unit *u); diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 4ceb7c46d..54814fd5f 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -1547,9 +1547,6 @@ readfaction(FILE * F) convertunique(f); #endif f->magiegebiet = (magic_t)ri(F); - if (!playerrace(f->race)) { - f->lastorders = turn+1; - } f->karma = ri(F); f->flags = ri(F); freset(f, FFL_OVERRIDE); diff --git a/src/res/messages.xml b/src/res/messages.xml index d13099913..4383eddf6 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -2317,7 +2317,7 @@ - "$faction($from) gibt $faction($to) ein Almosen von $int($amount) Silber." + "$faction($from) gibt ein Almosen von $int($amount) Silber an $faction($to)." "$faction($from) donates $int($amount) silver to $faction($to)." "$faction($from) donates $int($amount) silver to $faction($to)." @@ -2424,7 +2424,7 @@ - "$unit($unit) gibt $unit($recipient) $int($amount) Dumpfbackenbrot." + "$unit($unit) gibt $int($amount) Dumpfbackenbrot an $unit($recipient)."