src/station.h
changeset 5835 7ef65a4a70ef
parent 5721 fa4e587f59f5
child 5836 a60d2114780e
equal deleted inserted replaced
5834:179dee122583 5835:7ef65a4a70ef
    62 
    62 
    63 	/* For loading games */
    63 	/* For loading games */
    64 	void *operator new (size_t size, int index);
    64 	void *operator new (size_t size, int index);
    65 	void operator delete(void *rs, int index);
    65 	void operator delete(void *rs, int index);
    66 
    66 
       
    67 	bool IsValid() const;
       
    68 protected:
    67 	static RoadStop *AllocateRaw(void);
    69 	static RoadStop *AllocateRaw(void);
    68 } RoadStop;
    70 } RoadStop;
    69 
    71 
    70 typedef struct StationSpecList {
    72 typedef struct StationSpecList {
    71 	const StationSpec *spec;
    73 	const StationSpec *spec;
   251 
   253 
   252 /* Stuff for ROADSTOPS */
   254 /* Stuff for ROADSTOPS */
   253 
   255 
   254 DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
   256 DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
   255 
   257 
   256 /**
   258 #define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (rs->IsValid())
   257  * Check if a RaodStop really exists.
       
   258  */
       
   259 static inline bool IsValidRoadStop(const RoadStop *rs)
       
   260 {
       
   261 	return rs->xy != INVALID_TILE;
       
   262 }
       
   263 
       
   264 #define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) if (IsValidRoadStop(rs))
       
   265 #define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0)
   259 #define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0)
   266 
   260 
   267 /* End of stuff for ROADSTOPS */
   261 /* End of stuff for ROADSTOPS */
   268 
   262 
   269 
   263