Path finding for trains never worked; it ignored the need for rail:
(sector_mcost, bp_neighbors): Fix for MOB_RAIL and sct_rail == 0. Closes #781528.
This commit is contained in:
parent
20c02295a6
commit
6ab05ae8a1
2 changed files with 5 additions and 0 deletions
|
@ -53,6 +53,8 @@ sector_mcost(struct sctstr *sp, int do_bonus)
|
||||||
if (do_bonus == MOB_ROAD) {
|
if (do_bonus == MOB_ROAD) {
|
||||||
d = d / (1.0 + sp->sct_road / 122.0);
|
d = d / (1.0 + sp->sct_road / 122.0);
|
||||||
} else if (do_bonus == MOB_RAIL) {
|
} else if (do_bonus == MOB_RAIL) {
|
||||||
|
if (sp->sct_rail <= 0)
|
||||||
|
return -1.0;
|
||||||
d = d / (1.0 + sp->sct_rail / 100.0);
|
d = d / (1.0 + sp->sct_rail / 100.0);
|
||||||
} else {
|
} else {
|
||||||
if (d < 2.0)
|
if (d < 2.0)
|
||||||
|
|
|
@ -182,6 +182,7 @@ static int
|
||||||
bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
|
bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
|
||||||
{
|
{
|
||||||
struct sctstr *sectp = (void *)empfile[EF_SECTOR].cache;
|
struct sctstr *sectp = (void *)empfile[EF_SECTOR].cache;
|
||||||
|
struct bestp *bp = pp;
|
||||||
coord x, y;
|
coord x, y;
|
||||||
coord nx, ny;
|
coord nx, ny;
|
||||||
int n = 0, q;
|
int n = 0, q;
|
||||||
|
@ -220,6 +221,8 @@ bp_neighbors(struct as_coord c, struct as_coord *cp, void *pp)
|
||||||
move through it. We calculate it later. */
|
move through it. We calculate it later. */
|
||||||
if (dchr[sp->sct_type].d_mcst == 0)
|
if (dchr[sp->sct_type].d_mcst == 0)
|
||||||
continue;
|
continue;
|
||||||
|
if (bp->bp_mobtype == MOB_RAIL && sp->sct_rail == 0)
|
||||||
|
continue;
|
||||||
if (sp->sct_own != from->sct_own)
|
if (sp->sct_own != from->sct_own)
|
||||||
continue;
|
continue;
|
||||||
cp[n].x = sx;
|
cp[n].x = sx;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue