author | rubidium |
Thu, 01 Feb 2007 15:49:12 +0000 | |
changeset 5893 | 7e431a4abebb |
parent 5717 | b6fb89cd9cce |
child 6227 | e38177bd77c4 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
2982
eb7f50dcb249
(svn r3557) - NewGRF: move callback enums to a new file as more than just engines will use them
peter1138
parents:
2971
diff
changeset
|
3 |
#ifndef NEWGRF_CALLBACKS_H |
eb7f50dcb249
(svn r3557) - NewGRF: move callback enums to a new file as more than just engines will use them
peter1138
parents:
2971
diff
changeset
|
4 |
#define NEWGRF_CALLBACKS_H |
0 | 5 |
|
2982
eb7f50dcb249
(svn r3557) - NewGRF: move callback enums to a new file as more than just engines will use them
peter1138
parents:
2971
diff
changeset
|
6 |
/** @file newgrf_callbacks.h |
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
|
7 |
*/ |
0 | 8 |
|
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
9 |
/** |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
10 |
* List of implemented NewGRF callbacks. |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
11 |
* Names are formatted as CBID_<CLASS>_<CALLBACK> |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
12 |
*/ |
1883
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
13 |
enum CallbackID { |
1908
2fa391fed79a
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
14 |
// Powered wagons, if the result is lower as 0x40 then the wagon is powered |
2fa391fed79a
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
15 |
// TODO: interpret the rest of the result, aka "visual effects" |
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
16 |
CBID_TRAIN_WAGON_POWER = 0x10, |
1908
2fa391fed79a
(svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents:
1895
diff
changeset
|
17 |
|
1922
bda6f85eefaa
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
18 |
// Vehicle length, returns the amount of 1/8's the vehicle is shorter |
bda6f85eefaa
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
19 |
// only for train vehicles |
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
20 |
CBID_TRAIN_VEHICLE_LENGTH = 0x11, |
1922
bda6f85eefaa
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1909
diff
changeset
|
21 |
|
5211
fb4dc0ca975d
(svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents:
4694
diff
changeset
|
22 |
/* Called to determine the amount of cargo to load per unit of time when |
fb4dc0ca975d
(svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents:
4694
diff
changeset
|
23 |
* using gradual loading. */ |
fb4dc0ca975d
(svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents:
4694
diff
changeset
|
24 |
CBID_VEHICLE_LOAD_AMOUNT = 0x12, |
fb4dc0ca975d
(svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents:
4694
diff
changeset
|
25 |
|
3754
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
26 |
/* Called (if appropriate bit in callback mask is set) to determine if a |
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
27 |
* newstation should be made available to build */ |
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
28 |
CBID_STATION_AVAILABILITY = 0x13, |
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
29 |
|
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
30 |
/* Called (if appropriate bit in callback mask is set) when drawing a tile |
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
31 |
* to choose a sprite layout to draw, instead of the standard 0-7 range */ |
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
32 |
CBID_STATION_SPRITE_LAYOUT = 0x14, |
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
33 |
|
1883
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
34 |
// Refit capacity, the passed vehicle needs to have its ->cargo_type set to |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
35 |
// the cargo we are refitting to, returns the new cargo capacity |
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
36 |
CBID_VEHICLE_REFIT_CAPACITY = 0x15, |
2602
1a6561c9a408
(svn r3139) -NewGRF, Feature: support for articulated rail vehicles. This is used, for example, by coal tenders.
peter1138
parents:
2542
diff
changeset
|
37 |
|
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
38 |
CBID_TRAIN_ARTIC_ENGINE = 0x16, |
3650
4dd8517bdcf6
(svn r4561) - NewGRF: implement most of callback 0x23: additional text in vehicle purchase windows.
peter1138
parents:
3505
diff
changeset
|
39 |
|
4694
c917a3ad0dd2
(svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch)
peter1138
parents:
4656
diff
changeset
|
40 |
CBID_VEHICLE_CARGO_SUFFIX = 0x19, |
c917a3ad0dd2
(svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch)
peter1138
parents:
4656
diff
changeset
|
41 |
|
3727
3a3ebb0bde7e
(svn r4703) - NewGRF: add support for callback 0x1D, "can wagon be attached". This can be used to disallow freight wagons to be placed in passenger trains, along with other uses.
peter1138
parents:
3650
diff
changeset
|
42 |
CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D, |
3a3ebb0bde7e
(svn r4703) - NewGRF: add support for callback 0x1D, "can wagon be attached". This can be used to disallow freight wagons to be placed in passenger trains, along with other uses.
peter1138
parents:
3650
diff
changeset
|
43 |
|
3650
4dd8517bdcf6
(svn r4561) - NewGRF: implement most of callback 0x23: additional text in vehicle purchase windows.
peter1138
parents:
3505
diff
changeset
|
44 |
/* This callback is called from vehicle purchase lists. It returns a value to be |
4dd8517bdcf6
(svn r4561) - NewGRF: implement most of callback 0x23: additional text in vehicle purchase windows.
peter1138
parents:
3505
diff
changeset
|
45 |
* used as a custom string ID in the 0xD000 range. */ |
4dd8517bdcf6
(svn r4561) - NewGRF: implement most of callback 0x23: additional text in vehicle purchase windows.
peter1138
parents:
3505
diff
changeset
|
46 |
CBID_VEHICLE_ADDITIONAL_TEXT = 0x23, |
3754
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
47 |
|
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
48 |
/* Called when building a station to customize the tile layout */ |
4c8cbaaa0bbe
(svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents:
3727
diff
changeset
|
49 |
CBID_STATION_TILE_LAYOUT = 0x24, |
4244
d40c73c55357
(svn r5822) - NewGRF: add support for callback 31, vehicle start/stop check. This allows a set to disallow a vehicle from being started, i.e. to not be able to leave the depot. This is almost a partner to callback 1D.
peter1138
parents:
3754
diff
changeset
|
50 |
|
5717
b6fb89cd9cce
(svn r8211) -Codechange: (NewGRF) Implement callback 2D, explicit vehicle colour map
peter1138
parents:
5475
diff
changeset
|
51 |
/* Called to determine if a specific colour map should be used for a vehicle |
b6fb89cd9cce
(svn r8211) -Codechange: (NewGRF) Implement callback 2D, explicit vehicle colour map
peter1138
parents:
5475
diff
changeset
|
52 |
* instead of the default livery */ |
b6fb89cd9cce
(svn r8211) -Codechange: (NewGRF) Implement callback 2D, explicit vehicle colour map
peter1138
parents:
5475
diff
changeset
|
53 |
CBID_VEHICLE_COLOUR_MAPPING = 0x2D, |
b6fb89cd9cce
(svn r8211) -Codechange: (NewGRF) Implement callback 2D, explicit vehicle colour map
peter1138
parents:
5475
diff
changeset
|
54 |
|
4244
d40c73c55357
(svn r5822) - NewGRF: add support for callback 31, vehicle start/stop check. This allows a set to disallow a vehicle from being started, i.e. to not be able to leave the depot. This is almost a partner to callback 1D.
peter1138
parents:
3754
diff
changeset
|
55 |
/* Called when the player (or AI) tries to start or stop a vehicle. Mainly |
d40c73c55357
(svn r5822) - NewGRF: add support for callback 31, vehicle start/stop check. This allows a set to disallow a vehicle from being started, i.e. to not be able to leave the depot. This is almost a partner to callback 1D.
peter1138
parents:
3754
diff
changeset
|
56 |
* used for preventing a vehicle from leaving the depot. */ |
d40c73c55357
(svn r5822) - NewGRF: add support for callback 31, vehicle start/stop check. This allows a set to disallow a vehicle from being started, i.e. to not be able to leave the depot. This is almost a partner to callback 1D.
peter1138
parents:
3754
diff
changeset
|
57 |
CBID_VEHICLE_START_STOP_CHECK = 0x31, |
4656
9c1d8c4d3e60
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents:
4244
diff
changeset
|
58 |
|
9c1d8c4d3e60
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents:
4244
diff
changeset
|
59 |
/* Called to play a special sound effect */ |
9c1d8c4d3e60
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents:
4244
diff
changeset
|
60 |
CBID_VEHICLE_SOUND_EFFECT = 0x33, |
1895
0d499b71a782
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
61 |
}; |
0d499b71a782
(svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents:
1883
diff
changeset
|
62 |
|
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
63 |
/** |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
64 |
* Callback masks for vehicles, indicates which callbacks are used by a vehicle. |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
65 |
* Some callbacks are always used and don't have a mask. |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
66 |
*/ |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
67 |
enum VehicleCallbackMask { |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
68 |
CBM_WAGON_POWER = 0, ///< Powered wagons (trains only) |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
69 |
CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains only) |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
70 |
CBM_LOAD_AMOUNT = 2, ///< Load amount |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
71 |
CBM_REFIT_CAPACITY = 3, ///< Cargo capacity after refit |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
72 |
CBM_ARTIC_ENGINE = 4, ///< Add articulated engines (trains only) |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
73 |
CBM_CARGO_SUFFIX = 5, ///< Show suffix after cargo name |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
74 |
CBM_COLOUR_REMAP = 6, ///< Change colour mapping of vehicle |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
75 |
CBM_SOUND_EFFECT = 7, ///< Vehicle uses custom sound effects |
1883
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
76 |
}; |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
77 |
|
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
78 |
/** |
3505
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
79 |
* Callback masks for stations. |
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
80 |
*/ |
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
81 |
enum StationCallbackMask { |
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
82 |
CBM_STATION_AVAIL = 0, ///< Availability of station in construction window |
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
83 |
CBM_CUSTOM_LAYOUT = 1, ///< Use callback to select a tile layout to use |
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
84 |
}; |
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
85 |
|
091f0285df7d
(svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents:
3007
diff
changeset
|
86 |
/** |
3007
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
87 |
* Result of a failed callback. |
5c0d90264d47
(svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents:
2982
diff
changeset
|
88 |
*/ |
1883
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
89 |
enum { |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
90 |
CALLBACK_FAILED = 0xFFFF |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
91 |
}; |
ad68cd0a0a25
(svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents:
1802
diff
changeset
|
92 |
|
2982
eb7f50dcb249
(svn r3557) - NewGRF: move callback enums to a new file as more than just engines will use them
peter1138
parents:
2971
diff
changeset
|
93 |
#endif /* NEWGRF_CALLBACKS_H */ |