src/rail.h
changeset 8634 5ffca02f9115
parent 8619 c2434269c3eb
child 8665 758b79eb2bdc
equal deleted inserted replaced
8633:3e7dd482e9cc 8634:5ffca02f9115
    10 #include "vehicle_type.h"
    10 #include "vehicle_type.h"
    11 #include "gfx_type.h"
    11 #include "gfx_type.h"
    12 #include "core/bitmath_func.hpp"
    12 #include "core/bitmath_func.hpp"
    13 #include "economy_func.h"
    13 #include "economy_func.h"
    14 #include "variables.h"
    14 #include "variables.h"
       
    15 #include "tile_cmd.h"
    15 
    16 
    16 /** This struct contains all the info that is needed to draw and construct tracks.
    17 /** This struct contains all the info that is needed to draw and construct tracks.
    17  */
    18  */
    18 struct RailtypeInfo {
    19 struct RailtypeInfo {
    19 	/** Struct containing the main sprites. @note not all sprites are listed, but only
    20 	/** Struct containing the main sprites. @note not all sprites are listed, but only
    95 enum {
    96 enum {
    96 	NUM_SSD_ENTRY = 256, ///< max amount of blocks
    97 	NUM_SSD_ENTRY = 256, ///< max amount of blocks
    97 	NUM_SSD_STACK =  32, ///< max amount of blocks to check recursively
    98 	NUM_SSD_STACK =  32, ///< max amount of blocks to check recursively
    98 };
    99 };
    99 
   100 
   100 /*
       
   101  * Functions to map tracks to the corresponding bits in the signal
       
   102  * presence/status bytes in the map. You should not use these directly, but
       
   103  * wrapper functions below instead. XXX: Which are these?
       
   104  */
       
   105 
       
   106 /**
       
   107  * Maps a trackdir to the bit that stores its status in the map arrays, in the
       
   108  * direction along with the trackdir.
       
   109  */
       
   110 static inline byte SignalAlongTrackdir(Trackdir trackdir)
       
   111 {
       
   112 	extern const byte _signal_along_trackdir[TRACKDIR_END];
       
   113 	return _signal_along_trackdir[trackdir];
       
   114 }
       
   115 
       
   116 /**
       
   117  * Maps a trackdir to the bit that stores its status in the map arrays, in the
       
   118  * direction against the trackdir.
       
   119  */
       
   120 static inline byte SignalAgainstTrackdir(Trackdir trackdir)
       
   121 {
       
   122 	extern const byte _signal_against_trackdir[TRACKDIR_END];
       
   123 	return _signal_against_trackdir[trackdir];
       
   124 }
       
   125 
       
   126 /**
       
   127  * Maps a Track to the bits that store the status of the two signals that can
       
   128  * be present on the given track.
       
   129  */
       
   130 static inline byte SignalOnTrack(Track track)
       
   131 {
       
   132 	extern const byte _signal_on_track[TRACK_END];
       
   133 	return _signal_on_track[track];
       
   134 }
       
   135 
       
   136 
   101 
   137 
   102 
   138 /**
   103 /**
   139  * Returns a pointer to the Railtype information for a given railtype
   104  * Returns a pointer to the Railtype information for a given railtype
   140  * @param railtype the rail type which the information is requested for
   105  * @param railtype the rail type which the information is requested for