Fix #11437: Flipped shorter rail vehicles disappear in windows. (#11446)

Mixed signed/unsigned strikes again, causing an incorrect sprite offset for shortened vehicles.

(cherry picked from commit 43aa91a7f5)
This commit is contained in:
Peter Nelson 2023-11-05 20:09:11 +00:00 committed by Jonathan G Rennison
parent 480e03360b
commit 96d4538055

View File

@ -1294,7 +1294,7 @@ int Train::GetDisplayImageWidth(Point *offset) const
if (offset != nullptr) {
if (HasBit(this->flags, VRF_REVERSE_DIRECTION) && !HasBit(EngInfo(this->engine_type)->misc_flags, EF_RAIL_FLIPS)) {
offset->x = ScaleSpriteTrad((this->gcache.cached_veh_length - VEHICLE_LENGTH / 2) * reference_width / VEHICLE_LENGTH);
offset->x = ScaleSpriteTrad(((int)this->gcache.cached_veh_length - (int)VEHICLE_LENGTH / 2) * reference_width / (int)VEHICLE_LENGTH);
} else {
offset->x = ScaleSpriteTrad(reference_width) / 2;
}