@@ -8,26 +8,12 @@
#include "train.h"
#include "roadveh.h"
#include "newgrf_callbacks.h"
#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;
Vehicle *v = NULL;;
if (!purchase_window) {
@@ -356,12 +356,34 @@ static Engine *GetNewEngine(const GRFFil
grfmsg(5, "Created new engine at index %d for GRFID %x, type %d, index %d", e->index, BSWAP32(file->grfid), type, internal_id);
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);
if (_patches.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
/** Map the colour modifiers of TTDPatch to those that Open is using.
* @param grf_sprite pointer to the structure been modified
*/
static void MapSpriteMappingRecolour(PalSpriteID *grf_sprite)
if (HasBit(grf_sprite->pal, 14)) {
@@ -56,7 +56,9 @@ void TriggerVehicle(Vehicle *veh, Vehicl
void UnloadWagonOverrides(Engine *e);
uint ListPositionOfEngine(EngineID engine);
void AlterRailVehListOrder(EngineID engine, EngineID target);
void CommitRailVehListOrderChanges();
EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id);
#endif /* NEWGRF_ENGINE_H */
Status change: