summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp29
-rw-r--r--src/newgrf.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index b20b297a0..a63696ba1 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -46,6 +46,7 @@
#include "smallmap_gui.h"
#include "genworld.h"
#include "gui.h"
+#include "vehicle_func.h"
#include "table/strings.h"
#include "table/build_industry.h"
@@ -7062,6 +7063,7 @@ void ResetNewGRFData()
_misc_grf_features = 0;
_loaded_newgrf_features.has_2CC = false;
+ _loaded_newgrf_features.used_liveries = 1 << LS_DEFAULT;
_loaded_newgrf_features.has_newhouses = false;
_loaded_newgrf_features.has_newindustries = false;
_loaded_newgrf_features.shore = SHORE_REPLACE_NONE;
@@ -7261,6 +7263,33 @@ static void FinaliseEngineArray()
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();
+ }
+ }
+ }
}
}
diff --git a/src/newgrf.h b/src/newgrf.h
index eb4e8b298..5be03b8c4 100644
--- a/src/newgrf.h
+++ b/src/newgrf.h
@@ -148,6 +148,7 @@ enum ShoreReplacement {
struct GRFLoadedFeatures {
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_newindustries; ///< Set if there are any newindustries loaded.
ShoreReplacement shore; ///< It which way shore sprites were replaced.