Fix: Don't assume engclass 2 should be elrail. (#10315)
When disabling/enabling elrail, there is an assumption that `engclass` of 2 means the engine will run on elrail. While this holds for default engines, NewGRFs can do other things. To resolve this we store the intended railtype so that toggling elrail will restore to the correct type.
This commit is contained in:
@@ -43,7 +43,8 @@ struct RailVehicleInfo {
|
||||
byte image_index;
|
||||
RailVehicleTypes railveh_type;
|
||||
byte cost_factor; ///< Purchase cost factor; For multiheaded engines the sum of both engine prices.
|
||||
RailType railtype;
|
||||
RailType railtype; ///< Railtype, mangled if elrail is disabled.
|
||||
RailType intended_railtype; ///< Intended railtype, regardless of elrail being enabled or disabled.
|
||||
uint16 max_speed; ///< Maximum speed (1 unit = 1/1.6 mph = 1 km-ish/h)
|
||||
uint16 power; ///< Power of engine (hp); For multiheaded engines the sum of both engine powers.
|
||||
uint16 weight; ///< Weight of vehicle (tons); For multiheaded engines the weight of each single engine.
|
||||
|
Reference in New Issue
Block a user