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

@@ -329,7 +329,7 @@ Vehicle *FindVehiclesInRoadStop(Vehicle *v, void *data)
{
RoadStopEntryRebuilderHelper *rserh = (RoadStopEntryRebuilderHelper*)data;
/* Not a RV or not in the right direction or crashed :( */
if (v->type != VEH_ROAD || DirToDiagDir(v->direction) != rserh->dir || !v->IsPrimaryVehicle() || (v->vehstatus & VS_CRASHED) != 0) return nullptr;
if (DirToDiagDir(v->direction) != rserh->dir || !v->IsPrimaryVehicle() || (v->vehstatus & VS_CRASHED) != 0) return nullptr;
RoadVehicle *rv = RoadVehicle::From(v);
/* Don't add ones not in a road stop */
@@ -363,7 +363,7 @@ void RoadStop::Entry::Rebuild(const RoadStop *rs, int side)
TileIndexDiff offset = abs(TileOffsByDiagDir(dir));
for (TileIndex tile = rs->xy; IsDriveThroughRoadStopContinuation(rs->xy, tile); tile += offset) {
this->length += TILE_SIZE;
FindVehicleOnPos(tile, &rserh, FindVehiclesInRoadStop);
FindVehicleOnPos(tile, VEH_ROAD, &rserh, FindVehiclesInRoadStop);
}
this->occupied = 0;