Codechange: strongly type StationID
This commit is contained in:
@@ -79,7 +79,7 @@ void MoveBuoysToWaypoints()
|
||||
/* Stations and waypoints are in the same pool, so if a station
|
||||
* is deleted there must be place for a Waypoint. */
|
||||
assert(Waypoint::CanAllocateItem());
|
||||
Waypoint *wp = new (index) Waypoint(xy);
|
||||
Waypoint *wp = new (index.base()) Waypoint(xy);
|
||||
wp->town = town;
|
||||
wp->string_id = train ? STR_SV_STNAME_WAYPOINT : STR_SV_STNAME_BUOY;
|
||||
wp->name = name;
|
||||
@@ -173,7 +173,6 @@ std::list<CargoPacket *> _packets;
|
||||
uint32_t _old_num_dests;
|
||||
|
||||
struct FlowSaveLoad {
|
||||
FlowSaveLoad() : source(0), via(0), share(0), restricted(false) {}
|
||||
StationID source;
|
||||
StationID via;
|
||||
uint32_t share;
|
||||
@@ -302,7 +301,7 @@ public:
|
||||
for (const auto &outer_it : ge->GetData().flows) {
|
||||
const FlowStat::SharesMap *shares = outer_it.second.GetShares();
|
||||
uint32_t sum_shares = 0;
|
||||
FlowSaveLoad flow;
|
||||
FlowSaveLoad flow{};
|
||||
flow.source = outer_it.first;
|
||||
for (auto &inner_it : *shares) {
|
||||
flow.via = inner_it.second;
|
||||
@@ -321,7 +320,7 @@ public:
|
||||
if (num_flows == 0) return;
|
||||
|
||||
GoodsEntry::GoodsEntryData &data = ge->GetOrCreateData();
|
||||
FlowSaveLoad flow;
|
||||
FlowSaveLoad flow{};
|
||||
FlowStat *fs = nullptr;
|
||||
StationID prev_source = INVALID_STATION;
|
||||
for (uint32_t j = 0; j < num_flows; ++j) {
|
||||
@@ -418,7 +417,7 @@ public:
|
||||
AssignBit(ge.status, GoodsEntry::GES_ACCEPTANCE, HasBit(_waiting_acceptance, 15));
|
||||
if (GB(_waiting_acceptance, 0, 12) != 0) {
|
||||
/* In old versions, enroute_from used 0xFF as INVALID_STATION */
|
||||
StationID source = (IsSavegameVersionBefore(SLV_7) && _cargo_source == 0xFF) ? INVALID_STATION : _cargo_source;
|
||||
StationID source = (IsSavegameVersionBefore(SLV_7) && _cargo_source == 0xFF) ? INVALID_STATION : static_cast<StationID>(_cargo_source);
|
||||
|
||||
/* Make sure we can allocate the CargoPacket. This is safe
|
||||
* as there can only be ~64k stations and 32 cargoes in these
|
||||
|
||||
Reference in New Issue
Block a user