src/tile_cmd.h
changeset 9112 ec6800eaa340
parent 9092 383a632de666
child 10443 0cbb1eb8cbc7
equal deleted inserted replaced
9111:7f882e1856c2 9112:ec6800eaa340
    12 #include "cargo_type.h"
    12 #include "cargo_type.h"
    13 #include "strings_type.h"
    13 #include "strings_type.h"
    14 #include "date_type.h"
    14 #include "date_type.h"
    15 #include "player_type.h"
    15 #include "player_type.h"
    16 #include "direction_type.h"
    16 #include "direction_type.h"
       
    17 #include "track_type.h"
    17 
    18 
    18 /** The returned bits of VehicleEnterTile. */
    19 /** The returned bits of VehicleEnterTile. */
    19 enum VehicleEnterTileStatus {
    20 enum VehicleEnterTileStatus {
    20 	VETS_ENTERED_STATION  = 1, ///< The vehicle entered a station
    21 	VETS_ENTERED_STATION  = 1, ///< The vehicle entered a station
    21 	VETS_ENTERED_WORMHOLE = 2, ///< The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/tunnel)
    22 	VETS_ENTERED_WORMHOLE = 2, ///< The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/tunnel)
    58 typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
    59 typedef void GetAcceptedCargoProc(TileIndex tile, AcceptedCargo res);
    59 typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
    60 typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
    60 
    61 
    61 /**
    62 /**
    62  * GetTileTrackStatusProcs return a value that contains the possible tracks
    63  * GetTileTrackStatusProcs return a value that contains the possible tracks
    63  * that can be taken on a given tile by a given transport. The return value is
    64  * that can be taken on a given tile by a given transport.
    64  * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs,
    65  * The return value contains the existing trackdirs and signal states.
    65  * where bit n corresponds to trackdir n. ccdd are the trackdirs that are
       
    66  * present in the tile (1==present, 0==not present), aabb is the signal
       
    67  * status, if applicable (0==green/no signal, 1==red, note that this is
       
    68  * reversed from map3/2[tile] for railway signals).
       
    69  *
    66  *
    70  * The result (let's call it ts) is often used as follows:
    67  * see track_func.h for usage of TrackStatus.
    71  * tracks = (byte)(ts | ts >>8)
       
    72  * This effectively converts the present part of the result (ccdd) to a
       
    73  * track bitmask, which disregards directions. Normally, this is the same as just
       
    74  * doing (byte)ts I think, although I am not really sure
       
    75  *
    68  *
    76  * A trackdir is combination of a track and a dir, where the lower three bits
       
    77  * are a track, the fourth bit is the direction. these give 12 (or 14)
       
    78  * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask
       
    79  * above.
       
    80  * @param tile     the tile to get the track status from
    69  * @param tile     the tile to get the track status from
    81  * @param mode     the mode of transportation
    70  * @param mode     the mode of transportation
    82  * @param sub_mode used to differentiate between different kinds within the mode
    71  * @param sub_mode used to differentiate between different kinds within the mode
    83  * @return the above mentions track status information
    72  * @return the track status information
    84  */
    73  */
    85 typedef uint32 GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
    74 typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
    86 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
    75 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
    87 typedef void ClickTileProc(TileIndex tile);
    76 typedef void ClickTileProc(TileIndex tile);
    88 typedef void AnimateTileProc(TileIndex tile);
    77 typedef void AnimateTileProc(TileIndex tile);
    89 typedef void TileLoopProc(TileIndex tile);
    78 typedef void TileLoopProc(TileIndex tile);
    90 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
    79 typedef void ChangeTileOwnerProc(TileIndex tile, PlayerID old_player, PlayerID new_player);
   125 	TerraformTileProc *terraform_tile_proc;
   114 	TerraformTileProc *terraform_tile_proc;
   126 };
   115 };
   127 
   116 
   128 extern const TileTypeProcs * const _tile_type_procs[16];
   117 extern const TileTypeProcs * const _tile_type_procs[16];
   129 
   118 
   130 uint32 GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
   119 TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
   131 void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
   120 void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
   132 void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
   121 void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
   133 void AnimateTile(TileIndex tile);
   122 void AnimateTile(TileIndex tile);
   134 void ClickTile(TileIndex tile);
   123 void ClickTile(TileIndex tile);
   135 void GetTileDesc(TileIndex tile, TileDesc *td);
   124 void GetTileDesc(TileIndex tile, TileDesc *td);