"Durch TRANSPORTIERE wurden alle Steuereinnahmen aus der Region getragen"
checking for can_leave if unit is transported.
This commit is contained in:
Enno Rehling 2009-08-29 14:23:35 +00:00
parent ac4f84fc8b
commit f36265a0bb
2 changed files with 32 additions and 22 deletions

View file

@ -1980,8 +1980,15 @@ travel_i(unit * u, const region_list * route_begin, const region_list * route_en
skip_token(); skip_token();
ut = getunit(r, u->faction); ut = getunit(r, u->faction);
if (ut!=NULL) { if (ut!=NULL) {
if (get_keyword(ut->thisorder) == K_DRIVE) {
if (ut->building && !can_leave(ut)) {
cmistake(ut, ut->thisorder, 150, MSG_MOVE);
cmistake(u, ord, 99, MSG_MOVE);
} else if (!can_move(ut)) {
cmistake(u, ord, 99, MSG_MOVE);
} else {
boolean found = false; boolean found = false;
if (get_keyword(ut->thisorder) == K_DRIVE && can_move(ut)) {
if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) { if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
init_tokens(ut->thisorder); init_tokens(ut->thisorder);
skip_token(); skip_token();
@ -2003,8 +2010,7 @@ travel_i(unit * u, const region_list * route_begin, const region_list * route_en
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", "")); ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", ""));
} }
} }
} else { }
cmistake(u, ord, 99, MSG_MOVE);
} }
} else { } else {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", "")); ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", ""));

View file

@ -890,7 +890,11 @@ move_unit(unit * u, region * r, unit ** ulist)
if (u->region) { if (u->region) {
setguard(u, GUARD_NONE); setguard(u, GUARD_NONE);
fset(u, UFL_MOVED); fset(u, UFL_MOVED);
if (u->ship || u->building) leave(u, true); if (u->ship || u->building) {
/* can_leave must be checked in travel_i */
boolean result = leave(u, false);
assert(result);
}
translist(&u->region->units, ulist, u); translist(&u->region->units, ulist, u);
} else { } else {
addlist(ulist, u); addlist(ulist, u);