Fix #14356, ff7eb996e6: Incorrect sprite group chosen for stations and road stops. (#14359)

This commit is contained in:
Peter Nelson 2025-06-14 13:38:45 +01:00 committed by GitHub
parent 8e3acbfa84
commit 1cd0391926
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 16 deletions

View File

@ -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 */

View File

@ -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 */