Mercurial > hg > openttd
changeset 8309:132c40a27dfb draft
(svn r11874) -Fix [FS#1655]: all wagons of maglev/monorail trains would get the livery colour of the engine instead of their wagon type.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 16 Jan 2008 11:25:15 +0000 |
parents | e9042729a5c5 |
children | a6c312c0f33b |
files | src/lang/english.txt src/livery.h src/player_gui.cpp src/players.cpp src/saveload.cpp src/vehicle.cpp |
diffstat | 6 files changed, 42 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1611,7 +1611,7 @@ STR_100A_RAILROAD_CONSTRUCTION :{WHITE}Railway Construction STR_TITLE_ELRAIL_CONSTRUCTION :{WHITE}Electrified Railway Construction STR_100B_MONORAIL_CONSTRUCTION :{WHITE}Monorail Construction -STR_100C_MAGLEV_CONSTRUCTION :{WHITE}MagLev Construction +STR_100C_MAGLEV_CONSTRUCTION :{WHITE}Maglev Construction STR_100D_SELECT_RAIL_BRIDGE :{WHITE}Select Rail Bridge STR_100E_CAN_T_BUILD_TRAIN_DEPOT :{WHITE}Can't build train depot here... STR_100F_CAN_T_BUILD_RAILROAD_STATION :{WHITE}Can't build railway station here... @@ -1623,7 +1623,7 @@ STR_1015_RAILROAD_CONSTRUCTION :Railway construction STR_TOOLB_ELRAIL_CONSTRUCTION :Electrified Railway construction STR_1016_MONORAIL_CONSTRUCTION :Monorail construction -STR_1017_MAGLEV_CONSTRUCTION :MagLev construction +STR_1017_MAGLEV_CONSTRUCTION :Maglev construction STR_1018_BUILD_RAILROAD_TRACK :{BLACK}Build railway track STR_1019_BUILD_TRAIN_DEPOT_FOR_BUILDING :{BLACK}Build train depot (for building and servicing trains) STR_101A_BUILD_RAILROAD_STATION :{BLACK}Build railway station @@ -2342,6 +2342,8 @@ STR_LIVERY_PASSENGER_WAGON_STEAM :Passenger Coach (Steam) STR_LIVERY_PASSENGER_WAGON_DIESEL :Passenger Coach (Diesel) STR_LIVERY_PASSENGER_WAGON_ELECTRIC :Passenger Coach (Electric) +STR_LIVERY_PASSENGER_WAGON_MONORAIL :Passenger Coach (Monorail) +STR_LIVERY_PASSENGER_WAGON_MAGLEV :Passenger Coach (Maglev) STR_LIVERY_FREIGHT_WAGON :Freight Wagon STR_LIVERY_BUS :Bus STR_LIVERY_TRUCK :Lorry
--- a/src/livery.h +++ b/src/livery.h @@ -23,6 +23,8 @@ LS_PASSENGER_WAGON_STEAM, LS_PASSENGER_WAGON_DIESEL, LS_PASSENGER_WAGON_ELECTRIC, + LS_PASSENGER_WAGON_MONORAIL, + LS_PASSENGER_WAGON_MAGLEV, LS_FREIGHT_WAGON, /* Road vehicles */
--- a/src/player_gui.cpp +++ b/src/player_gui.cpp @@ -256,7 +256,7 @@ /* Association of liveries to livery classes */ static const LiveryClass livery_class[LS_END] = { LC_OTHER, - LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, + LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_RAIL, LC_ROAD, LC_ROAD, LC_SHIP, LC_SHIP, LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT, @@ -266,7 +266,7 @@ /* Number of liveries in each class, used to determine the height of the livery window */ static const byte livery_height[] = { 1, - 11, + 13, 4, 2, 3,
--- a/src/players.cpp +++ b/src/players.cpp @@ -1201,12 +1201,19 @@ } /* Write each livery entry. */ - int num_liveries = CheckSavegameVersion(63) ? LS_END - 2 : LS_END; + int num_liveries = CheckSavegameVersion(63) ? LS_END - 4 : (CheckSavegameVersion(85) ? LS_END - 2: LS_END); for (i = 0; i < num_liveries; i++) { SlObject(&p->livery[i], _player_livery_desc); } - if (num_liveries == LS_END - 2) { + if (num_liveries < LS_END) { + /* We want to insert some liveries somewhere in between. This means some have to be moved. */ + memmove(&p->livery[LS_FREIGHT_WAGON], &p->livery[LS_PASSENGER_WAGON_MONORAIL], (LS_END - LS_FREIGHT_WAGON) * sizeof(p->livery[0])); + p->livery[LS_PASSENGER_WAGON_MONORAIL] = p->livery[LS_MONORAIL]; + p->livery[LS_PASSENGER_WAGON_MAGLEV] = p->livery[LS_MAGLEV]; + } + + if (num_liveries == LS_END - 4) { /* Copy bus/truck liveries over to trams */ p->livery[LS_PASSENGER_TRAM] = p->livery[LS_BUS]; p->livery[LS_FREIGHT_TRAM] = p->livery[LS_TRUCK];
--- a/src/saveload.cpp +++ b/src/saveload.cpp @@ -34,7 +34,7 @@ #include "table/strings.h" -extern const uint16 SAVEGAME_VERSION = 84; +extern const uint16 SAVEGAME_VERSION = 85; uint16 _sl_version; ///< the major savegame version identifier byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2581,42 +2581,35 @@ case VEH_TRAIN: { const RailVehicleInfo *rvi = RailVehInfo(engine_type); - switch (rvi->railtype) { - default: NOT_REACHED(); - case RAILTYPE_RAIL: - case RAILTYPE_ELECTRIC: - { - if (cargo_type == CT_INVALID) cargo_type = rvi->cargo_type; - if (rvi->railveh_type == RAILVEH_WAGON) { - if (!GetCargo(cargo_type)->is_freight) { - if (parent_engine_type == INVALID_ENGINE) { - scheme = LS_PASSENGER_WAGON_STEAM; - } else { - switch (RailVehInfo(parent_engine_type)->engclass) { - default: NOT_REACHED(); - case EC_STEAM: scheme = LS_PASSENGER_WAGON_STEAM; break; - case EC_DIESEL: scheme = LS_PASSENGER_WAGON_DIESEL; break; - case EC_ELECTRIC: scheme = LS_PASSENGER_WAGON_ELECTRIC; break; - } - } - } else { - scheme = LS_FREIGHT_WAGON; - } + if (cargo_type == CT_INVALID) cargo_type = rvi->cargo_type; + if (rvi->railveh_type == RAILVEH_WAGON) { + if (!GetCargo(cargo_type)->is_freight) { + if (parent_engine_type == INVALID_ENGINE) { + scheme = LS_PASSENGER_WAGON_STEAM; } else { - bool is_mu = HasBit(EngInfo(engine_type)->misc_flags, EF_RAIL_IS_MU); - - switch (rvi->engclass) { + switch (RailVehInfo(parent_engine_type)->engclass) { default: NOT_REACHED(); - case EC_STEAM: scheme = LS_STEAM; break; - case EC_DIESEL: scheme = is_mu ? LS_DMU : LS_DIESEL; break; - case EC_ELECTRIC: scheme = is_mu ? LS_EMU : LS_ELECTRIC; break; + case EC_STEAM: scheme = LS_PASSENGER_WAGON_STEAM; break; + case EC_DIESEL: scheme = LS_PASSENGER_WAGON_DIESEL; break; + case EC_ELECTRIC: scheme = LS_PASSENGER_WAGON_ELECTRIC; break; + case EC_MONORAIL: scheme = LS_PASSENGER_WAGON_MONORAIL; break; + case EC_MAGLEV: scheme = LS_PASSENGER_WAGON_MAGLEV; break; } } - break; + } else { + scheme = LS_FREIGHT_WAGON; } - - case RAILTYPE_MONO: scheme = LS_MONORAIL; break; - case RAILTYPE_MAGLEV: scheme = LS_MAGLEV; break; + } else { + bool is_mu = HasBit(EngInfo(engine_type)->misc_flags, EF_RAIL_IS_MU); + + switch (rvi->engclass) { + default: NOT_REACHED(); + case EC_STEAM: scheme = LS_STEAM; break; + case EC_DIESEL: scheme = is_mu ? LS_DMU : LS_DIESEL; break; + case EC_ELECTRIC: scheme = is_mu ? LS_EMU : LS_ELECTRIC; break; + case EC_MONORAIL: scheme = LS_MONORAIL; break; + case EC_MAGLEV: scheme = LS_MAGLEV; break; + } } break; }