mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-25 08:22:17 +00:00
Add convenience helpers to correctly retrieve goods entry cargo available/totals. Avoids having to check if cargo data is available before accessing it, which was missing for autorefit.
This commit is contained in:
@@ -231,7 +231,7 @@ RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec,
|
||||
const Station *station = Station::From(st);
|
||||
/* Pick the first cargo that we have waiting */
|
||||
for (const auto &[cargo, spritegroup] : roadstopspec->grf_prop.spritegroups) {
|
||||
if (cargo < NUM_CARGO && station->goods[cargo].HasData() && station->goods[cargo].GetData().cargo.TotalCount() > 0) {
|
||||
if (cargo < NUM_CARGO && station->goods[cargo].TotalCount() > 0) {
|
||||
ctype = cargo;
|
||||
this->root_spritegroup = spritegroup;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user