(svn r9956) -Codechange: Add tram livery schemes

pull/155/head
peter1138 17 years ago
parent 4f6ffd4e12
commit 7273802f0c

@ -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

@ -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
};

@ -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,
};

@ -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()

@ -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!

@ -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;
}

Loading…
Cancel
Save