src/tile_cmd.h
branchnoai
changeset 9732 f8eb3e208514
parent 9724 b39bc69bb2f2
child 10455 22c441f5adf9
--- a/src/tile_cmd.h	Thu Feb 21 22:34:54 2008 +0000
+++ b/src/tile_cmd.h	Fri Feb 22 00:25:54 2008 +0000
@@ -13,6 +13,8 @@
 #include "strings_type.h"
 #include "date_type.h"
 #include "player_type.h"
+#include "direction_type.h"
+#include "track_type.h"
 
 /** The returned bits of VehicleEnterTile. */
 enum VehicleEnterTileStatus {
@@ -59,29 +61,17 @@
 
 /**
  * GetTileTrackStatusProcs return a value that contains the possible tracks
- * that can be taken on a given tile by a given transport. The return value is
- * composed as follows: 0xaabbccdd. ccdd and aabb are bitmasks of trackdirs,
- * where bit n corresponds to trackdir n. ccdd are the trackdirs that are
- * present in the tile (1==present, 0==not present), aabb is the signal
- * status, if applicable (0==green/no signal, 1==red, note that this is
- * reversed from map3/2[tile] for railway signals).
+ * that can be taken on a given tile by a given transport.
+ * The return value contains the existing trackdirs and signal states.
  *
- * The result (let's call it ts) is often used as follows:
- * tracks = (byte)(ts | ts >>8)
- * This effectively converts the present part of the result (ccdd) to a
- * track bitmask, which disregards directions. Normally, this is the same as just
- * doing (byte)ts I think, although I am not really sure
+ * see track_func.h for usage of TrackStatus.
  *
- * A trackdir is combination of a track and a dir, where the lower three bits
- * are a track, the fourth bit is the direction. these give 12 (or 14)
- * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask
- * above.
  * @param tile     the tile to get the track status from
  * @param mode     the mode of transportation
  * @param sub_mode used to differentiate between different kinds within the mode
- * @return the above mentions track status information
+ * @return the track status information
  */
-typedef uint32 GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode);
+typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side);
 typedef void GetProducedCargoProc(TileIndex tile, CargoID *b);
 typedef void ClickTileProc(TileIndex tile);
 typedef void AnimateTileProc(TileIndex tile);
@@ -126,7 +116,7 @@
 
 extern const TileTypeProcs * const _tile_type_procs[16];
 
-uint32 GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode);
+TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
 void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
 void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
 void AnimateTile(TileIndex tile);