39
40
DECLARE_ENUM_AS_BIT_SET(VehicleEnterTileStatus);
42
/** Tile information, used while rendering the tile */
44
uint x; ///< X position of the tile in unit coordinates
45
uint y; ///< Y position of the tile in unit coordinates
46
Slope tileh; ///< Slope of the tile
47
TileIndex tile; ///< Tile index
51
/** Tile description for the 'land area information' tool */
53
StringID str; ///< Description of the tile
54
Owner owner[4]; ///< Name of the owner(s)
55
StringID owner_type[4]; ///< Type of each owner
56
Date build_date; ///< Date of construction of tile contents
57
StringID station_class; ///< Class of station
58
StringID station_name; ///< Type of station within the class
59
const char *grf; ///< newGRF used for the tile contents
60
uint64 dparam[2]; ///< Parameters of the \a str string
64
* Tile callback function signature for drawing a tile and its contents to the screen
65
* @param ti Information about the tile to draw
56
67
typedef void DrawTileProc(TileInfo *ti);
57
68
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
58
typedef CommandCost ClearTileProc(TileIndex tile, byte flags);
69
typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags);
72
* Tile callback function signature for obtaining accepted carog of a tile
73
* @param tile Tile queried for its accepted cargo
74
* @param res Storage destination of the cargo accepted
59
76
typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
79
* Tile callback function signature for obtaining a tile description
80
* @param tile Tile being queried
81
* @param td Storage pointer for returned tile description
60
83
typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
63
* GetTileTrackStatusProcs return a value that contains the possible tracks
86
* Tile callback function signature for getting the possible tracks
64
87
* that can be taken on a given tile by a given transport.
65
89
* The return value contains the existing trackdirs and signal states.
67
91
* see track_func.h for usage of TrackStatus.
72
96
* @return the track status information
74
98
typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
101
* Tile callback function signature for obtaining the produced cargo of a tile.
102
* @param tile Tile being queried
103
* @param b Destination array of produced cargo
75
105
typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
76
typedef void ClickTileProc(TileIndex tile);
106
typedef bool ClickTileProc(TileIndex tile);
77
107
typedef void AnimateTileProc(TileIndex tile);
78
108
typedef void TileLoopProc(TileIndex tile);
79
typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
109
typedef void ChangeTileOwnerProc(TileIndex tile, Owner old_owner, Owner new_owner);
81
111
/** @see VehicleEnterTileStatus to see what the return values mean */
82
112
typedef VehicleEnterTileStatus VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
83
113
typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
86
* Called when a tile is affected by a terraforming operation.
87
* The function has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype.
88
* With DC_EXEC in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
116
* Tile callback function signature of the terraforming callback.
118
* The function is called when a tile is affected by a terraforming operation.
119
* It has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype.
120
* With DC_EXEC in \a flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself).
90
122
* @note The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation.
95
127
* @param tileh_new Slope after terraforming.
96
128
* @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
98
typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new);
130
typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new);
133
* Set of callback functions for performing tile operations of a given tile type.
100
135
struct TileTypeProcs {
101
DrawTileProc *draw_tile_proc;
136
DrawTileProc *draw_tile_proc; ///< Called to render the tile and its contents to the screen
102
137
GetSlopeZProc *get_slope_z_proc;
103
138
ClearTileProc *clear_tile_proc;
104
GetAcceptedCargoProc *get_accepted_cargo_proc;
105
GetTileDescProc *get_tile_desc_proc;
106
GetTileTrackStatusProc *get_tile_track_status_proc;
107
ClickTileProc *click_tile_proc;
139
GetAcceptedCargoProc *get_accepted_cargo_proc; ///< Return accepted cargo of the tile
140
GetTileDescProc *get_tile_desc_proc; ///< Get a description of a tile (for the 'land area information' tool)
141
GetTileTrackStatusProc *get_tile_track_status_proc; ///< Get available tracks and status of a tile
142
ClickTileProc *click_tile_proc; ///< Called when tile is clicked
108
143
AnimateTileProc *animate_tile_proc;
109
144
TileLoopProc *tile_loop_proc;
110
145
ChangeTileOwnerProc *change_tile_owner_proc;
111
GetProducedCargoProc *get_produced_cargo_proc;
112
VehicleEnterTileProc *vehicle_enter_tile_proc;
146
GetProducedCargoProc *get_produced_cargo_proc; ///< Return produced cargo of the tile
147
VehicleEnterTileProc *vehicle_enter_tile_proc; ///< Called when a vehicle enters a tile
113
148
GetFoundationProc *get_foundation_proc;
114
TerraformTileProc *terraform_tile_proc;
149
TerraformTileProc *terraform_tile_proc; ///< Called when a terraforming operation is about to take place
117
152
extern const TileTypeProcs * const _tile_type_procs[16];
119
154
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
155
VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y);
120
156
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
121
void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
157
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner);
122
158
void AnimateTile(TileIndex tile);
123
void ClickTile(TileIndex tile);
159
bool ClickTile(TileIndex tile);
124
160
void GetTileDesc(TileIndex tile, TileDesc *td);
126
162
#endif /* TILE_CMD_H */