error msg for movement should contain FOLLOW SHIP order

http://bugs.eressea.de/view.php?id=2161
This commit is contained in:
Steffen Mecke 2015-11-14 16:14:24 +01:00
parent 5ef9b624ff
commit a6fe494ff4
3 changed files with 15 additions and 14 deletions

View file

@ -1702,14 +1702,14 @@ static const region_list *travel_route(unit * u,
return iroute; return iroute;
} }
static bool ship_ready(const region * r, unit * u) static bool ship_ready(const region * r, unit * u, order * ord)
{ {
if (!u->ship || u != ship_owner(u->ship)) { if (!u->ship || u != ship_owner(u->ship)) {
cmistake(u, u->thisorder, 146, MSG_MOVE); cmistake(u, ord, 146, MSG_MOVE);
return false; return false;
} }
if (effskill(u, SK_SAILING, r) < u->ship->type->cptskill) { if (effskill(u, SK_SAILING, r) < u->ship->type->cptskill) {
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, ADDMSG(&u->faction->msgs, msg_feedback(u, ord,
"error_captain_skill_low", "value ship", u->ship->type->cptskill, "error_captain_skill_low", "value ship", u->ship->type->cptskill,
u->ship)); u->ship));
return false; return false;
@ -1717,16 +1717,16 @@ static bool ship_ready(const region * r, unit * u)
if (u->ship->type->construction) { if (u->ship->type->construction) {
assert(!u->ship->type->construction->improvement); /* sonst ist construction::size nicht ship_type::maxsize */ assert(!u->ship->type->construction->improvement); /* sonst ist construction::size nicht ship_type::maxsize */
if (u->ship->size != u->ship->type->construction->maxsize) { if (u->ship->size != u->ship->type->construction->maxsize) {
cmistake(u, u->thisorder, 15, MSG_MOVE); cmistake(u, ord, 15, MSG_MOVE);
return false; return false;
} }
} }
if (!enoughsailors(u->ship, crew_skill(u->ship))) { if (!enoughsailors(u->ship, crew_skill(u->ship))) {
cmistake(u, u->thisorder, 1, MSG_MOVE); cmistake(u, ord, 1, MSG_MOVE);
return false; return false;
} }
if (!cansail(r, u->ship)) { if (!cansail(r, u->ship)) {
cmistake(u, u->thisorder, 18, MSG_MOVE); cmistake(u, ord, 18, MSG_MOVE);
return false; return false;
} }
return true; return true;
@ -1808,7 +1808,7 @@ sail(unit * u, order * ord, bool move_on_land, region_list ** routep)
return; return;
} }
if (!ship_ready(starting_point, u)) if (!ship_ready(starting_point, u, ord))
return; return;
/* Wir suchen so lange nach neuen Richtungen, wie es geht. Diese werden /* Wir suchen so lange nach neuen Richtungen, wie es geht. Diese werden
@ -2265,13 +2265,13 @@ static void travel(unit * u, region_list ** routep)
} }
} }
void move_cmd(unit * u, bool move_on_land) void move_cmd(unit * u, order * ord, bool move_on_land)
{ {
region_list *route = NULL; region_list *route = NULL;
assert(u->number); assert(u->number);
if (u->ship && u == ship_owner(u->ship)) { if (u->ship && u == ship_owner(u->ship)) {
sail(u, u->thisorder, move_on_land, &route); sail(u, ord, move_on_land, &route);
} }
else { else {
travel(u, &route); travel(u, &route);
@ -2389,7 +2389,7 @@ static int follow_ship(unit * u, order * ord)
init_tokens_str(command); init_tokens_str(command);
getstrtoken(); getstrtoken();
/* NACH ausführen */ /* NACH ausführen */
move_cmd(u, false); move_cmd(u, ord, false);
return 1; /* true -> Einheitenliste von vorne durchgehen */ return 1; /* true -> Einheitenliste von vorne durchgehen */
} }
@ -2556,13 +2556,13 @@ void movement(void)
if (ships) { if (ships) {
if (u->ship && ship_owner(u->ship) == u) { if (u->ship && ship_owner(u->ship) == u) {
init_order(u->thisorder); init_order(u->thisorder);
move_cmd(u, false); move_cmd(u, u->thisorder, false);
} }
} }
else { else {
if (!u->ship || ship_owner(u->ship) != u) { if (!u->ship || ship_owner(u->ship) != u) {
init_order(u->thisorder); init_order(u->thisorder);
move_cmd(u, false); move_cmd(u, u->thisorder, false);
} }
} }
} }

View file

@ -30,6 +30,7 @@ extern "C" {
struct region_list; struct region_list;
struct ship; struct ship;
struct building_type; struct building_type;
struct order;
extern struct attrib_type at_shiptrail; extern struct attrib_type at_shiptrail;
@ -75,7 +76,7 @@ extern "C" {
bool move_blocked(const struct unit *u, const struct region *src, bool move_blocked(const struct unit *u, const struct region *src,
const struct region *dest); const struct region *dest);
bool can_takeoff(const struct ship * sh, const struct region * from, const struct region * to); bool can_takeoff(const struct ship * sh, const struct region * from, const struct region * to);
void move_cmd(struct unit * u, bool move_on_land); void move_cmd(struct unit * u, struct order * ord, bool move_on_land);
#define SA_HARBOUR 2 #define SA_HARBOUR 2
#define SA_COAST 1 #define SA_COAST 1

View file

@ -198,7 +198,7 @@ void piracy_cmd(unit * u, order *ord)
/* Bewegung ausführen */ /* Bewegung ausführen */
init_order(u->thisorder); init_order(u->thisorder);
move_cmd(u, true); move_cmd(u, ord, true);
} }
void age_piracy(region *r) { void age_piracy(region *r) {