(sector_mcost, bp_neighbors, lnd_mar_one_sector): Deal with disabled
road/rail infrastructure.
This commit is contained in:
parent
9067d7a453
commit
07de857b88
3 changed files with 8 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue