Use separate tile hash for each vehicle type

This commit is contained in:
Jonathan G Rennison
2020-02-28 22:21:10 +00:00
parent 4020719227
commit 4108672cf6
14 changed files with 227 additions and 221 deletions

View File

@@ -307,7 +307,7 @@ static Vehicle *CountShipProc(Vehicle *v, void *data)
{
uint *count = (uint *)data;
/* Ignore other vehicles (aircraft) and ships inside depot. */
if (v->type == VEH_SHIP && (v->vehstatus & VS_HIDDEN) == 0) (*count)++;
if ((v->vehstatus & VS_HIDDEN) == 0) (*count)++;
return nullptr;
}
@@ -331,7 +331,7 @@ static int32 NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *par
if (IsDockingTile(current->tile)) {
/* Check docking tile for occupancy */
uint count = 1;
HasVehicleOnPos(current->tile, &count, &CountShipProc);
HasVehicleOnPos(current->tile, VEH_SHIP, &count, &CountShipProc);
cost += count * 3 * _trackdir_length[trackdir];
}

View File

@@ -268,7 +268,7 @@ public:
{
uint *count = (uint *)data;
/* Ignore other vehicles (aircraft) and ships inside depot. */
if (v->type == VEH_SHIP && (v->vehstatus & VS_HIDDEN) == 0) (*count)++;
if ((v->vehstatus & VS_HIDDEN) == 0) (*count)++;
return nullptr;
}
@@ -288,7 +288,7 @@ public:
if (IsDockingTile(n.GetTile())) {
/* Check docking tile for occupancy */
uint count = 1;
HasVehicleOnPos(n.GetTile(), &count, &CountShipProc);
HasVehicleOnPos(n.GetTile(), VEH_SHIP, &count, &CountShipProc);
c += count * 3 * YAPF_TILE_LENGTH;
}