summaryrefslogtreecommitdiff
path: root/src/players.cpp
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
commit049e615cfba1c34d118792d9b2ba4580ccbca477 (patch)
tree59a67167b1fd8c3252ee17c6ab039069fb2f63c6 /src/players.cpp
parent88206b88080492c5ee8bb66351c546b254414b18 (diff)
downloadopenttd-049e615cfba1c34d118792d9b2ba4580ccbca477.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/players.cpp')
-rw-r--r--src/players.cpp11
1 files changed, 9 insertions, 2 deletions
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];