summaryrefslogtreecommitdiff
path: root/src/tile_cmd.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-02-20 17:49:50 +0000
committerfrosch <frosch@openttd.org>2008-02-20 17:49:50 +0000
commitb7993793c813359ba4963df93d49a80335ddca36 (patch)
treed325400c42801ac23226ccaf0d71008e4e3598ec /src/tile_cmd.h
parent9e651575481dbdd4b587fe22e2d79b998bcbbe15 (diff)
downloadopenttd-b7993793c813359ba4963df93d49a80335ddca36.tar.xz
(svn r12199) -Codechange: Remove magic around the results of GetTileTrackStatus().
Diffstat (limited to 'src/tile_cmd.h')
-rw-r--r--src/tile_cmd.h25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/tile_cmd.h b/src/tile_cmd.h
index 92c9fe06c..0ad4d1fe3 100644
--- a/src/tile_cmd.h
+++ b/src/tile_cmd.h
@@ -14,6 +14,7 @@
#include "date_type.h"
#include "player_type.h"
#include "direction_type.h"
+#include "track_type.h"
/** The returned bits of VehicleEnterTile. */
enum VehicleEnterTileStatus {
@@ -60,29 +61,17 @@ typedef void GetTileDescProc(TileIndex tile, TileDesc *td);
/**
* 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, DiagDirection side);
+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);
@@ -127,7 +116,7 @@ struct TileTypeProcs {
extern const TileTypeProcs * const _tile_type_procs[16];
-uint32 GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side = INVALID_DIAGDIR);
+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);