Exclude effect and disaster vehicles from vehicle tile hash

pull/135/head
Jonathan G Rennison 4 years ago
parent 1d79a7610d
commit 4020719227

@ -760,7 +760,7 @@ CommandCost EnsureNoTrainOnTrackBits(TileIndex tile, TrackBits track_bits)
return CommandCost();
}
static void UpdateVehicleTileHash(Vehicle *v, bool remove)
void UpdateVehicleTileHash(Vehicle *v, bool remove)
{
Vehicle **old_hash = v->hash_tile_current;
Vehicle **new_hash;
@ -1078,7 +1078,7 @@ Vehicle::~Vehicle()
delete v;
UpdateVehicleTileHash(this, true);
if (this->type < VEH_COMPANY_END) UpdateVehicleTileHash(this, true);
UpdateVehicleViewportHash(this, INVALID_COORD, 0);
DeleteVehicleNews(this->index, INVALID_STRING_ID);
DeleteNewGRFInspectWindow(GetGrfSpecFeature(this->type), this->index);
@ -2330,16 +2330,6 @@ void VehicleEnterDepot(Vehicle *v)
}
}
/**
* Update the position of the vehicle. This will update the hash that tells
* which vehicles are on a tile.
*/
void Vehicle::UpdatePosition()
{
UpdateVehicleTileHash(this, false);
}
/**
* Update the vehicle on the viewport, updating the right hash and setting the
* new coordinates.

@ -864,7 +864,16 @@ public:
void UpdateVisualEffect(bool allow_power_change = true);
void ShowVisualEffect() const;
void UpdatePosition();
/**
* Update the position of the vehicle. This will update the hash that tells
* which vehicles are on a tile.
*/
void UpdatePosition()
{
extern void UpdateVehicleTileHash(Vehicle *v, bool remove);
if (this->type < VEH_COMPANY_END) UpdateVehicleTileHash(this, false);
}
void UpdateViewport(bool dirty);
void UpdatePositionAndViewport();
void MarkAllViewportsDirty() const;

Loading…
Cancel
Save