From 049e615cfba1c34d118792d9b2ba4580ccbca477 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 16 Jan 2008 11:25:15 +0000 Subject: (svn r11874) -Fix [FS#1655]: all wagons of maglev/monorail trains would get the livery colour of the engine instead of their wagon type. --- src/players.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/players.cpp') 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]; -- cgit v1.2.3-54-g00ecf