diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index 6f0d9add2b..02db3fa33d 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -227,7 +227,6 @@ RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec, if (st == nullptr) { /* No station, so we are in a purchase list */ ctype = CargoGRFFileProps::SG_PURCHASE; - this->root_spritegroup = roadstopspec->grf_prop.GetSpriteGroup(ctype); } else if (Station::IsExpected(st)) { const Station *station = Station::From(st); /* Pick the first cargo that we have waiting */ @@ -238,16 +237,12 @@ RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec, break; } } - - if (this->root_spritegroup == nullptr) { - ctype = CargoGRFFileProps::SG_DEFAULT_NA; - this->root_spritegroup = roadstopspec->grf_prop.GetSpriteGroup(ctype); - } } + this->root_spritegroup = this->roadstop_scope.roadstopspec->grf_prop.GetSpriteGroup(ctype); if (this->root_spritegroup == nullptr) { ctype = CargoGRFFileProps::SG_DEFAULT; - this->root_spritegroup = roadstopspec->grf_prop.GetSpriteGroup(ctype); + this->root_spritegroup = this->roadstop_scope.roadstopspec->grf_prop.GetSpriteGroup(ctype); } /* Remember the cargo type we've picked */ diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 1505220baf..4c16bb7155 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -583,28 +583,21 @@ StationResolverObject::StationResolverObject(const StationSpec *statspec, BaseSt if (this->station_scope.st == nullptr) { /* No station, so we are in a purchase list */ ctype = CargoGRFFileProps::SG_PURCHASE; - this->root_spritegroup = statspec->grf_prop.GetSpriteGroup(ctype); } else if (Station::IsExpected(this->station_scope.st)) { const Station *st = Station::From(this->station_scope.st); /* Pick the first cargo that we have waiting */ for (const auto &[cargo, spritegroup] : statspec->grf_prop.spritegroups) { if (cargo < NUM_CARGO && st->goods[cargo].HasData() && st->goods[cargo].GetData().cargo.TotalCount() > 0) { ctype = cargo; - this->root_spritegroup = spritegroup; break; } } - - if (this->root_spritegroup == nullptr) { - ctype = CargoGRFFileProps::SG_DEFAULT_NA; - this->root_spritegroup = statspec->grf_prop.GetSpriteGroup(ctype); - } } - + this->root_spritegroup = this->station_scope.statspec->grf_prop.GetSpriteGroup(ctype); if (this->root_spritegroup == nullptr) { ctype = CargoGRFFileProps::SG_DEFAULT; - this->root_spritegroup = statspec->grf_prop.GetSpriteGroup(ctype); + this->root_spritegroup = this->station_scope.statspec->grf_prop.GetSpriteGroup(ctype); } /* Remember the cargo type we've picked */