author | translators |
Thu, 11 Dec 2008 18:45:10 +0000 | |
changeset 10414 | cdcd8ae3f2f3 |
parent 9672 | 02fe9b0dc41b |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
9073
diff
changeset
|
3 |
/** @file newgrf_engine.h Functions for NewGRF engines. */ |
6348
6dd01da7a02b
(svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
belugas
parents:
6248
diff
changeset
|
4 |
|
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
|
5 |
#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
|
6 |
#define NEWGRF_ENGINE_H |
0 | 7 |
|
4656
9c1d8c4d3e60
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents:
4344
diff
changeset
|
8 |
#include "newgrf.h" |
8100
6bc08f98ec16
(svn r11661) -Codechange: some header reworks in order to try to reduce the compile time of OpenTTD by reduce the amount of circular-ish dependencies.
rubidium
parents:
7856
diff
changeset
|
9 |
#include "direction_type.h" |
3866
b13553406a0a
(svn r4902) Newgrf : Introduction of the newgrf_cargo files.
belugas
parents:
3845
diff
changeset
|
10 |
#include "newgrf_cargo.h" |
3157
3f35e2d9c8e3
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
2982
diff
changeset
|
11 |
|
3785
7d4c0a7850b2
(svn r4781) - NewGRF: give _traininfo_vehicle_pitch a proper declaration
peter1138
parents:
3726
diff
changeset
|
12 |
extern int _traininfo_vehicle_pitch; |
3845
af6eb0103fed
(svn r4869) - NewGRF: support setting train list vehicle width to 32 instead of 29 pixels, for sets which use 32 pixel long engines/wagons.
peter1138
parents:
3785
diff
changeset
|
13 |
extern int _traininfo_vehicle_width; |
3785
7d4c0a7850b2
(svn r4781) - NewGRF: give _traininfo_vehicle_pitch a proper declaration
peter1138
parents:
3726
diff
changeset
|
14 |
|
0 | 15 |
|
8198
a1d062c165b5
(svn r11761) -Codechange: Use appropriate variable types for NewGRF engine overrides, and adjust scope while there.
peter1138
parents:
8100
diff
changeset
|
16 |
void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains); |
a1d062c165b5
(svn r11761) -Codechange: Use appropriate variable types for NewGRF engine overrides, and adjust scope while there.
peter1138
parents:
8100
diff
changeset
|
17 |
const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine); |
3693
c154dbd20439
(svn r4629) - NewGRF: constify more code that deals with sprite groups, now that ref counting is gone.
peter1138
parents:
3684
diff
changeset
|
18 |
void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group); |
3684
4bb59d048c6e
(svn r4609) - NewGRF: give GetCustomEngineSprite the correct return type
peter1138
parents:
3648
diff
changeset
|
19 |
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction); |
4056
7899dc230a12
(svn r5336) - NewGRF: draw custom helicopter rotor sprites in vehicle info window, ensuring the correct direction is used (inspiration from mart3p)
peter1138
parents:
3924
diff
changeset
|
20 |
SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle* v, bool info_view); |
7899dc230a12
(svn r5336) - NewGRF: draw custom helicopter rotor sprites in vehicle info window, ensuring the correct direction is used (inspiration from mart3p)
peter1138
parents:
3924
diff
changeset
|
21 |
#define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i) |
7899dc230a12
(svn r5336) - NewGRF: draw custom helicopter rotor sprites in vehicle info window, ensuring the correct direction is used (inspiration from mart3p)
peter1138
parents:
3924
diff
changeset
|
22 |
#define GetCustomRotorIcon(et) GetRotorOverrideSprite(et, NULL, true) |
3648
d234c46bb37a
(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 |
|
3924
d06b513d65c3
(svn r5059) - NewGRF: store a GRFFile pointer reference for each pointer, instead of just the GRF ID.
peter1138
parents:
3866
diff
changeset
|
24 |
/* Forward declaration of GRFFile, to avoid unnecessary inclusion of newgrf.h |
d06b513d65c3
(svn r5059) - NewGRF: store a GRFFile pointer reference for each pointer, instead of just the GRF ID.
peter1138
parents:
3866
diff
changeset
|
25 |
* elsewhere... */ |
d06b513d65c3
(svn r5059) - NewGRF: store a GRFFile pointer reference for each pointer, instead of just the GRF ID.
peter1138
parents:
3866
diff
changeset
|
26 |
struct GRFFile; |
d06b513d65c3
(svn r5059) - NewGRF: store a GRFFile pointer reference for each pointer, instead of just the GRF ID.
peter1138
parents:
3866
diff
changeset
|
27 |
|
d06b513d65c3
(svn r5059) - NewGRF: store a GRFFile pointer reference for each pointer, instead of just the GRF ID.
peter1138
parents:
3866
diff
changeset
|
28 |
void SetEngineGRF(EngineID engine, const struct GRFFile *file); |
d06b513d65c3
(svn r5059) - NewGRF: store a GRFFile pointer reference for each pointer, instead of just the GRF ID.
peter1138
parents:
3866
diff
changeset
|
29 |
const struct GRFFile *GetEngineGRF(EngineID engine); |
3648
d234c46bb37a
(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
|
30 |
uint32 GetEngineGRFID(EngineID engine); |
d234c46bb37a
(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
|
31 |
|
7327
d810677fb909
(svn r10690) -Codechange: use the enum that describes all callback IDs in favor of "just" using an untyped integer.
rubidium
parents:
6603
diff
changeset
|
32 |
uint16 GetVehicleCallback(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v); |
d810677fb909
(svn r10690) -Codechange: use the enum that describes all callback IDs in favor of "just" using an untyped integer.
rubidium
parents:
6603
diff
changeset
|
33 |
uint16 GetVehicleCallbackParent(CallbackID callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v, const Vehicle *parent); |
1908
2fa391fed79a
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
34 |
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
|
35 |
#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
|
36 |
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction) |
0 | 37 |
|
6490
fe4443fba5e3
(svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents:
6348
diff
changeset
|
38 |
/* Handler to Evaluate callback 36. If the callback fails (i.e. most of the |
fe4443fba5e3
(svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents:
6348
diff
changeset
|
39 |
* time) orig_value is returned */ |
fe4443fba5e3
(svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents:
6348
diff
changeset
|
40 |
uint GetVehicleProperty(const Vehicle *v, uint8 property, uint orig_value); |
6517
295b16f8fa7d
(svn r9703) -Codechange: support callback 36 in vehicle purchase lists
peter1138
parents:
6490
diff
changeset
|
41 |
uint GetEngineProperty(EngineID engine, uint8 property, uint orig_value); |
6490
fe4443fba5e3
(svn r9671) -Codechange: Implement NewGRF callback 36, which allows changing of various properties which were previously static. Vehicle max speed and train power/te/running costs are adjustable.
peter1138
parents:
6348
diff
changeset
|
42 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
43 |
enum VehicleTrigger { |
7856
1a2d4c6922db
(svn r11406) -Fix: wrong triggers would be activated on callback 32 for vehicles.
rubidium
parents:
7803
diff
changeset
|
44 |
VEHICLE_TRIGGER_NEW_CARGO = 0x01, |
6348
6dd01da7a02b
(svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
belugas
parents:
6248
diff
changeset
|
45 |
/* Externally triggered only for the first vehicle in chain */ |
7856
1a2d4c6922db
(svn r11406) -Fix: wrong triggers would be activated on callback 32 for vehicles.
rubidium
parents:
7803
diff
changeset
|
46 |
VEHICLE_TRIGGER_DEPOT = 0x02, |
6348
6dd01da7a02b
(svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
belugas
parents:
6248
diff
changeset
|
47 |
/* Externally triggered only for the first vehicle in chain, only if whole chain is empty */ |
7856
1a2d4c6922db
(svn r11406) -Fix: wrong triggers would be activated on callback 32 for vehicles.
rubidium
parents:
7803
diff
changeset
|
48 |
VEHICLE_TRIGGER_EMPTY = 0x04, |
6348
6dd01da7a02b
(svn r9385) -Cleanup: doxygen changes. Today, we are exploring the letter N.
belugas
parents:
6248
diff
changeset
|
49 |
/* Not triggered externally (called for the whole chain if we got NEW_CARGO) */ |
7856
1a2d4c6922db
(svn r11406) -Fix: wrong triggers would be activated on callback 32 for vehicles.
rubidium
parents:
7803
diff
changeset
|
50 |
VEHICLE_TRIGGER_ANY_NEW_CARGO = 0x08, |
7803
55307751965b
(svn r11353) -Codechange: add support for newgrf callback 32
glx
parents:
7327
diff
changeset
|
51 |
/* Externally triggered for each vehicle in chain */ |
7856
1a2d4c6922db
(svn r11406) -Fix: wrong triggers would be activated on callback 32 for vehicles.
rubidium
parents:
7803
diff
changeset
|
52 |
VEHICLE_TRIGGER_CALLBACK_32 = 0x10, |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
53 |
}; |
1477 | 54 |
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
|
55 |
|
9070
dd0121143eba
(svn r12924) -Feature: Introducing the so called 'engine pool' which primarily removes the fixed engine type limits and also happens to allow (with the patch option 'dynamic_engines') multiple NewGRF vehicle sets to coexist.
peter1138
parents:
9046
diff
changeset
|
56 |
void UnloadWagonOverrides(Engine *e); |
2491
15a117630a4f
(svn r3017) -NewGRF: Implement sprite group unreferencing and unloading.
peter1138
parents:
2477
diff
changeset
|
57 |
|
9070
dd0121143eba
(svn r12924) -Feature: Introducing the so called 'engine pool' which primarily removes the fixed engine type limits and also happens to allow (with the patch option 'dynamic_engines') multiple NewGRF vehicle sets to coexist.
peter1138
parents:
9046
diff
changeset
|
58 |
uint ListPositionOfEngine(EngineID engine); |
9672
02fe9b0dc41b
(svn r13761) -Codechange: Remove dependency on rail for altering purchase list position (mostly function renaming)
peter1138
parents:
9111
diff
changeset
|
59 |
void AlterVehicleListOrder(EngineID engine, EngineID target); |
02fe9b0dc41b
(svn r13761) -Codechange: Remove dependency on rail for altering purchase list position (mostly function renaming)
peter1138
parents:
9111
diff
changeset
|
60 |
void CommitVehicleListOrderChanges(); |
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
|
61 |
|
9073
0e06e1f08e31
(svn r12932) -Fix [FS#1970]: Articulated engines ignored GRF engine overrides.
peter1138
parents:
9070
diff
changeset
|
62 |
EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_id); |
0e06e1f08e31
(svn r12932) -Fix [FS#1970]: Articulated engines ignored GRF engine overrides.
peter1138
parents:
9070
diff
changeset
|
63 |
|
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
|
64 |
#endif /* NEWGRF_ENGINE_H */ |