newgrf_callbacks.h
author Darkvater
Mon, 31 Jul 2006 22:40:55 +0000
changeset 4204 3aa39be759f2
parent 3754 4c8cbaaa0bbe
child 4244 d40c73c55357
permissions -rw-r--r--
(svn r5688) - Forward-port the release-changes from the 0.4 branch back to trunk. This ensures an updated changelog, known-bugs, etc.
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
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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     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
3754
4c8cbaaa0bbe (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    22
	/* 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
    23
	 * newstation should be made available to build */
4c8cbaaa0bbe (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    24
	CBID_STATION_AVAILABILITY       = 0x13,
4c8cbaaa0bbe (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    25
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) when drawing a tile
4c8cbaaa0bbe (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    27
	 * 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
    28
	CBID_STATION_SPRITE_LAYOUT      = 0x14,
4c8cbaaa0bbe (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    29
1883
ad68cd0a0a25 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    30
	// 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
    31
	// 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
    32
	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
    33
3007
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    34
	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
    35
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
    36
	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
    37
3650
4dd8517bdcf6 (svn r4561) - NewGRF: implement most of callback 0x23: additional text in vehicle purchase windows.
peter1138
parents: 3505
diff changeset
    38
	/* 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
    39
	 * 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
    40
	CBID_VEHICLE_ADDITIONAL_TEXT    = 0x23,
3754
4c8cbaaa0bbe (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    41
4c8cbaaa0bbe (svn r4742) - Newstations: Add callbacks for building and drawing custom stations.
peter1138
parents: 3727
diff changeset
    42
	/* 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
    43
	CBID_STATION_TILE_LAYOUT        = 0x24,
1895
0d499b71a782 (svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents: 1883
diff changeset
    44
};
0d499b71a782 (svn r2401) - Fix: [newgrf] Finish up callback mechanism, implement 'refit capacity' callback slightly more correct.
hackykid
parents: 1883
diff changeset
    45
3007
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    46
/**
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    47
 * 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
    48
 * 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
    49
 */
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    50
enum VehicleCallbackMask {
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    51
	CBM_WAGON_POWER    = 0, ///< Powered wagons (trains only)
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    52
	CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains only)
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    53
	CBM_LOAD_AMOUNT    = 2, ///< Load amount
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    54
	CBM_REFIT_CAPACITY = 3, ///< Cargo capacity after refit
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    55
	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
    56
	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
    57
	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
    58
	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
    59
};
ad68cd0a0a25 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    60
3007
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    61
/**
3505
091f0285df7d (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    62
 * Callback masks for stations.
091f0285df7d (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    63
 */
091f0285df7d (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    64
enum StationCallbackMask {
091f0285df7d (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    65
	CBM_STATION_AVAIL = 0, ///< Availability of station in construction window
091f0285df7d (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    66
	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
    67
};
091f0285df7d (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    68
091f0285df7d (svn r4356) - NewGRF: Load more newstation properties.
peter1138
parents: 3007
diff changeset
    69
/**
3007
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    70
 * Result of a failed callback.
5c0d90264d47 (svn r3587) - NewGRF: Rename Callback IDs to include their "class"
peter1138
parents: 2982
diff changeset
    71
 */
1883
ad68cd0a0a25 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    72
enum {
ad68cd0a0a25 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    73
	CALLBACK_FAILED = 0xFFFF
ad68cd0a0a25 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    74
};
ad68cd0a0a25 (svn r2389) - Feature: [newgrf] Implement the mechanism for handling newgrf callbacks.
hackykid
parents: 1802
diff changeset
    75
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
    76
#endif /* NEWGRF_CALLBACKS_H */