Codechange: cleanup CargoPacket in terms of variable/function names (#11278)

Over the years, things got reused and changed, making the current
names somewhat unclear in what they actually mean and do.

(cherry picked from commit 30172fc037)
This commit is contained in:
Patric Stout
2023-09-09 23:21:21 +02:00
committed by Jonathan G Rennison
parent 2890127675
commit e5673a1756
27 changed files with 213 additions and 200 deletions

View File

@@ -71,7 +71,7 @@ template<bool Tfrom, bool Tvia>
StationCargoList::ConstIterator(cargo_list.Packets()->end()));
for (StationCargoList::ConstIterator it = range.first; it != range.second; it++) {
const CargoPacket *cp = *it;
if (!Tfrom || cp->SourceStation() == from_station_id) cargo_count += cp->Count();
if (!Tfrom || cp->GetFirstStation() == from_station_id) cargo_count += cp->Count();
}
return cargo_count;

View File

@@ -177,7 +177,7 @@ void ScriptStationList_CargoWaiting::Add(StationID station_id, CargoID cargo, St
StationCargoList::ConstIterator iter = ge->data->cargo.Packets()->begin();
StationCargoList::ConstIterator end = ge->data->cargo.Packets()->end();
for (; iter != end; ++iter) {
collector.Update<Tselector>((*iter)->SourceStation(), iter.GetKey(), (*iter)->Count());
collector.Update<Tselector>((*iter)->GetFirstStation(), iter.GetKey(), (*iter)->Count());
}
}
@@ -221,7 +221,7 @@ ScriptStationList_CargoWaitingViaByFrom::ScriptStationList_CargoWaitingViaByFrom
std::pair<StationCargoList::ConstIterator, StationCargoList::ConstIterator> range =
ge->data->cargo.Packets()->equal_range(via);
for (StationCargoList::ConstIterator iter = range.first; iter != range.second; ++iter) {
collector.Update<CS_VIA_BY_FROM>((*iter)->SourceStation(), iter.GetKey(), (*iter)->Count());
collector.Update<CS_VIA_BY_FROM>((*iter)->GetFirstStation(), iter.GetKey(), (*iter)->Count());
}
}