summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-05-27 09:33:41 +0000
committerpeter1138 <peter1138@openttd.org>2007-05-27 09:33:41 +0000
commit7273802f0cfa18e9b4e60b714c1520b1df54e6c4 (patch)
tree03a243592bfcf5d9bd3ccc466a406d39d43af054 /src
parent4f6ffd4e12543cefda3c9708cc3a766bf5c45184 (diff)
downloadopenttd-7273802f0cfa18e9b4e60b714c1520b1df54e6c4.tar.xz
(svn r9956) -Codechange: Add tram livery schemes
Diffstat (limited to 'src')
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/livery.h4
-rw-r--r--src/player_gui.cpp3
-rw-r--r--src/players.cpp9
-rw-r--r--src/saveload.cpp2
-rw-r--r--src/vehicle.cpp8
6 files changed, 24 insertions, 4 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index f47c3328b..1ae830355 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2271,6 +2271,8 @@ STR_LIVERY_FREIGHT_SHIP :Freight Ship
STR_LIVERY_HELICOPTER :Helicopter
STR_LIVERY_SMALL_PLANE :Small Aeroplane
STR_LIVERY_LARGE_PLANE :Large Aeroplane
+STR_LIVERY_PASSENGER_TRAM :Passenger Tram
+STR_LIVERY_FREIGHT_TRAM :Freight Tram
STR_LIVERY_GENERAL_TIP :{BLACK}Show general colour schemes
STR_LIVERY_TRAIN_TIP :{BLACK}Show train colour schemes
diff --git a/src/livery.h b/src/livery.h
index f9f99fc9f..74797926b 100644
--- a/src/livery.h
+++ b/src/livery.h
@@ -38,6 +38,10 @@ enum LiveryScheme {
LS_SMALL_PLANE,
LS_LARGE_PLANE,
+ /* Trams (appear on Road Vehicles tab) */
+ LS_PASSENGER_TRAM,
+ LS_FREIGHT_TRAM,
+
LS_END
};
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index d2a839760..7112a68a1 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -277,13 +277,14 @@ static const LiveryClass livery_class[LS_END] = {
LC_ROAD, LC_ROAD,
LC_SHIP, LC_SHIP,
LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT,
+ LC_ROAD, LC_ROAD,
};
/* Number of liveries in each class, used to determine the height of the livery window */
static const byte livery_height[] = {
1,
11,
- 2,
+ 4,
2,
3,
};
diff --git a/src/players.cpp b/src/players.cpp
index 14a2ab117..f4cb38787 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -1279,9 +1279,16 @@ static void SaveLoad_PLYR(Player* p)
}
/* Write each livery entry. */
- for (i = 0; i < LS_END; i++) {
+ int num_liveries = CheckSavegameVersion(63) ? 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) {
+ /* 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];
+ }
}
static void Save_PLYR()
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 4ffc00a6a..9eb15a3f9 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -29,7 +29,7 @@
#include <setjmp.h>
#include <list>
-extern const uint16 SAVEGAME_VERSION = 62;
+extern const uint16 SAVEGAME_VERSION = 63;
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 a0de1e47c..a8b51ece0 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2520,7 +2520,13 @@ const Livery *GetEngineLivery(EngineID engine_type, PlayerID player, EngineID pa
case VEH_ROAD: {
const RoadVehicleInfo *rvi = RoadVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = rvi->cargo_type;
- scheme = IsCargoInClass(cargo_type, CC_PASSENGERS) ? LS_BUS : LS_TRUCK;
+ if (HASBIT(EngInfo(engine_type)->misc_flags, EF_ROAD_TRAM)) {
+ /* Tram */
+ scheme = IsCargoInClass(cargo_type, CC_PASSENGERS) ? LS_PASSENGER_TRAM : LS_FREIGHT_TRAM;
+ } else {
+ /* Bus or truck */
+ scheme = IsCargoInClass(cargo_type, CC_PASSENGERS) ? LS_BUS : LS_TRUCK;
+ }
break;
}