From 4e863e9059157c88e077d72f12bd8f584d57f4cb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 17 Aug 2007 07:06:33 +0000 Subject: [PATCH] Bugfixes uebertragen aus Hauptbranch: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit http://eressea.upb.de/mantis/view.php?id=1251 "Komische Fehlermeldung bei abtreibendem Schiff" http://eressea.upb.de/mantis/view.php?id=1256 "Feinde können Schiff verlassen und sich bewegen in bewachter Region" http://eressea.upb.de/mantis/view.php?id=1252 Klarere Fehlermeldung bei Bewachung/Bewegung http://eressea.upb.de/mantis/view.php?id=1248 "schaffenstrunk und gehirnschmalz ohne wirkung" --- src/common/gamecode/laws.c | 8 +++----- src/common/kernel/alchemy.c | 40 +++++++++++++++++++------------------ src/common/kernel/move.c | 17 ++++++++++++---- src/res/messages.xml | 10 ++++++++++ 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index a3bcb8a6d..90c8df47d 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3139,6 +3139,7 @@ new_units (void) const char * token; char * name = NULL; int alias; + ship * sh; order ** newordersp; if (!checkunitnumber(u->faction, 1)) { @@ -3173,12 +3174,9 @@ new_units (void) fset(u2, UFL_ISNEW); a_add(&u2->attribs, a_new(&at_alias))->data.i = alias; - + sh = leftship(u); + if (sh) set_leftship(u2, sh); setstatus(u2, u->status); - /* - g = getguard(u); - if (g) setguard(u2, g); - */ ordp = &makeord->next; newordersp = &u2->orders; diff --git a/src/common/kernel/alchemy.c b/src/common/kernel/alchemy.c index 099bb33e1..2827d7ef0 100644 --- a/src/common/kernel/alchemy.c +++ b/src/common/kernel/alchemy.c @@ -216,27 +216,29 @@ get_effect(const unit * u, const potion_type * effect) int change_effect (unit * u, const potion_type * effect, int delta) { - attrib * a = a_find(u->attribs, &at_effect); - effect_data * data = NULL; + if (delta!=0) { + attrib * a = a_find(u->attribs, &at_effect); + effect_data * data = NULL; - assert(delta!=0); - while (a && a->type==&at_effect) { - data = (effect_data *)a->data.v; - if (data->type==effect) { - if (data->value+delta==0) { - a_remove(&u->attribs, a); - return 0; - } else { - data->value += delta; - return data->value; + while (a && a->type==&at_effect) { + data = (effect_data *)a->data.v; + if (data->type==effect) { + if (data->value+delta==0) { + a_remove(&u->attribs, a); + return 0; + } else { + data->value += delta; + return data->value; + } } - } - a = a->next; - } + a = a->next; + } - a = a_add(&u->attribs, a_new(&at_effect)); - data = (effect_data*)a->data.v; - data->type = effect; - data->value = delta; + a = a_add(&u->attribs, a_new(&at_effect)); + data = (effect_data*)a->data.v; + data->type = effect; + data->value = delta; + } + log_error(("change effect with delta==0 for unit %s\n", itoa36(u->no))); return data->value; } diff --git a/src/common/kernel/move.c b/src/common/kernel/move.c index e4a0dcf0d..8e0cd3499 100644 --- a/src/common/kernel/move.c +++ b/src/common/kernel/move.c @@ -1993,9 +1993,12 @@ travel(unit * u, region_list ** routep) sh = leftship(u); if (sh && sh->region!=u->region) sh = NULL; } - if (sh && is_guarded(r, u, GUARD_LANDING)) { - cmistake(u, u->thisorder, 70, MSG_MOVE); - return; + if (sh) { + unit * guard = is_guarded(r, u, GUARD_LANDING); + if (guard) { + ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "region_guarded", "guard", guard)); + return; + } } if (u->ship && u->race->flags & RCF_SWIM) { cmistake(u, u->thisorder, 143, MSG_MOVE); @@ -2457,7 +2460,13 @@ movement(void) while (*up) { unit *u = *up; - keyword_t kword = get_keyword(u->thisorder); + keyword_t kword; + + if (u->ship && fval(u->ship, SF_DRIFTED)) { + up = &u->next; + continue; + } + kword = get_keyword(u->thisorder); switch (kword) { case K_ROUTE: diff --git a/src/res/messages.xml b/src/res/messages.xml index 7f4561d8b..90facc416 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -6131,6 +6131,16 @@ "$unit($unit) in $region($region): '$order($command)' - This region is guarded by a non allied faction." "$unit($unit) in $region($region): '$order($command)' - This region is guarded by a non allied faction." + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - Die Region wird von $unit($guard), einer nichtalliierten Einheit, bewacht." + "$unit($unit) in $region($region): '$order($command)' - This region is guarded by $unit($guard), a non-allied unit." +