forked from github/server
"Durch TRANSPORTIERE wurden alle Steuereinnahmen aus der Region getragen" checking for can_leave if unit is transported.
This commit is contained in:
parent
ac4f84fc8b
commit
f36265a0bb
2 changed files with 32 additions and 22 deletions
|
@ -1980,31 +1980,37 @@ travel_i(unit * u, const region_list * route_begin, const region_list * route_en
|
|||
skip_token();
|
||||
ut = getunit(r, u->faction);
|
||||
if (ut!=NULL) {
|
||||
boolean found = false;
|
||||
if (get_keyword(ut->thisorder) == K_DRIVE && can_move(ut)) {
|
||||
if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
|
||||
init_tokens(ut->thisorder);
|
||||
skip_token();
|
||||
if (getunit(u->region, ut->faction) == u) {
|
||||
const region_list * route_to = travel_route(ut, route_begin, route_end, ord, TRAVEL_TRANSPORTED);
|
||||
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;
|
||||
|
||||
if (route_to!=route_begin) {
|
||||
get_followers(ut, r, route_to, followers);
|
||||
if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
|
||||
init_tokens(ut->thisorder);
|
||||
skip_token();
|
||||
if (getunit(u->region, ut->faction) == u) {
|
||||
const region_list * route_to = travel_route(ut, route_begin, route_end, ord, TRAVEL_TRANSPORTED);
|
||||
|
||||
if (route_to!=route_begin) {
|
||||
get_followers(ut, r, route_to, followers);
|
||||
}
|
||||
ADDMSG(&ut->faction->msgs, msg_message("transport",
|
||||
"unit target start end", u, ut, r, ut->region));
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (cansee(u->faction, u->region, ut, 0)) {
|
||||
cmistake(u, ord, 90, MSG_MOVE);
|
||||
} else {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", ""));
|
||||
}
|
||||
ADDMSG(&ut->faction->msgs, msg_message("transport",
|
||||
"unit target start end", u, ut, r, ut->region));
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (cansee(u->faction, u->region, ut, 0)) {
|
||||
cmistake(u, ord, 90, MSG_MOVE);
|
||||
} else {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cmistake(u, ord, 99, MSG_MOVE);
|
||||
}
|
||||
} else {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found", ""));
|
||||
|
|
|
@ -890,7 +890,11 @@ move_unit(unit * u, region * r, unit ** ulist)
|
|||
if (u->region) {
|
||||
setguard(u, GUARD_NONE);
|
||||
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);
|
||||
} else {
|
||||
addlist(ulist, u);
|
||||
|
|
Loading…
Reference in a new issue