291 |
240 |
292 struct ViewportSign { |
241 struct ViewportSign { |
293 int32 left; |
242 int32 left; |
294 int32 top; |
243 int32 top; |
295 byte width_1, width_2; |
244 byte width_1, width_2; |
296 }; |
|
297 |
|
298 |
|
299 #include "command_type.h" |
|
300 typedef void DrawTileProc(TileInfo *ti); |
|
301 typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y); |
|
302 typedef CommandCost ClearTileProc(TileIndex tile, byte flags); |
|
303 typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res); |
|
304 typedef void GetTileDescProc(TileIndex tile, TileDesc *td); |
|
305 /** |
|
306 * GetTileTrackStatusProcs return a value that contains the possible tracks |
|
307 * that can be taken on a given tile by a given transport. The return value is |
|
308 * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs, |
|
309 * where bit n corresponds to trackdir n. ccdd are the trackdirs that are |
|
310 * present in the tile (1==present, 0==not present), aabb is the signal |
|
311 * status, if applicable (0==green/no signal, 1==red, note that this is |
|
312 * reversed from map3/2[tile] for railway signals). |
|
313 * |
|
314 * The result (let's call it ts) is often used as follows: |
|
315 * tracks = (byte)(ts | ts >>8) |
|
316 * This effectively converts the present part of the result (ccdd) to a |
|
317 * track bitmask, which disregards directions. Normally, this is the same as just |
|
318 * doing (byte)ts I think, although I am not really sure |
|
319 * |
|
320 * A trackdir is combination of a track and a dir, where the lower three bits |
|
321 * are a track, the fourth bit is the direction. these give 12 (or 14) |
|
322 * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask |
|
323 * above. |
|
324 * @param tile the tile to get the track status from |
|
325 * @param mode the mode of transportation |
|
326 * @param sub_mode used to differentiate between different kinds within the mode |
|
327 * @return the above mentions track status information |
|
328 */ |
|
329 typedef uint32 GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode); |
|
330 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b); |
|
331 typedef void ClickTileProc(TileIndex tile); |
|
332 typedef void AnimateTileProc(TileIndex tile); |
|
333 typedef void TileLoopProc(TileIndex tile); |
|
334 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player); |
|
335 /** @see VehicleEnterTileStatus to see what the return values mean */ |
|
336 typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y); |
|
337 typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh); |
|
338 /** |
|
339 * Called when a tile is affected by a terraforming operation. |
|
340 * The function has to check if terraforming of the tile is allowed and return extra terraform-cost that depend on the tiletype. |
|
341 * With DC_EXEC in flags it has to perform tiletype-specific actions (like clearing land etc., but not the terraforming itself). |
|
342 * |
|
343 * @note The terraforming has not yet taken place. So GetTileZ() and GetTileSlope() refer to the landscape before the terraforming operation. |
|
344 * |
|
345 * @param tile The involved tile. |
|
346 * @param flags Command flags passed to the terraform command (DC_EXEC, DC_QUERY_COST, etc.). |
|
347 * @param z_new TileZ after terraforming. |
|
348 * @param tileh_new Slope after terraforming. |
|
349 * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.) |
|
350 */ |
|
351 typedef CommandCost TerraformTileProc(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new); |
|
352 |
|
353 struct TileTypeProcs { |
|
354 DrawTileProc *draw_tile_proc; |
|
355 GetSlopeZProc *get_slope_z_proc; |
|
356 ClearTileProc *clear_tile_proc; |
|
357 GetAcceptedCargoProc *get_accepted_cargo_proc; |
|
358 GetTileDescProc *get_tile_desc_proc; |
|
359 GetTileTrackStatusProc *get_tile_track_status_proc; |
|
360 ClickTileProc *click_tile_proc; |
|
361 AnimateTileProc *animate_tile_proc; |
|
362 TileLoopProc *tile_loop_proc; |
|
363 ChangeTileOwnerProc *change_tile_owner_proc; |
|
364 GetProducedCargoProc *get_produced_cargo_proc; |
|
365 VehicleEnterTileProc *vehicle_enter_tile_proc; |
|
366 GetFoundationProc *get_foundation_proc; |
|
367 TerraformTileProc *terraform_tile_proc; |
|
368 }; |
245 }; |
369 |
246 |
370 typedef void PlaceProc(TileIndex tile); |
247 typedef void PlaceProc(TileIndex tile); |
371 |
248 |
372 enum { |
249 enum { |