Add slot and counter support to programmable pre-signals

This commit is contained in:
Jonathan G Rennison
2020-09-01 18:37:53 +01:00
parent 5c0bf5b9e4
commit abb7b69861
9 changed files with 552 additions and 32 deletions

View File

@@ -20,6 +20,7 @@
#include "tile_type.h"
#include "group_type.h"
#include "vehicle_type.h"
#include "signal_type.h"
#include "3rdparty/cpp-btree/btree_map.h"
#include <map>
#include <vector>
@@ -873,6 +874,8 @@ struct TraceRestrictSlot : TraceRestrictSlotPool::PoolItem<&_tracerestrictslot_p
std::string name;
Owner owner;
std::vector<SignalReference> progsig_dependants;
static void RebuildVehicleIndex();
static bool ValidateVehicleIndex();
static void ValidateSlotOccupants(std::function<void(const char *)> log);
@@ -900,6 +903,7 @@ struct TraceRestrictSlot : TraceRestrictSlotPool::PoolItem<&_tracerestrictslot_p
bool OccupyDryRun(VehicleID ids);
void Vacate(VehicleID id);
void Clear();
void UpdateSignals();
private:
void DeIndex(VehicleID id);
@@ -913,6 +917,8 @@ struct TraceRestrictCounter : TraceRestrictCounterPool::PoolItem<&_tracerestrict
std::string name;
Owner owner;
std::vector<SignalReference> progsig_dependants;
TraceRestrictCounter(CompanyID owner = INVALID_COMPANY)
{
this->owner = owner;