newgrf_engine.h
author peter1138
Fri, 28 Apr 2006 19:49:48 +0000
changeset 3684 c5dfac322f16
parent 3648 1574c89384cb
child 3693 af2ee9b328e6
permissions -rw-r--r--
(svn r4609) - NewGRF: give GetCustomEngineSprite the correct return type
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2129
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2129
diff changeset
     2
2962
dbd168a4703a (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
peter1138
parents: 2848
diff changeset
     3
#ifndef NEWGRF_ENGINE_H
dbd168a4703a (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
peter1138
parents: 2848
diff changeset
     4
#define NEWGRF_ENGINE_H
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
3157
40de8616c04c (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents: 2982
diff changeset
     6
#include "direction.h"
40de8616c04c (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents: 2982
diff changeset
     7
2962
dbd168a4703a (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
peter1138
parents: 2848
diff changeset
     8
/** @file newgrf_engine.h
dbd168a4703a (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
peter1138
parents: 2848
diff changeset
     9
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
1802
448f187042d3 (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents: 1786
diff changeset
    11
VARDEF const uint32 _default_refitmasks[NUM_VEHICLE_TYPES];
448f187042d3 (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents: 1786
diff changeset
    12
VARDEF const CargoID _global_cargo_id[NUM_LANDSCAPE][NUM_CARGO];
448f187042d3 (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents: 1786
diff changeset
    13
VARDEF const uint32 _landscape_global_cargo_mask[NUM_LANDSCAPE];
448f187042d3 (svn r2306) - CodeChange: Check the last commands; refits. This needed an extensive rewrite and global/local-cargo ID juggling and bitmasking. However with this done it looks better as well and is compatible with newgrf handling. Big thanks to HackyKid for doing most of the work. This also closes patch "[ 1199277 ] Command checks"
Darkvater
parents: 1786
diff changeset
    14
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
2611
65b5313bc525 (svn r3148) -NewGRF, Feature: Add support for cargo refitting specification by cargo classes.
peter1138
parents: 2602
diff changeset
    15
VARDEF const uint32 cargo_classes[16];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
    17
void SetWagonOverrideSprites(EngineID engine, struct SpriteGroup *group, byte *train_id, int trains);
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
    18
void SetCustomEngineSprites(EngineID engine, byte cargo, struct SpriteGroup *group);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
// loaded is in percents, overriding_engine 0xffff is none
3684
c5dfac322f16 (svn r4609) - NewGRF: give GetCustomEngineSprite the correct return type
peter1138
parents: 3648
diff changeset
    20
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
3648
1574c89384cb (svn r4559) - NewGRF: keep a record of which grf an engine is defined in. Will be used in the future.
peter1138
parents: 3604
diff changeset
    21
1574c89384cb (svn r4559) - NewGRF: keep a record of which grf an engine is defined in. Will be used in the future.
peter1138
parents: 3604
diff changeset
    22
void SetEngineGRF(EngineID engine, uint32 grfid);
1574c89384cb (svn r4559) - NewGRF: keep a record of which grf an engine is defined in. Will be used in the future.
peter1138
parents: 3604
diff changeset
    23
uint32 GetEngineGRFID(EngineID engine);
1574c89384cb (svn r4559) - NewGRF: keep a record of which grf an engine is defined in. Will be used in the future.
peter1138
parents: 3604
diff changeset
    24
3390
f910bc27153e (svn r4198) - NewGRF: Rename GetCallBackResult() to GetVehicleCallback(), as other types will exist later, and use separate parameters instead of bitshifting.
peter1138
parents: 3157
diff changeset
    25
uint16 GetVehicleCallback(byte callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v);
1908
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    26
bool UsesWagonOverride(const Vehicle *v);
414
e18cc252e2ea (svn r611) -newgrf: Change GetCustomEngineSprite() calling convention (invisible to users of GetCustomVehicle*() wrappers). Needed for deterministic spritegroups support (pasky).
darkvater
parents: 405
diff changeset
    27
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
e18cc252e2ea (svn r611) -newgrf: Change GetCustomEngineSprite() calling convention (invisible to users of GetCustomVehicle*() wrappers). Needed for deterministic spritegroups support (pasky).
darkvater
parents: 405
diff changeset
    28
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
    30
typedef enum VehicleTrigger {
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    31
	VEHICLE_TRIGGER_NEW_CARGO = 1,
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    32
	// Externally triggered only for the first vehicle in chain
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    33
	VEHICLE_TRIGGER_DEPOT = 2,
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    34
	// Externally triggered only for the first vehicle in chain, only if whole chain is empty
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    35
	VEHICLE_TRIGGER_EMPTY = 4,
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    36
	// Not triggered externally (called for the whole chain if we got NEW_CARGO)
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    37
	VEHICLE_TRIGGER_ANY_NEW_CARGO = 8,
1477
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
    38
} VehicleTrigger;
2174a73b11c9 (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
    39
void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
445
0e3fa3da3899 (svn r654) Hopefully complete support for randomized variational spritegroups (i.e. the cars transporter in DBSetXL gets different cars each time) (pasky)
tron
parents: 414
diff changeset
    40
3604
d28877422030 (svn r4496) - NewGRF: switch custom engine names from storing a char* to using the new StringID based text system. Vehicle name
peter1138
parents: 3390
diff changeset
    41
void SetCustomEngineName(EngineID engine, StringID name);
2477
d454d5152386 (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
    42
StringID GetCustomEngineName(EngineID engine);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
2491
dfe9542f783e (svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents: 2477
diff changeset
    44
void UnloadWagonOverrides(void);
dfe9542f783e (svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents: 2477
diff changeset
    45
void UnloadCustomEngineSprites(void);
2769
acea0abd2195 (svn r3316) - NewGRF: Unload engine names before loading grf files. This fixes names in climates where the engines don't get loaded. Renamed function to reflect its purpose.
peter1138
parents: 2763
diff changeset
    46
void UnloadCustomEngineNames(void);
2491
dfe9542f783e (svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents: 2477
diff changeset
    47
2971
9b62397dbd56 (svn r3546) - NewGRF feature: Implement rail vehicle 'property' 0x1A: allows shuffling order of rail vehicle purchase list (and replace vehicle list)
peter1138
parents: 2962
diff changeset
    48
void ResetEngineListOrder(void);
9b62397dbd56 (svn r3546) - NewGRF feature: Implement rail vehicle 'property' 0x1A: allows shuffling order of rail vehicle purchase list (and replace vehicle list)
peter1138
parents: 2962
diff changeset
    49
EngineID GetRailVehAtPosition(EngineID pos);
9b62397dbd56 (svn r3546) - NewGRF feature: Implement rail vehicle 'property' 0x1A: allows shuffling order of rail vehicle purchase list (and replace vehicle list)
peter1138
parents: 2962
diff changeset
    50
void AlterRailVehListOrder(EngineID engine, EngineID target);
9b62397dbd56 (svn r3546) - NewGRF feature: Implement rail vehicle 'property' 0x1A: allows shuffling order of rail vehicle purchase list (and replace vehicle list)
peter1138
parents: 2962
diff changeset
    51
2962
dbd168a4703a (svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
peter1138
parents: 2848
diff changeset
    52
#endif /* NEWGRF_ENGINE_H */