(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions

This commit is contained in:
tron
2006-03-17 06:26:37 +00:00
parent 0e3699bd5c
commit 4fb11f23ad
4 changed files with 25 additions and 27 deletions

23
rail.h
View File

@@ -42,15 +42,6 @@ typedef enum RailTileSubtypes {
RAIL_SUBTYPE_MASK = 0x3C,
} RailTileSubtype;
typedef enum SignalTypes {
/* Stored in m4[0..1] for MP_RAILWAY */
SIGTYPE_NORMAL = 0, // normal signal
SIGTYPE_ENTRY = 1, // presignal block entry
SIGTYPE_EXIT = 2, // presignal block exit
SIGTYPE_COMBO = 3, // presignal inter-block
SIGTYPE_END,
SIGTYPE_MASK = 3,
} SignalType;
typedef enum RailTypes {
RAILTYPE_RAIL = 0,
@@ -514,20 +505,6 @@ static inline SignalState GetSignalState(TileIndex tile, Trackdir trackdir)
SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
}
/**
* Gets the type of signal on a given track on a given rail tile with signals.
*
* Note that currently, the track argument is not used, since
* signal types cannot be mixed. This function is trying to be
* future-compatible, though.
*/
static inline SignalType GetSignalType(TileIndex tile, Track track)
{
assert(IsValidTrack(track));
assert(GetRailTileType(tile) == RAIL_TYPE_SIGNALS);
return (SignalType)(_m[tile].m4 & SIGTYPE_MASK);
}
/**
* Return the rail type of tile, or INVALID_RAILTYPE if this is no rail tile.