equal
deleted
inserted
replaced
179 #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) |
179 #define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0) |
180 |
180 |
181 |
181 |
182 /* Stuff for ROADSTOPS */ |
182 /* Stuff for ROADSTOPS */ |
183 |
183 |
184 extern MemoryPool _roadstop_pool; |
184 DECLARE_POOL(RoadStop, RoadStop, 5, 2000) |
185 |
|
186 /** |
|
187 * Get the pointer to the roadstop with index 'index' |
|
188 */ |
|
189 static inline RoadStop *GetRoadStop(uint index) |
|
190 { |
|
191 return (RoadStop*)GetItemFromPool(&_roadstop_pool, index); |
|
192 } |
|
193 |
|
194 /** |
|
195 * Get the current size of the RoadStoptPool |
|
196 */ |
|
197 static inline uint16 GetRoadStopPoolSize(void) |
|
198 { |
|
199 return _roadstop_pool.total_items; |
|
200 } |
|
201 |
185 |
202 /** |
186 /** |
203 * Check if a RaodStop really exists. |
187 * Check if a RaodStop really exists. |
204 */ |
188 */ |
205 static inline bool IsValidRoadStop(const RoadStop *rs) |
189 static inline bool IsValidRoadStop(const RoadStop *rs) |
213 { |
197 { |
214 DestroyRoadStop(rs); |
198 DestroyRoadStop(rs); |
215 rs->used = false; |
199 rs->used = false; |
216 } |
200 } |
217 |
201 |
218 #define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1 < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1) : NULL) if (IsValidRoadStop(rs)) |
202 #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)) |
219 #define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0) |
203 #define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0) |
220 |
204 |
221 /* End of stuff for ROADSTOPS */ |
205 /* End of stuff for ROADSTOPS */ |
222 |
206 |
223 |
207 |