mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r9956) -Codechange: Add tram livery schemes
This commit is contained in:
parent
21454957b5
commit
974aebcce5
@ -2271,6 +2271,8 @@ STR_LIVERY_FREIGHT_SHIP :Freight Ship
|
|||||||
STR_LIVERY_HELICOPTER :Helicopter
|
STR_LIVERY_HELICOPTER :Helicopter
|
||||||
STR_LIVERY_SMALL_PLANE :Small Aeroplane
|
STR_LIVERY_SMALL_PLANE :Small Aeroplane
|
||||||
STR_LIVERY_LARGE_PLANE :Large 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_GENERAL_TIP :{BLACK}Show general colour schemes
|
||||||
STR_LIVERY_TRAIN_TIP :{BLACK}Show train colour schemes
|
STR_LIVERY_TRAIN_TIP :{BLACK}Show train colour schemes
|
||||||
|
@ -38,6 +38,10 @@ enum LiveryScheme {
|
|||||||
LS_SMALL_PLANE,
|
LS_SMALL_PLANE,
|
||||||
LS_LARGE_PLANE,
|
LS_LARGE_PLANE,
|
||||||
|
|
||||||
|
/* Trams (appear on Road Vehicles tab) */
|
||||||
|
LS_PASSENGER_TRAM,
|
||||||
|
LS_FREIGHT_TRAM,
|
||||||
|
|
||||||
LS_END
|
LS_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -277,13 +277,14 @@ static const LiveryClass livery_class[LS_END] = {
|
|||||||
LC_ROAD, LC_ROAD,
|
LC_ROAD, LC_ROAD,
|
||||||
LC_SHIP, LC_SHIP,
|
LC_SHIP, LC_SHIP,
|
||||||
LC_AIRCRAFT, LC_AIRCRAFT, LC_AIRCRAFT,
|
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 */
|
/* Number of liveries in each class, used to determine the height of the livery window */
|
||||||
static const byte livery_height[] = {
|
static const byte livery_height[] = {
|
||||||
1,
|
1,
|
||||||
11,
|
11,
|
||||||
2,
|
4,
|
||||||
2,
|
2,
|
||||||
3,
|
3,
|
||||||
};
|
};
|
||||||
|
@ -1279,9 +1279,16 @@ static void SaveLoad_PLYR(Player* p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write each livery entry. */
|
/* 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);
|
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()
|
static void Save_PLYR()
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
extern const uint16 SAVEGAME_VERSION = 62;
|
extern const uint16 SAVEGAME_VERSION = 63;
|
||||||
uint16 _sl_version; ///< the major savegame version identifier
|
uint16 _sl_version; ///< the major savegame version identifier
|
||||||
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
|
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: {
|
case VEH_ROAD: {
|
||||||
const RoadVehicleInfo *rvi = RoadVehInfo(engine_type);
|
const RoadVehicleInfo *rvi = RoadVehInfo(engine_type);
|
||||||
if (cargo_type == CT_INVALID) cargo_type = rvi->cargo_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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user