summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-01 23:49:06 +0000
committerrubidium <rubidium@openttd.org>2007-08-01 23:49:06 +0000
commitaa78685c99dc1cd2fe28a05ba55eb719e12f4029 (patch)
treea6179b4654ee8bc1cf111be24063de2f08787322 /src/station_cmd.cpp
parent4e96ce3dfea13ffab951a93061e35423e0b321e5 (diff)
downloadopenttd-aa78685c99dc1cd2fe28a05ba55eb719e12f4029.tar.xz
(svn r10745) -Codechange: generalize the pool cleanup/initialize functions for stations (in such a manner that they can be used for other pools too).
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp35
1 files changed, 2 insertions, 33 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 160435772..b5ca877f1 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -43,39 +43,8 @@
#include "cargotype.h"
#include "strings.h"
-/**
- * Called if a new block is added to the station-pool
- */
-static void StationPoolNewBlock(uint start_item)
-{
- /* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
- * TODO - This is just a temporary stage, this will be removed. */
- for (Station *st = GetStation(start_item); st != NULL; st = (st->index + 1U < GetStationPoolSize()) ? GetStation(st->index + 1U) : NULL) st->index = start_item++;
-}
-
-static void StationPoolCleanBlock(uint start_item, uint end_item)
-{
- for (uint i = start_item; i <= end_item; i++) {
- Station *st = GetStation(i);
- if (st->IsValid()) st->~Station();
- }
-}
-
-/**
- * Called if a new block is added to the roadstop-pool
- */
-static void RoadStopPoolNewBlock(uint start_item)
-{
- /* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
- * TODO - This is just a temporary stage, this will be removed. */
- for (RoadStop *rs = GetRoadStop(start_item); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) {
- rs->xy = INVALID_TILE;
- rs->index = start_item++;
- }
-}
-
-DEFINE_OLD_POOL(Station, Station, StationPoolNewBlock, StationPoolCleanBlock)
-DEFINE_OLD_POOL(RoadStop, RoadStop, RoadStopPoolNewBlock, NULL)
+DEFINE_OLD_POOL_GENERIC(Station, Station)
+DEFINE_OLD_POOL_GENERIC(RoadStop, RoadStop)
/**