mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-06-19 03:29:26 +01:00
Fix #14356, ff7eb996e6
: Incorrect sprite group chosen for stations and road stops. (#14359)
This commit is contained in:
parent
8e3acbfa84
commit
1cd0391926
@ -227,7 +227,6 @@ RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec,
|
|||||||
if (st == nullptr) {
|
if (st == nullptr) {
|
||||||
/* No station, so we are in a purchase list */
|
/* No station, so we are in a purchase list */
|
||||||
ctype = CargoGRFFileProps::SG_PURCHASE;
|
ctype = CargoGRFFileProps::SG_PURCHASE;
|
||||||
this->root_spritegroup = roadstopspec->grf_prop.GetSpriteGroup(ctype);
|
|
||||||
} else if (Station::IsExpected(st)) {
|
} else if (Station::IsExpected(st)) {
|
||||||
const Station *station = Station::From(st);
|
const Station *station = Station::From(st);
|
||||||
/* Pick the first cargo that we have waiting */
|
/* Pick the first cargo that we have waiting */
|
||||||
@ -238,16 +237,12 @@ RoadStopResolverObject::RoadStopResolverObject(const RoadStopSpec *roadstopspec,
|
|||||||
break;
|
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) {
|
if (this->root_spritegroup == nullptr) {
|
||||||
ctype = CargoGRFFileProps::SG_DEFAULT;
|
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 */
|
/* Remember the cargo type we've picked */
|
||||||
|
@ -583,28 +583,21 @@ StationResolverObject::StationResolverObject(const StationSpec *statspec, BaseSt
|
|||||||
if (this->station_scope.st == nullptr) {
|
if (this->station_scope.st == nullptr) {
|
||||||
/* No station, so we are in a purchase list */
|
/* No station, so we are in a purchase list */
|
||||||
ctype = CargoGRFFileProps::SG_PURCHASE;
|
ctype = CargoGRFFileProps::SG_PURCHASE;
|
||||||
this->root_spritegroup = statspec->grf_prop.GetSpriteGroup(ctype);
|
|
||||||
} else if (Station::IsExpected(this->station_scope.st)) {
|
} else if (Station::IsExpected(this->station_scope.st)) {
|
||||||
const Station *st = Station::From(this->station_scope.st);
|
const Station *st = Station::From(this->station_scope.st);
|
||||||
/* Pick the first cargo that we have waiting */
|
/* Pick the first cargo that we have waiting */
|
||||||
for (const auto &[cargo, spritegroup] : statspec->grf_prop.spritegroups) {
|
for (const auto &[cargo, spritegroup] : statspec->grf_prop.spritegroups) {
|
||||||
if (cargo < NUM_CARGO && st->goods[cargo].HasData() && st->goods[cargo].GetData().cargo.TotalCount() > 0) {
|
if (cargo < NUM_CARGO && st->goods[cargo].HasData() && st->goods[cargo].GetData().cargo.TotalCount() > 0) {
|
||||||
ctype = cargo;
|
ctype = cargo;
|
||||||
this->root_spritegroup = spritegroup;
|
|
||||||
break;
|
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) {
|
if (this->root_spritegroup == nullptr) {
|
||||||
ctype = CargoGRFFileProps::SG_DEFAULT;
|
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 */
|
/* Remember the cargo type we've picked */
|
||||||
|
Loading…
Reference in New Issue
Block a user