]> git.pond.sub.org Git - empserver/commitdiff
(sector_mcost, bp_neighbors, lnd_mar_one_sector): Deal with disabled
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 16 Jun 2006 21:11:25 +0000 (21:11 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 16 Jun 2006 21:11:25 +0000 (21:11 +0000)
road/rail infrastructure.

src/lib/common/move.c
src/lib/common/path.c
src/lib/subs/lndsub.c

index f6e338d78ec2745c80bd536d4e0011846b984007..52f3accf8b5ea34aaac0d98b47c21503b6d21efe 100644 (file)
@@ -57,12 +57,14 @@ sector_mcost(struct sctstr *sp, int mobtype)
 
     if (mobtype == MOB_MOVE || mobtype == MOB_MARCH) {
        /* linear function in road, base at 0%, base/10 at 100% */
-       cost = base * (1.0 - 0.009 * sp->sct_road);
+       cost = base;
+       if (intrchr[INT_ROAD].in_enable)
+           cost -= base * 0.009 * sp->sct_road;
     } else if (mobtype == MOB_RAIL) {
-       if (sp->sct_rail <= 0)
+       if (!intrchr[INT_RAIL].in_enable || sp->sct_rail <= 0)
            return -1.0;
        /* linear function in rail, base at 0%, base/100 at 100% */
-       cost = base * (1.0 - 0.0099 * sp->sct_rail);
+       cost = base - base * 0.0099 * sp->sct_rail;
     } else {
        CANT_REACH();
        cost = base;
index 0f2f5b19ca6a0a9c985258e66fc4f1a30f90eaf8..985e4f770430a33c2e91a2a30ef07e45502930a7 100644 (file)
@@ -221,7 +221,8 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
           move through it.  We calculate it later. */
        if (dchr[sp->sct_type].d_mcst == 0)
            continue;
-       if (bp->bp_mobtype == MOB_RAIL && sp->sct_rail == 0)
+       if (bp->bp_mobtype == MOB_RAIL
+           && (!intrchr[INT_RAIL].in_enable || sp->sct_rail == 0))
            continue;
        if (sp->sct_own != from->sct_own)
            continue;
index c430f54be29104feac9870e5f4a20385c3212bcc..fb2bd552a55a9498b51aa6b41c5022d4c86e4b8b 100644 (file)
@@ -1072,7 +1072,7 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
                continue;
            }
        }
-       if (sect.sct_rail == 0 &&
+       if ((!intrchr[INT_RAIL].in_enable || sect.sct_rail == 0) &&
            lchr[(int)llp->land.lnd_type].l_flags & L_TRAIN) {
            if (together) {
                pr("no rail system in %s\n", xyas(newx, newy, actor));