Validate cargo packet deferred payments in CheckCaches
This commit is contained in:
@@ -292,6 +292,17 @@ void CargoPacket::PayDeferredPayments()
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool CargoPacket::ValidateDeferredCargoPayments()
|
||||
{
|
||||
for (auto &it : _cargo_packet_deferred_payments) {
|
||||
uint id = it.first >> 32;
|
||||
const CargoPacket *cp = CargoPacket::GetIfValid(id);
|
||||
if (!cp) return false;
|
||||
if (!(cp->flags & CPF_HAS_DEFERRED_PAYMENT)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Cargo list implementation
|
||||
|
@@ -204,6 +204,7 @@ public:
|
||||
static void InvalidateAllFrom(SourceType src_type, SourceID src);
|
||||
static void InvalidateAllFrom(StationID sid);
|
||||
static void AfterLoad();
|
||||
static bool ValidateDeferredCargoPayments();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -75,6 +75,7 @@
|
||||
#include "tbtr_template_vehicle.h"
|
||||
#include "string_func_extra.h"
|
||||
#include "industry.h"
|
||||
#include "cargopacket.h"
|
||||
|
||||
#include "linkgraph/linkgraphschedule.h"
|
||||
#include "tracerestrict.h"
|
||||
@@ -1608,6 +1609,8 @@ void CheckCaches(bool force_check, std::function<void(const char *)> log)
|
||||
if (!TraceRestrictSlot::ValidateVehicleIndex()) CCLOG("Trace restrict slot vehicle index validation failed");
|
||||
TraceRestrictSlot::ValidateSlotOccupants(log);
|
||||
|
||||
if (!CargoPacket::ValidateDeferredCargoPayments()) CCLOG("Cargo packets deferred payments validation failed");
|
||||
|
||||
#undef CCLOG
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user