diff options
author | smatz <smatz@openttd.org> | 2009-06-26 10:45:20 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-06-26 10:45:20 +0000 |
commit | 90554ee39091c98cb89b0c9a90b529564a82ff38 (patch) | |
tree | e599b70959074506c19535ce47a5a9d978f39507 /src/roadstop.cpp | |
parent | f2e55319dd165f57e008e0fac355ce294fc98905 (diff) | |
download | openttd-90554ee39091c98cb89b0c9a90b529564a82ff38.tar.xz |
(svn r16662) -Codechange: replace GetRoadStopByTile() by RoadStop::GetByTile()
Diffstat (limited to 'src/roadstop.cpp')
-rw-r--r-- | src/roadstop.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/roadstop.cpp b/src/roadstop.cpp index eda4daa94..5082ee429 100644 --- a/src/roadstop.cpp +++ b/src/roadstop.cpp @@ -7,6 +7,7 @@ #include "station_map.h" #include "core/pool_func.hpp" #include "roadstop_base.h" +#include "station_base.h" RoadStopPool _roadstop_pool("RoadStop"); INSTANTIATE_POOL_METHODS(RoadStop) @@ -48,6 +49,23 @@ RoadStop *RoadStop::GetNextRoadStop(const RoadVehicle *v) const return NULL; } +/** + * Find a roadstop at given tile + * @param tile tile with roadstop + * @param type roadstop type + * @return pointer to RoadStop + * @pre there has to be roadstop of given type there! + */ +/* static */ RoadStop *RoadStop::GetByTile(TileIndex tile, RoadStopType type) +{ + const Station *st = Station::GetByTile(tile); + + for (RoadStop *rs = st->GetPrimaryRoadStop(type);; rs = rs->next) { + if (rs->xy == tile) return rs; + assert(rs->next != NULL); + } +} + void InitializeRoadStops() { _roadstop_pool.CleanPool(); |