2006-02-03 12:55:21 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-03-21 03:06:21 +00:00
|
|
|
/** @file newgrf_engine.h */
|
|
|
|
|
2006-02-03 12:55:21 +00:00
|
|
|
#ifndef NEWGRF_ENGINE_H
|
|
|
|
#define NEWGRF_ENGINE_H
|
|
|
|
|
2006-09-27 19:17:01 +01:00
|
|
|
#include "newgrf.h"
|
2006-03-08 06:55:33 +00:00
|
|
|
#include "direction.h"
|
2006-05-18 03:43:23 +01:00
|
|
|
#include "newgrf_cargo.h"
|
2006-03-08 06:55:33 +00:00
|
|
|
|
2006-05-08 11:01:34 +01:00
|
|
|
extern int _traininfo_vehicle_pitch;
|
2006-05-14 21:58:12 +01:00
|
|
|
extern int _traininfo_vehicle_width;
|
2006-05-08 11:01:34 +01:00
|
|
|
|
2006-02-03 12:55:21 +00:00
|
|
|
|
2006-10-17 15:52:55 +01:00
|
|
|
void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, byte *train_id, int trains);
|
2007-05-10 07:42:43 +01:00
|
|
|
const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, byte overriding_engine);
|
2006-04-30 19:19:37 +01:00
|
|
|
void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group);
|
2006-04-30 19:41:16 +01:00
|
|
|
void SetRotorOverrideSprites(EngineID engine, const struct SpriteGroup *group);
|
2006-04-28 20:49:48 +01:00
|
|
|
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
|
2006-06-22 22:15:27 +01:00
|
|
|
SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle* v, bool info_view);
|
|
|
|
#define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i)
|
|
|
|
#define GetCustomRotorIcon(et) GetRotorOverrideSprite(et, NULL, true)
|
2006-04-23 23:25:33 +01:00
|
|
|
|
2006-05-31 18:31:08 +01:00
|
|
|
/* Forward declaration of GRFFile, to avoid unnecessary inclusion of newgrf.h
|
|
|
|
* elsewhere... */
|
|
|
|
struct GRFFile;
|
|
|
|
|
|
|
|
void SetEngineGRF(EngineID engine, const struct GRFFile *file);
|
|
|
|
const struct GRFFile *GetEngineGRF(EngineID engine);
|
2006-04-23 23:25:33 +01:00
|
|
|
uint32 GetEngineGRFID(EngineID engine);
|
|
|
|
|
2007-07-25 20:06:29 +01:00
|
|
|
uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v);
|
|
|
|
uint16 GetVehicleCallbackParent(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent);
|
2006-02-03 12:55:21 +00:00
|
|
|
bool UsesWagonOverride(const Vehicle *v);
|
|
|
|
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
|
|
|
|
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
|
|
|
|
|
2007-04-18 19:37:40 +01:00
|
|
|
/* Handler to Evaluate callback 36. If the callback fails (i.e. most of the
|
|
|
|
* time) orig_value is returned */
|
|
|
|
uint GetVehicleProperty(const Vehicle *v, uint8 property, uint orig_value);
|
2007-04-20 22:42:06 +01:00
|
|
|
uint GetEngineProperty(EngineID engine, uint8 property, uint orig_value);
|
2007-04-18 19:37:40 +01:00
|
|
|
|
2007-03-07 12:11:48 +00:00
|
|
|
enum VehicleTrigger {
|
2007-11-11 12:29:47 +00:00
|
|
|
VEHICLE_TRIGGER_NEW_CARGO = 0x01,
|
2007-03-21 03:06:21 +00:00
|
|
|
/* Externally triggered only for the first vehicle in chain */
|
2007-11-11 12:29:47 +00:00
|
|
|
VEHICLE_TRIGGER_DEPOT = 0x02,
|
2007-03-21 03:06:21 +00:00
|
|
|
/* Externally triggered only for the first vehicle in chain, only if whole chain is empty */
|
2007-11-11 12:29:47 +00:00
|
|
|
VEHICLE_TRIGGER_EMPTY = 0x04,
|
2007-03-21 03:06:21 +00:00
|
|
|
/* Not triggered externally (called for the whole chain if we got NEW_CARGO) */
|
2007-11-11 12:29:47 +00:00
|
|
|
VEHICLE_TRIGGER_ANY_NEW_CARGO = 0x08,
|
2007-10-28 16:00:51 +00:00
|
|
|
/* Externally triggered for each vehicle in chain */
|
2007-11-11 12:29:47 +00:00
|
|
|
VEHICLE_TRIGGER_CALLBACK_32 = 0x10,
|
2007-03-07 12:11:48 +00:00
|
|
|
};
|
2006-02-03 12:55:21 +00:00
|
|
|
void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
|
|
|
|
|
2006-04-21 08:06:31 +01:00
|
|
|
void SetCustomEngineName(EngineID engine, StringID name);
|
2006-02-03 12:55:21 +00:00
|
|
|
StringID GetCustomEngineName(EngineID engine);
|
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void UnloadWagonOverrides();
|
|
|
|
void UnloadRotorOverrideSprites();
|
|
|
|
void UnloadCustomEngineSprites();
|
|
|
|
void UnloadCustomEngineNames();
|
2006-02-03 12:55:21 +00:00
|
|
|
|
2007-03-07 11:47:46 +00:00
|
|
|
void ResetEngineListOrder();
|
2006-02-04 21:48:46 +00:00
|
|
|
EngineID GetRailVehAtPosition(EngineID pos);
|
2006-10-11 19:35:40 +01:00
|
|
|
uint16 ListPositionOfEngine(EngineID engine);
|
2006-02-04 21:48:46 +00:00
|
|
|
void AlterRailVehListOrder(EngineID engine, EngineID target);
|
|
|
|
|
2006-02-03 12:55:21 +00:00
|
|
|
#endif /* NEWGRF_ENGINE_H */
|