From 9f92b2e525dc882128c3e8eb2f7dd1bda3c59011 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 14 Jan 2005 18:05:54 +0000 Subject: [PATCH] =?UTF-8?q?Keine=20Beschwerden=20=C3=BCber=20trailing=20sp?= =?UTF-8?q?aces=20bei=20NACH/ROUTE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/kernel/eressea.c | 9 +++++++-- src/common/kernel/movement.c | 24 +++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 411ccf62d..f876d4f4d 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -2891,11 +2891,16 @@ movement_error(unit * u, const char * token, order * ord, int error_code) int movewhere(const unit *u, const char * token, region * r, region** resultp) { - direction_t d = finddirection(token, u->faction->locale); region * r2; + direction_t d; + if (*token == '\0') { + *resultp = NULL; + return E_MOVE_OK; + } + + d = finddirection(token, u->faction->locale); switch (d) { - case D_PAUSE: *resultp = r; break; diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 3f5a25aae..06a2e8653 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -1082,20 +1082,14 @@ make_route(unit * u, order * ord, region_list ** routep) current = next; token = getstrtoken(); - if (token[0]) { - error = movewhere(u, token, current, &next); - if (error) { - message * msg = movement_error(u, token, ord, error); - if (msg!=NULL) { - add_message(&u->faction->msgs, msg); - msg_release(msg); - } - next = NULL; - break; + error = movewhere(u, token, current, &next); + if (error) { + message * msg = movement_error(u, token, ord, error); + if (msg!=NULL) { + add_message(&u->faction->msgs, msg); + msg_release(msg); } - } else { next = NULL; - break; } } } @@ -1478,7 +1472,7 @@ sail(unit * u, order * ord, boolean move_on_land, region_list **routep) * Durchlauf schon gesetzt (Parameter!). current_point ist die letzte gültige, * befahrene Region. */ - while (current_point!=next_point && step < k && next_point) { + while (next_point && current_point!=next_point && step < k) { const char * token; int error; terrain_t tthis = rterrain(current_point); @@ -1624,13 +1618,13 @@ sail(unit * u, order * ord, boolean move_on_land, region_list **routep) if (rterrain(current_point) != T_OCEAN && !is_cursed(sh->attribs, C_SHIP_FLYING, 0)) break; token = getstrtoken(); error = movewhere(u, token, current_point, &next_point); - if (error) { + if (error || next_point==NULL) { message * msg = movement_error(u, token, ord, error); if (msg!=NULL) { add_message(&u->faction->msgs, msg); msg_release(msg); } - next_point=current_point; + next_point = current_point; break; } }