Initial implementation of trace restrict slots

This commit is contained in:
Jonathan G Rennison
2017-03-30 21:14:14 +01:00
parent 688ee9ac11
commit 6417fb16c3
20 changed files with 1514 additions and 20 deletions

View File

@@ -50,6 +50,7 @@
#include "tunnel_map.h"
#include "depot_map.h"
#include "gamelog.h"
#include "tracerestrict.h"
#include "linkgraph/linkgraph.h"
#include "linkgraph/refresh.h"
@@ -797,6 +798,11 @@ void Vehicle::PreDestructor()
if (this->owner == _local_company) InvalidateAutoreplaceWindow(this->engine_type, this->group_id);
DeleteGroupHighlightOfVehicle(this);
if (this->type == VEH_TRAIN) {
extern void DeleteTraceRestrictSlotHighlightOfVehicle(const Vehicle *v);
DeleteTraceRestrictSlotHighlightOfVehicle(this);
}
}
if (this->type == VEH_AIRCRAFT && this->IsPrimaryVehicle()) {
@@ -817,6 +823,11 @@ void Vehicle::PreDestructor()
}
}
if (this->type == VEH_TRAIN && HasBit(Train::From(this)->flags, VRF_HAVE_SLOT)) {
TraceRestrictRemoveVehicleFromAllSlots(this->index);
ClrBit(Train::From(this)->flags, VRF_HAVE_SLOT);
}
if (this->Previous() == NULL) {
InvalidateWindowData(WC_VEHICLE_DEPOT, this->tile);
}