MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SetValue

Method SetValue

src/script/api/script_stationlist.cpp:137–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void CargoCollector::SetValue()
138{
139 if (this->amount > 0) {
140 if (this->list->HasItem(this->last_key.base())) {
141 this->list->SetValue(this->last_key.base(),
142 this->list->GetValue(this->last_key.base()) + this->amount);
143 } else {
144 this->list->AddItem(this->last_key.base(), this->amount);
145 }
146 }
147}
148
149template <ScriptStationList_Cargo::CargoSelector Tselector>
150void CargoCollector::Update(StationID from, StationID via, uint amount)

Callers 2

~CargoCollectorMethod · 0.95
UpdateMethod · 0.95

Calls 4

HasItemMethod · 0.80
AddItemMethod · 0.80
baseMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected