(svn r16662) -Codechange: replace GetRoadStopByTile() by RoadStop::GetByTile()

This commit is contained in:
smatz
2009-06-26 10:45:20 +00:00
parent f2e55319dd
commit 90554ee390
4 changed files with 28 additions and 19 deletions

View File

@@ -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();