]> git.pond.sub.org Git - empserver/commitdiff
march: Don't permit trains to march out of sectors without rail
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 28 Dec 2014 18:58:52 +0000 (19:58 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 28 Feb 2015 15:12:54 +0000 (16:12 +0100)
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/lndsub.c
tests/navi-march/02-march-1
tests/navi-march/final.xdump
tests/navi-march/journal.log

index c5194ee06a021fdb1cd0fe5900a75af618c3c869..1acc57d1bb87917cb2646225176e3c27647e7f46 100644 (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);
            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 &&
            !(lchr[lp->lnd_type].l_flags & L_SPY) &&
            sect.sct_own) {
index 726f8035e4943c8ea7de686f160bf3210cb255b2..387d0d773fc69bb483ef1ea370cac5d589653b0a 100644 (file)
@@ -14,7 +14,6 @@ march 20/22 jh
 march 22/21/23 jh
 | no rail in 2,2
 march 24 nh
-| BUG: not stuck
 | kidnapped in -5,3
 march 25 gh
 || get stuck on the way
index 889431e3949e05f1da811c2c0321bca9d565fbe2..f4383455ebbcc7c57c8552f8255a2b79f6df0a25 100644 (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
 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
-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
 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
index c02fc22c9acb9f6f009a6ca57a8a79d58c1ff489..a0ecf9c475f9c1a6c921036024ba77085419ae67 100644 (file)
     Play#1 output Play#1 6 0 585
     Play#1 input march 24 nh
     Play#1 command march
-    Play#1 output Play#1 1 Leader is tra  train #24
-    Play#1 output Play#1 1 tra  train #24 stopped at 3,3
+    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 No lands
+    Play#1 output Play#1 1 command failed
     Play#1 output Play#1 6 0 584
     Play#1 input march 25 gh
     Play#1 command march
     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   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   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