Changeset - r16142:e91bfb8299b5
[Not reviewed]
master
0 2 0
frosch - 14 years ago 2010-09-25 21:59:22
frosch@openttd.org
(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.
2 files changed with 30 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -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();
 
				}
 
			}
 
		}
 
	}
 
}
 

	
src/newgrf.h
Show inline comments
 
@@ -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.
0 comments (0 inline, 0 general)