Use separate tile hash for each vehicle type
This commit is contained in:
@@ -2092,16 +2092,14 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
|
||||
static Vehicle *ClearRoadStopStatusEnum(Vehicle *v, void *)
|
||||
{
|
||||
if (v->type == VEH_ROAD) {
|
||||
/* Okay... we are a road vehicle on a drive through road stop.
|
||||
* But that road stop has just been removed, so we need to make
|
||||
* sure we are in a valid state... however, vehicles can also
|
||||
* turn on road stop tiles, so only clear the 'road stop' state
|
||||
* bits and only when the state was 'in road stop', otherwise
|
||||
* we'll end up clearing the turn around bits. */
|
||||
RoadVehicle *rv = RoadVehicle::From(v);
|
||||
if (HasBit(rv->state, RVS_IN_DT_ROAD_STOP)) rv->state &= RVSB_ROAD_STOP_TRACKDIR_MASK;
|
||||
}
|
||||
/* Okay... we are a road vehicle on a drive through road stop.
|
||||
* But that road stop has just been removed, so we need to make
|
||||
* sure we are in a valid state... however, vehicles can also
|
||||
* turn on road stop tiles, so only clear the 'road stop' state
|
||||
* bits and only when the state was 'in road stop', otherwise
|
||||
* we'll end up clearing the turn around bits. */
|
||||
RoadVehicle *rv = RoadVehicle::From(v);
|
||||
if (HasBit(rv->state, RVS_IN_DT_ROAD_STOP)) rv->state &= RVSB_ROAD_STOP_TRACKDIR_MASK;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2139,7 +2137,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
|
||||
/* don't do the check for drive-through road stops when company bankrupts */
|
||||
if (IsDriveThroughStopTile(tile) && (flags & DC_BANKRUPT)) {
|
||||
/* remove the 'going through road stop' status from all vehicles on that tile */
|
||||
if (flags & DC_EXEC) FindVehicleOnPos(tile, nullptr, &ClearRoadStopStatusEnum);
|
||||
if (flags & DC_EXEC) FindVehicleOnPos(tile, VEH_ROAD, nullptr, &ClearRoadStopStatusEnum);
|
||||
} else {
|
||||
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
||||
if (ret.Failed()) return ret;
|
||||
|
Reference in New Issue
Block a user