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();
|
skip_token();
|
||||||
ut = getunit(r, u->faction);
|
ut = getunit(r, u->faction);
|
||||||
if (ut!=NULL) {
|
if (ut!=NULL) {
|
||||||
boolean found = false;
|
if (get_keyword(ut->thisorder) == K_DRIVE) {
|
||||||
if (get_keyword(ut->thisorder) == K_DRIVE && can_move(ut)) {
|
if (ut->building && !can_leave(ut)) {
|
||||||
if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
|
cmistake(ut, ut->thisorder, 150, MSG_MOVE);
|
||||||
init_tokens(ut->thisorder);
|
cmistake(u, ord, 99, MSG_MOVE);
|
||||||
skip_token();
|
} else if (!can_move(ut)) {
|
||||||
if (getunit(u->region, ut->faction) == u) {
|
cmistake(u, ord, 99, MSG_MOVE);
|
||||||
const region_list * route_to = travel_route(ut, route_begin, route_end, ord, TRAVEL_TRANSPORTED);
|
} else {
|
||||||
|
boolean found = false;
|
||||||
|
|
||||||
if (route_to!=route_begin) {
|
if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
|
||||||
get_followers(ut, r, route_to, followers);
|
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 {
|
} 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", ""));
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue