Changeset - r9073:d7dbfc1998b4
[Not reviewed]
master
0 3 0
peter1138 - 16 years ago 2008-04-30 17:42:08
peter1138@openttd.org
(svn r12932) -Fix [FS#1970]: Articulated engines ignored GRF engine overrides.
3 files changed with 24 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/articulated_vehicles.cpp
Show inline comments
 
@@ -11,20 +11,6 @@
 
#include "newgrf_engine.h"
 
#include "vehicle_func.h"
 

	
 
static EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id)
 
{
 
	const Engine *e = NULL;
 
	FOR_ALL_ENGINES(e) {
 
		if (e->grffile != file) continue;
 
		if (e->type != type) continue;
 
		if (e->internal_id != internal_id) continue;
 

	
 
		return e->index;
 
	}
 

	
 
	return INVALID_ENGINE;
 
}
 

	
 
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
 
{
 
	if (!HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return 0;
src/newgrf.cpp
Show inline comments
 
@@ -359,6 +359,28 @@ static Engine *GetNewEngine(const GRFFil
 
	return e;
 
}
 

	
 
EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id)
 
{
 
	extern uint32 GetNewGRFOverride(uint32 grfid);
 

	
 
	const GRFFile *grf_match = NULL;
 
	if (_patches.dynamic_engines) {
 
		uint32 override = _grf_id_overrides[file->grfid];
 
		if (override != 0) grf_match = GetFileByGRFID(override);
 
	}
 

	
 
	const Engine *e = NULL;
 
	FOR_ALL_ENGINES(e) {
 
		if (_patches.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
 
		if (e->type != type) continue;
 
		if (e->internal_id != internal_id) continue;
 

	
 
		return e->index;
 
	}
 

	
 
	return INVALID_ENGINE;
 
}
 

	
 
/** Map the colour modifiers of TTDPatch to those that Open is using.
 
 * @param grf_sprite pointer to the structure been modified
 
 */
src/newgrf_engine.h
Show inline comments
 
@@ -59,4 +59,6 @@ uint ListPositionOfEngine(EngineID engin
 
void AlterRailVehListOrder(EngineID engine, EngineID target);
 
void CommitRailVehListOrderChanges();
 

	
 
EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id);
 

	
 
#endif /* NEWGRF_ENGINE_H */
0 comments (0 inline, 0 general)