newgrf_callbacks.h
author glx
Mon, 24 Sep 2007 03:08:47 +0000
branch0.5
changeset 5545 f42dc59a45f5
parent 5211 651c9272ad22
permissions -rw-r--r--
(svn r11153) [0.5] -Fix [FS#1251]: incorrect usage of {G} tag in slovak translation
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
2982
286f69caaf05 (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
286f69caaf05 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
2982
286f69caaf05 (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
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
     7
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
3007
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
     9
/**
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    10
 * List of implemented NewGRF callbacks.
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    11
 * Names are formatted as CBID_<CLASS>_<CALLBACK>
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    12
 */
1883
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    13
enum CallbackID {
1908
bc48a30aba72 (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
bc48a30aba72 (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
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    16
	CBID_TRAIN_WAGON_POWER          = 0x10,
1908
bc48a30aba72 (svn r2414) - Feature: [newgrf] Implement powered wagons, and the callback that goes with it.
hackykid
parents: 1895
diff changeset
    17
1922
797081e56d13 (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
797081e56d13 (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
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    20
	CBID_TRAIN_VEHICLE_LENGTH       = 0x11,
1922
797081e56d13 (svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents: 1909
diff changeset
    21
5211
651c9272ad22 (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
651c9272ad22 (svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents: 4694
diff changeset
    23
	 * using gradual loading. */
651c9272ad22 (svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents: 4694
diff changeset
    24
	CBID_VEHICLE_LOAD_AMOUNT        = 0x12,
651c9272ad22 (svn r7326) -Feature: Add support for gradual (un)loading of vehicles (Maedhros)
peter1138
parents: 4694
diff changeset
    25
3754
04356ae401b4 (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
04356ae401b4 (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    27
	 * newstation should be made available to build */
04356ae401b4 (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    28
	CBID_STATION_AVAILABILITY       = 0x13,
04356ae401b4 (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    29
04356ae401b4 (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
04356ae401b4 (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 */
04356ae401b4 (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    32
	CBID_STATION_SPRITE_LAYOUT      = 0x14,
04356ae401b4 (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    33
1883
3b02000cfbe0 (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
3b02000cfbe0 (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
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    36
	CBID_VEHICLE_REFIT_CAPACITY     = 0x15,
2602
f0e2dcce3695 (svn r3139) -NewGRF, Feature: support for articulated rail vehicles. This is used, for example, by coal tenders.
peter1138
parents: 2542
diff changeset
    37
3007
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    38
	CBID_TRAIN_ARTIC_ENGINE         = 0x16,
3650
92a3f5cae745 (svn r4561) - NewGRF: implement most of callback 0x23: additional text in vehicle purchase windows.
peter1138
parents: 3505
diff changeset
    39
4694
a4d2a3abe75c (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,
a4d2a3abe75c (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
b4d9a8ab4ce4 (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,
b4d9a8ab4ce4 (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
92a3f5cae745 (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
92a3f5cae745 (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. */
92a3f5cae745 (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
04356ae401b4 (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    47
04356ae401b4 (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 */
04356ae401b4 (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    49
	CBID_STATION_TILE_LAYOUT        = 0x24,
4244
44dcec623504 (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
44dcec623504 (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
    51
	/* Called when the player (or AI) tries to start or stop a vehicle. Mainly
44dcec623504 (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
    52
	 * used for preventing a vehicle from leaving the depot. */
44dcec623504 (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
    53
	CBID_VEHICLE_START_STOP_CHECK   = 0x31,
4656
acffecd6f484 (svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents: 4244
diff changeset
    54
acffecd6f484 (svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents: 4244
diff changeset
    55
	/* Called to play a special sound effect */
acffecd6f484 (svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents: 4244
diff changeset
    56
	CBID_VEHICLE_SOUND_EFFECT       = 0x33,
1895
398f156479c8 (svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents: 1883
diff changeset
    57
};
398f156479c8 (svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents: 1883
diff changeset
    58
3007
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    59
/**
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    60
 * Callback masks for vehicles, indicates which callbacks are used by a vehicle.
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    61
 * Some callbacks are always used and don't have a mask.
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    62
 */
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    63
enum VehicleCallbackMask {
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    64
	CBM_WAGON_POWER    = 0, ///< Powered wagons (trains only)
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    65
	CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains only)
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    66
	CBM_LOAD_AMOUNT    = 2, ///< Load amount
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    67
	CBM_REFIT_CAPACITY = 3, ///< Cargo capacity after refit
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    68
	CBM_ARTIC_ENGINE   = 4, ///< Add articulated engines (trains only)
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    69
	CBM_CARGO_SUFFIX   = 5, ///< Show suffix after cargo name
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    70
	CBM_COLOUR_REMAP   = 6, ///< Change colour mapping of vehicle
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    71
	CBM_SOUND_EFFECT   = 7, ///< Vehicle uses custom sound effects
1883
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    72
};
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    73
3007
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    74
/**
3505
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    75
 * Callback masks for stations.
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    76
 */
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    77
enum StationCallbackMask {
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    78
	CBM_STATION_AVAIL = 0, ///< Availability of station in construction window
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    79
	CBM_CUSTOM_LAYOUT = 1, ///< Use callback to select a tile layout to use
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    80
};
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    81
e9a3a6b79561 (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    82
/**
3007
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    83
 * Result of a failed callback.
6f65203dc324 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    84
 */
1883
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    85
enum {
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    86
	CALLBACK_FAILED = 0xFFFF
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    87
};
3b02000cfbe0 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    88
2982
286f69caaf05 (svn r3557) - NewGRF: move callback enums to a new file as more than just engines will use them
peter1138
parents: 2971
diff changeset
    89
#endif /* NEWGRF_CALLBACKS_H */