4.0.2 made land unit mobility costs differ significantly from normal
move costs, but failed to make A* use these costs. This broke land unit path finding. Fix: (MOB_ROAD, MOB_MOVE, MOB_MARCH): Split MOB_ROAD into MOB_MOVE and MOB_MARCH. Users changed. (lnd_mobcost, sector_mcost): Move minimum mobcost logic to sector_mcost(), where it is visible to A*. Also fixes unit reaction path cost. (lnd_path): Fix confusing message: don't claim there's no path when all we really know is that there's no railway.
This commit is contained in:
parent
6ab05ae8a1
commit
5ad86bc7ce
11 changed files with 46 additions and 59 deletions
|
@ -85,7 +85,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
|
|||
}
|
||||
pr("Looking for best path to %s\n", path);
|
||||
path = BestLandPath(buf2, start, &ending_sect, &total_mcost,
|
||||
MOB_ROAD);
|
||||
MOB_MOVE);
|
||||
if (exploring && path) /* take off the 'h' */
|
||||
path[strlen(path) - 1] = '\0';
|
||||
if (!path)
|
||||
|
@ -126,7 +126,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
|
|||
if (movstr && sarg_xy(movstr, &dx, &dy)) {
|
||||
if (getsect(dx, dy, &dsect)) {
|
||||
movstr = BestLandPath(buf2, §, &dsect, &mv_cost,
|
||||
MOB_ROAD);
|
||||
MOB_MOVE);
|
||||
} else {
|
||||
pr("Invalid destination sector!\n");
|
||||
movstr = NULL;
|
||||
|
@ -190,7 +190,7 @@ move_ground(struct sctstr *start, struct sctstr *end,
|
|||
*movstr = 0;
|
||||
continue;
|
||||
}
|
||||
sect_mcost = sector_mcost(&next, MOB_ROAD);
|
||||
sect_mcost = sector_mcost(&next, MOB_MOVE);
|
||||
if ((!player->owner && (!exploring
|
||||
|| next.sct_item[I_MILIT]
|
||||
|| next.sct_item[I_CIVIL]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue