| 438 | } |
| 439 | |
| 440 | int Train::GetCursorImageOffset() const |
| 441 | { |
| 442 | if (this->gcache.cached_veh_length != 8 && this->flags.Test(VehicleRailFlag::Flipped) && !EngInfo(this->engine_type)->misc_flags.Test(EngineMiscFlag::RailFlips)) { |
| 443 | int reference_width = TRAININFO_DEFAULT_VEHICLE_WIDTH; |
| 444 | |
| 445 | const Engine *e = this->GetEngine(); |
| 446 | if (e->GetGRF() != nullptr && IsCustomVehicleSpriteNum(e->VehInfo<RailVehicleInfo>().image_index)) { |
| 447 | reference_width = e->GetGRF()->traininfo_vehicle_width; |
| 448 | } |
| 449 | |
| 450 | return ScaleSpriteTrad((this->gcache.cached_veh_length - (int)VEHICLE_LENGTH) * reference_width / (int)VEHICLE_LENGTH); |
| 451 | } |
| 452 | return 0; |
| 453 | } |
| 454 | |
| 455 | /** |
| 456 | * Get the width of a train vehicle image in the GUI. |
no test coverage detected