summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-01-16 11:25:15 +0000
committerrubidium <rubidium@openttd.org>2008-01-16 11:25:15 +0000
commit2817e5425bad8e0617b48024ca42037eaf5e5e32 (patch)
tree59a67167b1fd8c3252ee17c6ab039069fb2f63c6 /src
parent7a66d5e21da056c77e482ec7f3f779ba41ff7c53 (diff)
downloadopenttd-2817e5425bad8e0617b48024ca42037eaf5e5e32.tar.xz
(svn r11874) -Fix [FS#1655]: all wagons of maglev/monorail trains would get the livery colour of the engine instead of their wagon type.
Diffstat (limited to 'src')
-rw-r--r--src/lang/english.txt6
-rw-r--r--src/livery.h2
-rw-r--r--src/player_gui.cpp4
-rw-r--r--src/players.cpp11
-rw-r--r--src/saveload.cpp2
-rw-r--r--src/vehicle.cpp55
6 files changed, 42 insertions, 38 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 3d7397d0b..855fd646c 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1611,7 +1611,7 @@ STR_1008_MUST_REMOVE_RAILROAD_TRACK :{WHITE}Must rem
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_1014_TRAIN_DEPOT_ORIENTATION :{WHITE}Train De
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_EMU :EMU
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
diff --git a/src/livery.h b/src/livery.h
index 64d6deba5..8aa4f2e44 100644
--- a/src/livery.h
+++ b/src/livery.h
@@ -23,6 +23,8 @@ enum LiveryScheme {
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 */
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index df158a4f8..0b6189da5 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -256,7 +256,7 @@ static const StringID _colour_dropdown[] = {
/* 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 @@ static const LiveryClass livery_class[LS_END] = {
/* 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,
diff --git a/src/players.cpp b/src/players.cpp
index 1ddf70ffe..0e2bf5086 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -1201,12 +1201,19 @@ static void SaveLoad_PLYR(Player* p)
}
/* 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];
diff --git a/src/saveload.cpp b/src/saveload.cpp
index e16d7d09d..008821df6 100644
--- 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!
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 580953e93..0d514ec12 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2581,42 +2581,35 @@ const Livery *GetEngineLivery(EngineID engine_type, PlayerID player, EngineID pa
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;
+ }
+ } 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;
}
-
- case RAILTYPE_MONO: scheme = LS_MONORAIL; break;
- case RAILTYPE_MAGLEV: scheme = LS_MAGLEV; break;
}
break;
}