Maintain map of targeted road vehicles to small UFO disaster vehicle

This commit is contained in:
Jonathan G Rennison
2024-02-12 00:48:13 +00:00
parent 1e2834a422
commit 903adceab5
6 changed files with 66 additions and 15 deletions

View File

@@ -1030,6 +1030,7 @@ void InitializeVehicles()
{
_vehicles_to_autoreplace.clear();
ResetVehicleHash();
ResetDisasterVehicleTargeting();
}
uint CountVehiclesInChain(const Vehicle *v)
@@ -1202,6 +1203,8 @@ void Vehicle::PreDestructor()
/* Leave the drive through roadstop, when you have not already left it. */
RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
}
ReleaseDisasterVehicleTargetingVehicle(this->index);
}
if (HasBit(this->vehicle_flags, VF_HAVE_SLOT)) {
@@ -1238,8 +1241,6 @@ void Vehicle::PreDestructor()
StopGlobalFollowVehicle(this);
ReleaseDisastersTargetingVehicle(this->index);
/* sometimes, eg. for disaster vehicles, when company bankrupts, when removing crashed/flooded vehicles,
* it may happen that vehicle chain is deleted when visible */
if (this->IsDrawn()) this->MarkAllViewportsDirty();