newgrf_engine.h
author tron
Mon, 10 Apr 2006 07:15:58 +0000
changeset 3491 35d747bb5e82
parent 3390 ae4b0872dc78
child 3604 1e7d9f584f93
permissions -rw-r--r--
(svn r4342) Change the first two parameters of commands - virtual pixel coordinates of the tile to operate on - to a TileIndex
Remove DoCommandByTile(), because now it does the same as DoCommand()
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2129
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2129
diff changeset
     2
2962
f0a49b646c48 (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
f0a49b646c48 (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
3f35e2d9c8e3 (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents: 2982
diff changeset
     6
#include "direction.h"
3f35e2d9c8e3 (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents: 2982
diff changeset
     7
2962
f0a49b646c48 (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
f0a49b646c48 (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
da61740cc1e7 (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];
da61740cc1e7 (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];
da61740cc1e7 (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];
da61740cc1e7 (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
36aa372eeb34 (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
225b2916fe2a (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);
225b2916fe2a (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
3157
3f35e2d9c8e3 (svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents: 2982
diff changeset
    20
int GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
3390
ae4b0872dc78 (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
    21
uint16 GetVehicleCallback(byte callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v);
1908
2fa391fed79a (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    22
bool UsesWagonOverride(const Vehicle *v);
414
4629d4bf7f14 (svn r611) -newgrf: Change GetCustomEngineSprite() calling convention (invisible to users of GetCustomVehicle*() wrappers). Needed for deterministic spritegroups support (pasky).
darkvater
parents: 405
diff changeset
    23
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
4629d4bf7f14 (svn r611) -newgrf: Change GetCustomEngineSprite() calling convention (invisible to users of GetCustomVehicle*() wrappers). Needed for deterministic spritegroups support (pasky).
darkvater
parents: 405
diff changeset
    24
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
1477
9389baf2bf3c (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
    26
typedef enum VehicleTrigger {
445
beafc0fb8f12 (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
    27
	VEHICLE_TRIGGER_NEW_CARGO = 1,
beafc0fb8f12 (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
    28
	// Externally triggered only for the first vehicle in chain
beafc0fb8f12 (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
    29
	VEHICLE_TRIGGER_DEPOT = 2,
beafc0fb8f12 (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
    30
	// Externally triggered only for the first vehicle in chain, only if whole chain is empty
beafc0fb8f12 (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_EMPTY = 4,
beafc0fb8f12 (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
	// Not triggered externally (called for the whole chain if we got NEW_CARGO)
beafc0fb8f12 (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_ANY_NEW_CARGO = 8,
1477
9389baf2bf3c (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
    34
} VehicleTrigger;
9389baf2bf3c (svn r1981) Typedef some structs and enums
tron
parents: 1475
diff changeset
    35
void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
445
beafc0fb8f12 (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
2477
225b2916fe2a (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
    37
void SetCustomEngineName(EngineID engine, const char *name);
225b2916fe2a (svn r3003) Change int, uint, uin16 and byte to EngineID where appropriate, plus some related changes (mostly casts)
tron
parents: 2464
diff changeset
    38
StringID GetCustomEngineName(EngineID engine);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
2491
15a117630a4f (svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents: 2477
diff changeset
    40
void UnloadWagonOverrides(void);
15a117630a4f (svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents: 2477
diff changeset
    41
void UnloadCustomEngineSprites(void);
2769
eab49a86038e (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
    42
void UnloadCustomEngineNames(void);
2491
15a117630a4f (svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents: 2477
diff changeset
    43
2971
cae3a81e8674 (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
    44
void ResetEngineListOrder(void);
cae3a81e8674 (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
    45
EngineID GetRailVehAtPosition(EngineID pos);
cae3a81e8674 (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
    46
void AlterRailVehListOrder(EngineID engine, EngineID target);
cae3a81e8674 (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
    47
2962
f0a49b646c48 (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
    48
#endif /* NEWGRF_ENGINE_H */