mirror of https://github.com/OpenTTD/OpenTTD
(svn r20848) -Add: _loaded_newgrf_features.used_liveries to keep track which liveries are used by some vehicle resp. which are not used at all.
parent
611e986226
commit
a54b711dc1
|
@ -46,6 +46,7 @@
|
||||||
#include "smallmap_gui.h"
|
#include "smallmap_gui.h"
|
||||||
#include "genworld.h"
|
#include "genworld.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
#include "vehicle_func.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "table/build_industry.h"
|
#include "table/build_industry.h"
|
||||||
|
@ -7062,6 +7063,7 @@ void ResetNewGRFData()
|
||||||
_misc_grf_features = 0;
|
_misc_grf_features = 0;
|
||||||
|
|
||||||
_loaded_newgrf_features.has_2CC = false;
|
_loaded_newgrf_features.has_2CC = false;
|
||||||
|
_loaded_newgrf_features.used_liveries = 1 << LS_DEFAULT;
|
||||||
_loaded_newgrf_features.has_newhouses = false;
|
_loaded_newgrf_features.has_newhouses = false;
|
||||||
_loaded_newgrf_features.has_newindustries = false;
|
_loaded_newgrf_features.has_newindustries = false;
|
||||||
_loaded_newgrf_features.shore = SHORE_REPLACE_NONE;
|
_loaded_newgrf_features.shore = SHORE_REPLACE_NONE;
|
||||||
|
@ -7261,6 +7263,33 @@ static void FinaliseEngineArray()
|
||||||
e->info.string_id = STR_NEWGRF_INVALID_ENGINE;
|
e->info.string_id = STR_NEWGRF_INVALID_ENGINE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Skip wagons, there livery is defined via the engine */
|
||||||
|
if (e->type != VEH_TRAIN || e->u.rail.railveh_type != RAILVEH_WAGON) {
|
||||||
|
LiveryScheme ls = GetEngineLiveryScheme(e->index, INVALID_ENGINE, NULL);
|
||||||
|
SetBit(_loaded_newgrf_features.used_liveries, ls);
|
||||||
|
/* Note: For ships and roadvehicles we assume that they cannot be refitted between passenger and freight */
|
||||||
|
|
||||||
|
if (e->type == VEH_TRAIN) {
|
||||||
|
SetBit(_loaded_newgrf_features.used_liveries, LS_FREIGHT_WAGON);
|
||||||
|
switch (ls) {
|
||||||
|
case LS_STEAM:
|
||||||
|
case LS_DIESEL:
|
||||||
|
case LS_ELECTRIC:
|
||||||
|
case LS_MONORAIL:
|
||||||
|
case LS_MAGLEV:
|
||||||
|
SetBit(_loaded_newgrf_features.used_liveries, LS_PASSENGER_WAGON_STEAM + ls - LS_STEAM);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LS_DMU:
|
||||||
|
case LS_EMU:
|
||||||
|
SetBit(_loaded_newgrf_features.used_liveries, LS_PASSENGER_WAGON_DIESEL + ls - LS_DMU);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: NOT_REACHED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ enum ShoreReplacement {
|
||||||
|
|
||||||
struct GRFLoadedFeatures {
|
struct GRFLoadedFeatures {
|
||||||
bool has_2CC; ///< Set if any vehicle is loaded which uses 2cc (two company colours).
|
bool has_2CC; ///< Set if any vehicle is loaded which uses 2cc (two company colours).
|
||||||
|
uint64 used_liveries; ///< Bitmask of #LiveryScheme used by the defined engines.
|
||||||
bool has_newhouses; ///< Set if there are any newhouses loaded.
|
bool has_newhouses; ///< Set if there are any newhouses loaded.
|
||||||
bool has_newindustries; ///< Set if there are any newindustries loaded.
|
bool has_newindustries; ///< Set if there are any newindustries loaded.
|
||||||
ShoreReplacement shore; ///< It which way shore sprites were replaced.
|
ShoreReplacement shore; ///< It which way shore sprites were replaced.
|
||||||
|
|
Loading…
Reference in New Issue