march: Don't permit trains to march out of sectors without rail

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-12-28 19:58:52 +01:00
parent f0e6551461
commit d87bd96496
4 changed files with 18 additions and 5 deletions

View file

@ -499,6 +499,19 @@ lnd_mar(struct emp_qelem *list, double *minmobp, double *maxmobp,
lnd_stays(actor, "has no mil on it to guide it", llp); lnd_stays(actor, "has no mil on it to guide it", llp);
continue; continue;
} }
switch (lnd_check_mar(lp, &sect)) {
case LND_STUCK_NOT:
break;
case LND_STUCK_NO_RAIL:
lnd_stays(actor, "is stuck off the rail system", llp);
continue;
default:
CANT_REACH();
/* fall through */
case LND_STUCK_IMPASSABLE:
lnd_stays(actor, "is stuck", llp);
continue;
}
if (relations_with(sect.sct_own, actor) != ALLIED && if (relations_with(sect.sct_own, actor) != ALLIED &&
!(lchr[lp->lnd_type].l_flags & L_SPY) && !(lchr[lp->lnd_type].l_flags & L_SPY) &&
sect.sct_own) { sect.sct_own) {

View file

@ -14,7 +14,6 @@ march 20/22 jh
march 22/21/23 jh march 22/21/23 jh
| no rail in 2,2 | no rail in 2,2
march 24 nh march 24 nh
| BUG: not stuck
| kidnapped in -5,3 | kidnapped in -5,3
march 25 gh march 25 gh
|| get stuck on the way || get stuck on the way

View file

@ -217,7 +217,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
21 1 1 3 0 100 127 0 30 1 3 reserve 3 "" -1 127 42 (bombed) "hhhhn" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 21 1 1 3 0 100 127 0 30 1 3 reserve 3 "" -1 127 42 (bombed) "hhhhn" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
22 1 3 3 7 100 60 0 40 0 0 none 0 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 22 1 3 3 7 100 60 0 40 0 0 none 0 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
23 1 3 3 7 50 -5 0 40 0 0 none 0 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 23 1 3 3 7 50 -5 0 40 0 0 none 0 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
24 1 3 3 7 100 60 0 40 0 0 none 0 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 24 1 2 2 7 100 127 0 40 0 0 none 0 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
25 1 -5 3 0 100 127 0 30 -5 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 25 1 -5 3 0 100 127 0 30 -5 3 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
30 1 7 5 0 100 93 0 30 6 6 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 30 1 7 5 0 100 93 0 30 6 6 none 3 "" -1 0 42 () "" 0 5 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
31 0 8 6 0 0 85 0 30 6 6 none 3 "" -1 0 42 () "" 0 4 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0 31 0 8 6 0 0 85 0 30 6 6 none 3 "" -1 0 42 () "" 0 4 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0

View file

@ -776,8 +776,9 @@
Play#1 output Play#1 6 0 585 Play#1 output Play#1 6 0 585
Play#1 input march 24 nh Play#1 input march 24 nh
Play#1 command march Play#1 command march
Play#1 output Play#1 1 Leader is tra train #24 Play#1 output Play#1 1 tra train #24 is stuck off the rail system & stays in 2,2
Play#1 output Play#1 1 tra train #24 stopped at 3,3 Play#1 output Play#1 1 No lands
Play#1 output Play#1 1 command failed
Play#1 output Play#1 6 0 584 Play#1 output Play#1 6 0 584
Play#1 input march 25 gh Play#1 input march 25 gh
Play#1 command march Play#1 command march
@ -1491,7 +1492,7 @@
Play#0 output Play#0 1 1 21 cav cavalry 1,3 100% 5 127 127 0 30 42% 0 0 Play#0 output Play#0 1 1 21 cav cavalry 1,3 100% 5 127 127 0 30 42% 0 0
Play#0 output Play#0 1 1 22 tra train 3,3 100% 5 0 60 0 40 42% 0 0 Play#0 output Play#0 1 1 22 tra train 3,3 100% 5 0 60 0 40 42% 0 0
Play#0 output Play#0 1 1 23 tra train 3,3 50% 5 0 -5 0 40 42% 0 0 Play#0 output Play#0 1 1 23 tra train 3,3 50% 5 0 -5 0 40 42% 0 0
Play#0 output Play#0 1 1 24 tra train 3,3 100% 5 0 60 0 40 42% 0 0 Play#0 output Play#0 1 1 24 tra train 2,2 100% 5 0 127 0 40 42% 0 0
Play#0 output Play#0 1 1 25 cav cavalry -5,3 100% 5 0 127 0 30 42% 0 0 Play#0 output Play#0 1 1 25 cav cavalry -5,3 100% 5 0 127 0 30 42% 0 0
Play#0 output Play#0 1 1 30 cav cavalry 7,5 100% 5 0 93 0 30 42% 0 0 Play#0 output Play#0 1 1 30 cav cavalry 7,5 100% 5 0 93 0 30 42% 0 0
Play#0 output Play#0 1 1 32 cav cavalry 7,5 87% 1 0 93 0 30 42% 0 0 Play#0 output Play#0 1 1 32 cav cavalry 7,5 87% 1 0 93 0 30 42% 0 0