Codechange: strongly type StationID

This commit is contained in:
Rubidium
2025-02-16 15:17:59 +01:00
committed by rubidium42
parent 155aaa5967
commit 59df0ff496
23 changed files with 51 additions and 50 deletions

View File

@@ -35,7 +35,7 @@ ScriptStationList_Vehicle::ScriptStationList_Vehicle(VehicleID vehicle_id)
const Vehicle *v = ::Vehicle::Get(vehicle_id);
for (Order *o = v->GetFirstOrder(); o != nullptr; o = o->next) {
if (o->IsType(OT_GOTO_STATION)) this->AddItem(o->GetDestination().ToStationID());
if (o->IsType(OT_GOTO_STATION)) this->AddItem(o->GetDestination().ToStationID().base());
}
}
@@ -137,11 +137,11 @@ CargoCollector::~CargoCollector()
void CargoCollector::SetValue()
{
if (this->amount > 0) {
if (this->list->HasItem(this->last_key)) {
this->list->SetValue(this->last_key,
this->list->GetValue(this->last_key) + this->amount);
if (this->list->HasItem(this->last_key.base())) {
this->list->SetValue(this->last_key.base(),
this->list->GetValue(this->last_key.base()) + this->amount);
} else {
this->list->AddItem(this->last_key, this->amount);
this->list->AddItem(this->last_key.base(), this->amount);
}
}
}