mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-21 01:59:44 +00:00
Codechange: make SLRefType scoped
This commit is contained in:
@@ -20,7 +20,7 @@ static const SaveLoad _engine_renew_desc[] = {
|
||||
SLE_VAR(EngineRenew, from, SLE_UINT16),
|
||||
SLE_VAR(EngineRenew, to, SLE_UINT16),
|
||||
|
||||
SLE_REF(EngineRenew, next, REF_ENGINE_RENEWS),
|
||||
SLE_REF(EngineRenew, next, SLRefType::EngineRenew),
|
||||
SLE_CONDVAR(EngineRenew, group_id, SLE_UINT16, SaveLoadVersion::VehicleGroups, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(EngineRenew, replace_when_old, SLE_BOOL, SaveLoadVersion::AutoreplaceWhenOldTreeLimit, SaveLoadVersion::MaxVersion),
|
||||
};
|
||||
|
||||
@@ -314,7 +314,7 @@ class SlCompanySettings : public DefaultSaveLoadHandler<SlCompanySettings, Compa
|
||||
public:
|
||||
static inline const SaveLoad description[] = {
|
||||
/* Engine renewal settings */
|
||||
SLE_CONDREF(CompanyProperties, engine_renew_list, REF_ENGINE_RENEWS, SaveLoadVersion::EngineRenewPool, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(CompanyProperties, engine_renew_list, SLRefType::EngineRenew, SaveLoadVersion::EngineRenewPool, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(CompanyProperties, settings.engine_renew, SLE_BOOL, SaveLoadVersion::EngineRenew, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(CompanyProperties, settings.engine_renew_months, SLE_INT16, SaveLoadVersion::EngineRenew, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(CompanyProperties, settings.engine_renew_money, SLE_UINT32, SaveLoadVersion::EngineRenew, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -23,7 +23,7 @@ static const SaveLoad _depot_desc[] = {
|
||||
SLE_CONDVAR(Depot, xy, SLE_FILE_U16 | SLE_VAR_U32, SaveLoadVersion::MinVersion, SaveLoadVersion::MultipleRoadStops),
|
||||
SLE_CONDVAR(Depot, xy, SLE_UINT32, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLEG_CONDVAR("town_index", _town_index, SLE_UINT16, SaveLoadVersion::MinVersion, SaveLoadVersion::UniqueDepotNames),
|
||||
SLE_CONDREF(Depot, town, REF_TOWN, SaveLoadVersion::UniqueDepotNames, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Depot, town, SLRefType::Town, SaveLoadVersion::UniqueDepotNames, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Depot, town_cn, SLE_UINT16, SaveLoadVersion::UniqueDepotNames, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDSSTR(Depot, name, SLE_STR, SaveLoadVersion::UniqueDepotNames, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Depot, build_date, SLE_INT32, SaveLoadVersion::NewGRFDepotBuildDate, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -82,7 +82,7 @@ struct ECMYChunkHandler : ChunkHandler {
|
||||
};
|
||||
|
||||
static const SaveLoad _cargopayment_desc[] = {
|
||||
SLE_REF(CargoPayment, front, REF_VEHICLE),
|
||||
SLE_REF(CargoPayment, front, SLRefType::Vehicle),
|
||||
SLE_VAR(CargoPayment, route_profit, SLE_INT64),
|
||||
SLE_VAR(CargoPayment, visual_profit, SLE_INT64),
|
||||
SLE_CONDVAR(CargoPayment, visual_transfer, SLE_INT64, SaveLoadVersion::CargoReservation, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -157,8 +157,8 @@ static const SaveLoad _industry_desc[] = {
|
||||
SLE_CONDVAR(Industry, location.tile, SLE_UINT32, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLE_VAR(Industry, location.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_VAR(Industry, location.h, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_REF(Industry, town, REF_TOWN),
|
||||
SLE_CONDREF(Industry, neutral_station, REF_STATION, SaveLoadVersion::ServeNeutralIndustries, SaveLoadVersion::MaxVersion),
|
||||
SLE_REF(Industry, town, SLRefType::Town),
|
||||
SLE_CONDREF(Industry, neutral_station, SLRefType::Station, SaveLoadVersion::ServeNeutralIndustries, SaveLoadVersion::MaxVersion),
|
||||
SLEG_CONDARR("produced_cargo", SlIndustryProduced::old_cargo, SLE_UINT8, INDUSTRY_ORIGINAL_NUM_OUTPUTS, SaveLoadVersion::StoreIndustryCargo, SaveLoadVersion::ExtendIndustryCargoSlots),
|
||||
SLEG_CONDARR("produced_cargo", SlIndustryProduced::old_cargo, SLE_UINT8, INDUSTRY_NUM_OUTPUTS, SaveLoadVersion::ExtendIndustryCargoSlots, SaveLoadVersion::IndustryCargoReorganise),
|
||||
SLEG_CONDARR("incoming_cargo_waiting", SlIndustryAccepted::old_waiting, SLE_UINT16, INDUSTRY_ORIGINAL_NUM_INPUTS, SaveLoadVersion::CargoPaymentOverflow, SaveLoadVersion::ExtendIndustryCargoSlots),
|
||||
@@ -199,7 +199,7 @@ static const SaveLoad _industry_desc[] = {
|
||||
SLE_CONDVAR(Industry, exclusive_consumer, SLE_UINT8, SaveLoadVersion::GSIndustryControl, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLEG_CONDARR("storage", _old_ind_persistent_storage.storage, SLE_UINT32, 16, SaveLoadVersion::NewGRFPersistentStorage, SaveLoadVersion::PersistentStoragePool),
|
||||
SLE_CONDREF(Industry, psa, REF_STORAGE, SaveLoadVersion::PersistentStoragePool, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Industry, psa, SLRefType::Storage, SaveLoadVersion::PersistentStoragePool, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_CONDVAR(Industry, random, SLE_UINT16, SaveLoadVersion::NewGRFIndustryRandomTriggers, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDSSTR(Industry, text, SLE_STR | StringValidationSetting::AllowControlCode, SaveLoadVersion::IndustryText, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -219,8 +219,8 @@ SaveLoadTable GetLinkGraphJobDesc()
|
||||
SaveLoadTable GetLinkGraphScheduleDesc()
|
||||
{
|
||||
static const SaveLoad schedule_desc[] = {
|
||||
SLE_REFLIST(LinkGraphSchedule, schedule, REF_LINK_GRAPH),
|
||||
SLE_REFLIST(LinkGraphSchedule, running, REF_LINK_GRAPH_JOB),
|
||||
SLE_REFLIST(LinkGraphSchedule, schedule, SLRefType::LinkGraph),
|
||||
SLE_REFLIST(LinkGraphSchedule, running, SLRefType::LinkGraphJob),
|
||||
};
|
||||
return schedule_desc;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ static const SaveLoad _object_desc[] = {
|
||||
SLE_VAR(Object, location.tile, SLE_UINT32),
|
||||
SLE_VAR(Object, location.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_VAR(Object, location.h, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_REF(Object, town, REF_TOWN),
|
||||
SLE_REF(Object, town, SLRefType::Town),
|
||||
SLE_VAR(Object, build_date, SLE_UINT32),
|
||||
SLE_CONDVARNAME(Object, recolour_offset, "colour", SLE_UINT8, SaveLoadVersion::IndustryPlatform, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Object, view, SLE_UINT8, SaveLoadVersion::NewGRFObjectView, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -302,7 +302,7 @@ SaveLoadTable GetOrderBackupDescription()
|
||||
SLE_CONDVAR(OrderBackup, service_interval, SLE_FILE_U32 | SLE_VAR_U16, SaveLoadVersion::MinVersion, SaveLoadVersion::FixOrderBackup),
|
||||
SLE_CONDVAR(OrderBackup, service_interval, SLE_UINT16, SaveLoadVersion::FixOrderBackup, SaveLoadVersion::MaxVersion),
|
||||
SLE_SSTR(OrderBackup, name, SLE_STR),
|
||||
SLE_CONDREF(OrderBackup, clone, REF_VEHICLE, SaveLoadVersion::FixOrderBackup, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(OrderBackup, clone, SLRefType::Vehicle, SaveLoadVersion::FixOrderBackup, SaveLoadVersion::MaxVersion),
|
||||
SLE_VAR(OrderBackup, cur_real_order_index, SLE_UINT8),
|
||||
SLE_CONDVAR(OrderBackup, cur_implicit_order_index, SLE_UINT8, SaveLoadVersion::BackupOrderState, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(OrderBackup, current_order_time, SLE_UINT32, SaveLoadVersion::BackupOrderState, SaveLoadVersion::MaxVersion),
|
||||
|
||||
+27
-27
@@ -1308,17 +1308,17 @@ static uint32_t ReferenceToInt(const void *obj, SLRefType rt)
|
||||
if (obj == nullptr) return 0;
|
||||
|
||||
switch (rt) {
|
||||
case REF_VEHICLE_OLD: // Old vehicles we save as new ones
|
||||
case REF_VEHICLE: return static_cast<const Vehicle *>(obj)->index + 1;
|
||||
case REF_STATION: return static_cast<const Station *>(obj)->index + 1;
|
||||
case REF_TOWN: return static_cast<const Town *>(obj)->index + 1;
|
||||
case REF_ROADSTOPS: return static_cast<const RoadStop *>(obj)->index + 1;
|
||||
case REF_ENGINE_RENEWS: return static_cast<const EngineRenew *>(obj)->index + 1;
|
||||
case REF_CARGO_PACKET: return static_cast<const CargoPacket *>(obj)->index + 1;
|
||||
case REF_ORDERLIST: return static_cast<const OrderList *>(obj)->index + 1;
|
||||
case REF_STORAGE: return static_cast<const PersistentStorage *>(obj)->index + 1;
|
||||
case REF_LINK_GRAPH: return static_cast<const LinkGraph *>(obj)->index + 1;
|
||||
case REF_LINK_GRAPH_JOB: return static_cast<const LinkGraphJob *>(obj)->index + 1;
|
||||
case SLRefType::OldVehicle: // Old vehicles we save as new ones
|
||||
case SLRefType::Vehicle: return static_cast<const Vehicle *>(obj)->index + 1;
|
||||
case SLRefType::Station: return static_cast<const Station *>(obj)->index + 1;
|
||||
case SLRefType::Town: return static_cast<const Town *>(obj)->index + 1;
|
||||
case SLRefType::RoadStop: return static_cast<const RoadStop *>(obj)->index + 1;
|
||||
case SLRefType::EngineRenew: return static_cast<const EngineRenew *>(obj)->index + 1;
|
||||
case SLRefType::CargoPacket: return static_cast<const CargoPacket *>(obj)->index + 1;
|
||||
case SLRefType::OrderList: return static_cast<const OrderList *>(obj)->index + 1;
|
||||
case SLRefType::Storage: return static_cast<const PersistentStorage *>(obj)->index + 1;
|
||||
case SLRefType::LinkGraph: return static_cast<const LinkGraph *>(obj)->index + 1;
|
||||
case SLRefType::LinkGraphJob: return static_cast<const LinkGraphJob *>(obj)->index + 1;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
@@ -1339,58 +1339,58 @@ static void *IntToReference(size_t index, SLRefType rt)
|
||||
|
||||
assert(_sl.action == SaveLoadAction::Ptrs);
|
||||
|
||||
/* After version 4.3 REF_VEHICLE_OLD is saved as REF_VEHICLE,
|
||||
/* After version 4.3 SLRefType::OldVehicle is saved as SLRefType::Vehicle,
|
||||
* and should be loaded like that */
|
||||
if (rt == REF_VEHICLE_OLD && !IsSavegameVersionBefore(SaveLoadVersion::TownTolerancePauseMode, 4)) {
|
||||
rt = REF_VEHICLE;
|
||||
if (rt == SLRefType::OldVehicle && !IsSavegameVersionBefore(SaveLoadVersion::TownTolerancePauseMode, 4)) {
|
||||
rt = SLRefType::Vehicle;
|
||||
}
|
||||
|
||||
/* No need to look up nullptr pointers, just return immediately */
|
||||
if (index == (rt == REF_VEHICLE_OLD ? 0xFFFF : 0)) return nullptr;
|
||||
if (index == (rt == SLRefType::OldVehicle ? 0xFFFF : 0)) return nullptr;
|
||||
|
||||
/* Correct index. Old vehicles were saved differently:
|
||||
* invalid vehicle was 0xFFFF, now we use 0x0000 for everything invalid. */
|
||||
if (rt != REF_VEHICLE_OLD) index--;
|
||||
if (rt != SLRefType::OldVehicle) index--;
|
||||
|
||||
switch (rt) {
|
||||
case REF_ORDERLIST:
|
||||
case SLRefType::OrderList:
|
||||
if (OrderList::IsValidID(index)) return OrderList::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid OrderList");
|
||||
|
||||
case REF_VEHICLE_OLD:
|
||||
case REF_VEHICLE:
|
||||
case SLRefType::OldVehicle:
|
||||
case SLRefType::Vehicle:
|
||||
if (Vehicle::IsValidID(index)) return Vehicle::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid Vehicle");
|
||||
|
||||
case REF_STATION:
|
||||
case SLRefType::Station:
|
||||
if (Station::IsValidID(index)) return Station::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid Station");
|
||||
|
||||
case REF_TOWN:
|
||||
case SLRefType::Town:
|
||||
if (Town::IsValidID(index)) return Town::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid Town");
|
||||
|
||||
case REF_ROADSTOPS:
|
||||
case SLRefType::RoadStop:
|
||||
if (RoadStop::IsValidID(index)) return RoadStop::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid RoadStop");
|
||||
|
||||
case REF_ENGINE_RENEWS:
|
||||
case SLRefType::EngineRenew:
|
||||
if (EngineRenew::IsValidID(index)) return EngineRenew::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid EngineRenew");
|
||||
|
||||
case REF_CARGO_PACKET:
|
||||
case SLRefType::CargoPacket:
|
||||
if (CargoPacket::IsValidID(index)) return CargoPacket::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid CargoPacket");
|
||||
|
||||
case REF_STORAGE:
|
||||
case SLRefType::Storage:
|
||||
if (PersistentStorage::IsValidID(index)) return PersistentStorage::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid PersistentStorage");
|
||||
|
||||
case REF_LINK_GRAPH:
|
||||
case SLRefType::LinkGraph:
|
||||
if (LinkGraph::IsValidID(index)) return LinkGraph::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid LinkGraph");
|
||||
|
||||
case REF_LINK_GRAPH_JOB:
|
||||
case SLRefType::LinkGraphJob:
|
||||
if (LinkGraphJob::IsValidID(index)) return LinkGraphJob::Get(index);
|
||||
SlErrorCorrupt("Referencing invalid LinkGraphJob");
|
||||
|
||||
|
||||
+12
-12
@@ -638,18 +638,18 @@ public:
|
||||
};
|
||||
|
||||
/** Type of reference (#SLE_REF, #SLE_CONDREF). */
|
||||
enum SLRefType : uint8_t {
|
||||
REF_VEHICLE = 1, ///< Load/save a reference to a vehicle.
|
||||
REF_STATION = 2, ///< Load/save a reference to a station.
|
||||
REF_TOWN = 3, ///< Load/save a reference to a town.
|
||||
REF_VEHICLE_OLD = 4, ///< Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
|
||||
REF_ROADSTOPS = 5, ///< Load/save a reference to a bus/truck stop.
|
||||
REF_ENGINE_RENEWS = 6, ///< Load/save a reference to an engine renewal (autoreplace).
|
||||
REF_CARGO_PACKET = 7, ///< Load/save a reference to a cargo packet.
|
||||
REF_ORDERLIST = 8, ///< Load/save a reference to an orderlist.
|
||||
REF_STORAGE = 9, ///< Load/save a reference to a persistent storage.
|
||||
REF_LINK_GRAPH = 10, ///< Load/save a reference to a link graph.
|
||||
REF_LINK_GRAPH_JOB = 11, ///< Load/save a reference to a link graph job.
|
||||
enum class SLRefType : uint8_t {
|
||||
Vehicle = 1, ///< Load/save a reference to a vehicle.
|
||||
Station = 2, ///< Load/save a reference to a station.
|
||||
Town = 3, ///< Load/save a reference to a town.
|
||||
OldVehicle = 4, ///< Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
|
||||
RoadStop = 5, ///< Load/save a reference to a bus/truck stop.
|
||||
EngineRenew = 6, ///< Load/save a reference to an engine renewal (autoreplace).
|
||||
CargoPacket = 7, ///< Load/save a reference to a cargo packet.
|
||||
OrderList = 8, ///< Load/save a reference to an orderlist.
|
||||
Storage = 9, ///< Load/save a reference to a persistent storage.
|
||||
LinkGraph = 10, ///< Load/save a reference to a link graph.
|
||||
LinkGraphJob = 11, ///< Load/save a reference to a link graph job.
|
||||
};
|
||||
|
||||
/** The types/structures of data that can be stored in the file. */
|
||||
|
||||
+12
-12
@@ -159,7 +159,7 @@ void AfterLoadRoadStops()
|
||||
static const SaveLoad _roadstop_desc[] = {
|
||||
SLE_VAR(RoadStop, xy, SLE_UINT32),
|
||||
SLE_VAR(RoadStop, status, SLE_UINT8),
|
||||
SLE_REF(RoadStop, next, REF_ROADSTOPS),
|
||||
SLE_REF(RoadStop, next, SLRefType::RoadStop),
|
||||
};
|
||||
|
||||
static uint16_t _waiting_acceptance;
|
||||
@@ -264,7 +264,7 @@ class SlStationCargo : public DefaultSaveLoadHandler<SlStationCargo, GoodsEntry>
|
||||
public:
|
||||
static inline const SaveLoad description[] = {
|
||||
SLE_VAR(StationCargoPair, first, SLE_UINT16),
|
||||
SLE_REFLIST(StationCargoPair, second, REF_CARGO_PACKET),
|
||||
SLE_REFLIST(StationCargoPair, second, SLRefType::CargoPacket),
|
||||
};
|
||||
static inline const SaveLoadCompatTable compat_description = _station_cargo_sl_compat;
|
||||
|
||||
@@ -384,7 +384,7 @@ public:
|
||||
SLEG_CONDVAR("cargo_feeder_share", _cargo_feeder_share, SLE_FILE_U32 | SLE_VAR_I64, SaveLoadVersion::TransferOrder, SaveLoadVersion::UnifyCurrency),
|
||||
SLEG_CONDVAR("cargo_feeder_share", _cargo_feeder_share, SLE_INT64, SaveLoadVersion::UnifyCurrency, SaveLoadVersion::CargoPackets),
|
||||
SLE_CONDVAR(GoodsEntry, amount_fract, SLE_UINT8, SaveLoadVersion::FractionalCargoDelivery, SaveLoadVersion::MaxVersion),
|
||||
SLEG_CONDREFLIST("packets", _packets, REF_CARGO_PACKET, SaveLoadVersion::CargoPackets, SaveLoadVersion::Cargodist),
|
||||
SLEG_CONDREFLIST("packets", _packets, SLRefType::CargoPacket, SaveLoadVersion::CargoPackets, SaveLoadVersion::Cargodist),
|
||||
SLEG_CONDVAR("old_num_dests", _old_num_dests, SLE_UINT32, SaveLoadVersion::Cargodist, SaveLoadVersion::SaveloadListLength),
|
||||
SLEG_CONDVAR("cargo.reserved_count", SlStationGoods::cargo_reserved_count, SLE_UINT32, SaveLoadVersion::CargoReservation, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(GoodsEntry, link_graph, SLE_UINT16, SaveLoadVersion::Cargodist, SaveLoadVersion::MaxVersion),
|
||||
@@ -491,7 +491,7 @@ static const SaveLoad _old_station_desc[] = {
|
||||
SLE_CONDVAR(Station, train_station.tile, SLE_UINT32, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_FILE_U16 | SLE_VAR_U32, SaveLoadVersion::MinVersion, SaveLoadVersion::MultipleRoadStops),
|
||||
SLE_CONDVAR(Station, airport.tile, SLE_UINT32, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLE_REF(Station, town, REF_TOWN),
|
||||
SLE_REF(Station, town, SLRefType::Town),
|
||||
SLE_VAR(Station, train_station.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_CONDVAR(Station, train_station.h, SLE_FILE_U8 | SLE_VAR_U16, SaveLoadVersion::VehicleCurrencyStationChanges, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -516,15 +516,15 @@ static const SaveLoad _old_station_desc[] = {
|
||||
SLE_CONDVAR(Station, build_date, SLE_FILE_U16 | SLE_VAR_I32, SaveLoadVersion::BiggerStationVariables, SaveLoadVersion::BigDates),
|
||||
SLE_CONDVAR(Station, build_date, SLE_INT32, SaveLoadVersion::BigDates, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_CONDREF(Station, bus_stops, REF_ROADSTOPS, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Station, truck_stops, REF_ROADSTOPS, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Station, bus_stops, SLRefType::RoadStop, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Station, truck_stops, SLRefType::RoadStop, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
|
||||
/* Used by newstations for graphic variations */
|
||||
SLE_CONDVAR(Station, random_bits, SLE_UINT16, SaveLoadVersion::NewGRFStations, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVARNAME(Station, waiting_random_triggers, "waiting_triggers", SLE_UINT8, SaveLoadVersion::NewGRFStations, SaveLoadVersion::MaxVersion),
|
||||
SLEG_CONDVAR("num_specs", SlStationSpecList<StationSpec>::last_num_specs, SLE_UINT8, SaveLoadVersion::NewGRFStations, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_CONDREFLIST(Station, loading_vehicles, REF_VEHICLE, SaveLoadVersion::FifoLoading, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREFLIST(Station, loading_vehicles, SLRefType::Vehicle, SaveLoadVersion::FifoLoading, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLEG_STRUCTLIST("goods", SlStationGoods),
|
||||
SLEG_CONDSTRUCTLIST("speclist", SlStationSpecList<StationSpec>, SaveLoadVersion::NewGRFStations, SaveLoadVersion::MaxVersion),
|
||||
@@ -583,7 +583,7 @@ class SlStationBase : public DefaultSaveLoadHandler<SlStationBase, BaseStation>
|
||||
public:
|
||||
static inline const SaveLoad description[] = {
|
||||
SLE_VAR(BaseStation, xy, SLE_UINT32),
|
||||
SLE_REF(BaseStation, town, REF_TOWN),
|
||||
SLE_REF(BaseStation, town, SLRefType::Town),
|
||||
SLE_VAR(BaseStation, string_id, SLE_STRINGID),
|
||||
SLE_SSTR(BaseStation, name, SLE_STR | StringValidationSetting::AllowControlCode),
|
||||
SLE_VAR(BaseStation, delete_ctr, SLE_UINT8),
|
||||
@@ -626,8 +626,8 @@ public:
|
||||
SLE_VAR(Station, train_station.w, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
SLE_VAR(Station, train_station.h, SLE_FILE_U8 | SLE_VAR_U16),
|
||||
|
||||
SLE_REF(Station, bus_stops, REF_ROADSTOPS),
|
||||
SLE_REF(Station, truck_stops, REF_ROADSTOPS),
|
||||
SLE_REF(Station, bus_stops, SLRefType::RoadStop),
|
||||
SLE_REF(Station, truck_stops, SLRefType::RoadStop),
|
||||
SLE_CONDVAR(Station, ship_station.tile, SLE_UINT32, SaveLoadVersion::MultitileDocks, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Station, ship_station.w, SLE_FILE_U8 | SLE_VAR_U16, SaveLoadVersion::MultitileDocks, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Station, ship_station.h, SLE_FILE_U8 | SLE_VAR_U16, SaveLoadVersion::MultitileDocks, SaveLoadVersion::MaxVersion),
|
||||
@@ -642,7 +642,7 @@ public:
|
||||
SLE_VARNAME(Station, airport.blocks, "airport.flags", SLE_UINT64),
|
||||
SLE_CONDVAR(Station, airport.rotation, SLE_UINT8, SaveLoadVersion::NewGRFAirportSmoke, SaveLoadVersion::MaxVersion),
|
||||
SLEG_CONDARR("storage", _old_st_persistent_storage.storage, SLE_UINT32, 16, SaveLoadVersion::NewGRFAirportSmoke, SaveLoadVersion::PersistentStoragePool),
|
||||
SLE_CONDREF(Station, airport.psa, REF_STORAGE, SaveLoadVersion::PersistentStoragePool, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Station, airport.psa, SLRefType::Storage, SaveLoadVersion::PersistentStoragePool, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_VAR(Station, indtype, SLE_UINT8),
|
||||
|
||||
@@ -650,7 +650,7 @@ public:
|
||||
SLE_VAR(Station, time_since_unload, SLE_UINT8),
|
||||
SLE_VAR(Station, last_vehicle_type, SLE_UINT8),
|
||||
SLE_VAR(Station, had_vehicle_of_type, SLE_UINT8),
|
||||
SLE_REFLIST(Station, loading_vehicles, REF_VEHICLE),
|
||||
SLE_REFLIST(Station, loading_vehicles, SLRefType::Vehicle),
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_FILE_U32 | SLE_VAR_U64, SaveLoadVersion::TownAcceptance, SaveLoadVersion::ExtendCargotypes),
|
||||
SLE_CONDVAR(Station, always_accepted, SLE_UINT64, SaveLoadVersion::ExtendCargotypes, SaveLoadVersion::MaxVersion),
|
||||
SLEG_CONDSTRUCTLIST("speclist", SlRoadStopTileData, SaveLoadVersion::NewGRFRoadStops, SaveLoadVersion::RoadStopTileData),
|
||||
|
||||
@@ -360,7 +360,7 @@ static const SaveLoad _town_desc[] = {
|
||||
SLE_CONDVAR(Town, layout, SLE_UINT8, SaveLoadVersion::RoadLayoutPerTown, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Town, valid_history, SLE_UINT64, SaveLoadVersion::TownSupplyHistory, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_CONDREFVECTOR(Town, psa_list, REF_STORAGE, SaveLoadVersion::PersistentStoragePool, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREFVECTOR(Town, psa_list, SLRefType::Storage, SaveLoadVersion::PersistentStoragePool, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLEG_CONDSTRUCTLIST("supplied", SlTownOldSupplied, SaveLoadVersion::ScriptTownGrowth, SaveLoadVersion::TownSupplyHistory),
|
||||
SLEG_CONDSTRUCTLIST("supplied", SlTownSupplied, SaveLoadVersion::TownSupplyHistory, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -656,7 +656,7 @@ public:
|
||||
static inline const SaveLoad description[] = {
|
||||
SLE_VAR(Vehicle, subtype, SLE_UINT8),
|
||||
|
||||
SLE_REF(Vehicle, next, REF_VEHICLE_OLD),
|
||||
SLE_REF(Vehicle, next, SLRefType::OldVehicle),
|
||||
SLE_CONDVAR(Vehicle, name, SLE_NAME, SaveLoadVersion::MinVersion, SaveLoadVersion::ReplaceCustomNameArray),
|
||||
SLE_CONDSSTR(Vehicle, name, SLE_STR | StringValidationSetting::AllowControlCode, SaveLoadVersion::ReplaceCustomNameArray, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Vehicle, unitnumber, SLE_FILE_U8 | SLE_VAR_U16, SaveLoadVersion::MinVersion, SaveLoadVersion::LargerUnitNumber),
|
||||
@@ -697,7 +697,7 @@ public:
|
||||
SLE_VAR(Vehicle, cargo_cap, SLE_UINT16),
|
||||
SLE_CONDVAR(Vehicle, refit_cap, SLE_UINT16, SaveLoadVersion::GoalProgressPlaneAcceleration, SaveLoadVersion::MaxVersion),
|
||||
SLEG_CONDVAR("cargo_count", _cargo_count, SLE_UINT16, SaveLoadVersion::MinVersion, SaveLoadVersion::CargoPackets),
|
||||
SLE_CONDREFLIST(Vehicle, cargo.packets, REF_CARGO_PACKET, SaveLoadVersion::CargoPackets, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREFLIST(Vehicle, cargo.packets, SLRefType::CargoPacket, SaveLoadVersion::CargoPackets, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDARR(Vehicle, cargo.action_counts, SLE_UINT32, to_underlying(VehicleCargoList::MoveToAction::End), SaveLoadVersion::CargoReservation, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Vehicle, cargo_age_counter, SLE_UINT16, SaveLoadVersion::NewGRFCustomCargoAging, SaveLoadVersion::MaxVersion),
|
||||
|
||||
@@ -731,7 +731,7 @@ public:
|
||||
|
||||
SLE_CONDVARNAME(Vehicle, old_orders, "orders", SLE_FILE_U16 | SLE_VAR_U32, SaveLoadVersion::MinVersion, SaveLoadVersion::MoreCargoPackets),
|
||||
SLE_CONDVARNAME(Vehicle, old_orders, "orders", SLE_UINT32, SaveLoadVersion::MoreCargoPackets, SaveLoadVersion::OrderList),
|
||||
SLE_CONDREF(Vehicle, orders, REF_ORDERLIST, SaveLoadVersion::OrderList, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Vehicle, orders, SLRefType::OrderList, SaveLoadVersion::OrderList, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_CONDVAR(Vehicle, age, SLE_FILE_U16 | SLE_VAR_I32, SaveLoadVersion::MinVersion, SaveLoadVersion::BigDates),
|
||||
SLE_CONDVAR(Vehicle, age, SLE_INT32, SaveLoadVersion::BigDates, SaveLoadVersion::MaxVersion),
|
||||
@@ -771,7 +771,7 @@ public:
|
||||
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT16, SaveLoadVersion::ExtendVehicleRandom, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVARNAME(Vehicle, waiting_random_triggers, "waiting_triggers", SLE_UINT8, SaveLoadVersion::VehicleCurrencyStationChanges, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_CONDREF(Vehicle, next_shared, REF_VEHICLE, SaveLoadVersion::VehicleCurrencyStationChanges, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(Vehicle, next_shared, SLRefType::Vehicle, SaveLoadVersion::VehicleCurrencyStationChanges, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(Vehicle, group_id, SLE_UINT16, SaveLoadVersion::VehicleGroups, SaveLoadVersion::MaxVersion),
|
||||
|
||||
SLE_CONDVAR(Vehicle, current_order_time, SLE_FILE_U32 | SLE_VAR_I32, SaveLoadVersion::Timetables, SaveLoadVersion::TimetableTicksType),
|
||||
@@ -1048,7 +1048,7 @@ public:
|
||||
class SlVehicleDisaster : public DefaultSaveLoadHandler<SlVehicleDisaster, Vehicle> {
|
||||
public:
|
||||
static inline const SaveLoad description[] = {
|
||||
SLE_REF(Vehicle, next, REF_VEHICLE_OLD),
|
||||
SLE_REF(Vehicle, next, SLRefType::OldVehicle),
|
||||
|
||||
SLE_VAR(Vehicle, subtype, SLE_UINT8),
|
||||
SLE_CONDVAR(Vehicle, tile, SLE_FILE_U16 | SLE_VAR_U32, SaveLoadVersion::MinVersion, SaveLoadVersion::MultipleRoadStops),
|
||||
|
||||
@@ -171,7 +171,7 @@ static const SaveLoad _old_waypoint_desc[] = {
|
||||
SLE_CONDVAR(OldWaypoint, xy, SLE_FILE_U16 | SLE_VAR_U32, SaveLoadVersion::MinVersion, SaveLoadVersion::MultipleRoadStops),
|
||||
SLE_CONDVAR(OldWaypoint, xy, SLE_UINT32, SaveLoadVersion::MultipleRoadStops, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(OldWaypoint, town_index, SLE_UINT16, SaveLoadVersion::LinkWaypointToTown, SaveLoadVersion::WaypointMoreLikeStation),
|
||||
SLE_CONDREF(OldWaypoint, town, REF_TOWN, SaveLoadVersion::WaypointMoreLikeStation, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDREF(OldWaypoint, town, SLRefType::Town, SaveLoadVersion::WaypointMoreLikeStation, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(OldWaypoint, town_cn, SLE_FILE_U8 | SLE_VAR_U16, SaveLoadVersion::LinkWaypointToTown, SaveLoadVersion::MoreWaypointsPerTown),
|
||||
SLE_CONDVAR(OldWaypoint, town_cn, SLE_UINT16, SaveLoadVersion::MoreWaypointsPerTown, SaveLoadVersion::MaxVersion),
|
||||
SLE_CONDVAR(OldWaypoint, string_id, SLE_STRINGID, SaveLoadVersion::MinVersion, SaveLoadVersion::ReplaceCustomNameArray),
|
||||
|
||||
Reference in New Issue
Block a user