| 135 | } |
| 136 | |
| 137 | void 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 | |
| 149 | template <ScriptStationList_Cargo::CargoSelector Tselector> |
| 150 | void CargoCollector::Update(StationID from, StationID via, uint amount) |