# newgrf_engine.h

Go to the documentation of this file.

    00001 /* $Id: newgrf_engine.h 11822 2008-01-12 19:58:06Z peter1138 $ */
    00002
    00005 #ifndef NEWGRF_ENGINE_H
    00006 #define NEWGRF_ENGINE_H
    00007
    00008 #include "newgrf.h"
    00009 #include "direction_type.h"
    00010 #include "newgrf_cargo.h"
    00011
    00012 extern int _traininfo_vehicle_pitch;
    00013 extern int _traininfo_vehicle_width;
    00014
    00015
    00016 void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains);
    00017 const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine);
    00018 void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group);
    00019 SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
    00020 SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle* v, bool info_view);
    00021 #define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i)
    00022 #define GetCustomRotorIcon(et) GetRotorOverrideSprite(et, NULL, true)
    00023
    00024 /* Forward declaration of GRFFile, to avoid unnecessary inclusion of newgrf.h
    00025  * elsewhere... */
    00026 struct GRFFile;
    00027
    00028 void SetEngineGRF(EngineID engine, const struct GRFFile *file);
    00029 const struct GRFFile *GetEngineGRF(EngineID engine);
    00030 uint32 GetEngineGRFID(EngineID engine);
    00031
    00032 uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v);
    00033 uint16 GetVehicleCallbackParent(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent);
    00034 bool UsesWagonOverride(const Vehicle *v);
    00035 #define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
    00036 #define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
    00037
    00038 /* Handler to Evaluate callback 36. If the callback fails (i.e. most of the
    00039  * time) orig_value is returned */
    00040 uint GetVehicleProperty(const Vehicle *v, uint8 property, uint orig_value);
    00041 uint GetEngineProperty(EngineID engine, uint8 property, uint orig_value);
    00042
    00043 enum VehicleTrigger {
    00044   VEHICLE_TRIGGER_NEW_CARGO     = 0x01,
    00045   /* Externally triggered only for the first vehicle in chain */
    00046   VEHICLE_TRIGGER_DEPOT         = 0x02,
    00047   /* Externally triggered only for the first vehicle in chain, only if whole chain is empty */
    00048   VEHICLE_TRIGGER_EMPTY         = 0x04,
    00049   /* Not triggered externally (called for the whole chain if we got NEW_CARGO) */
    00050   VEHICLE_TRIGGER_ANY_NEW_CARGO = 0x08,
    00051   /* Externally triggered for each vehicle in chain */
    00052   VEHICLE_TRIGGER_CALLBACK_32   = 0x10,
    00053 };
    00054 void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
    00055
    00056 void UnloadWagonOverrides();
    00057 void UnloadCustomEngineSprites();
    00058
    00059 void ResetEngineListOrder();
    00060 EngineID GetRailVehAtPosition(EngineID pos);
    00061 uint16 ListPositionOfEngine(EngineID engine);
    00062 void AlterRailVehListOrder(EngineID engine, EngineID target);
    00063
    00064 #endif /* NEWGRF_ENGINE_H */