summaryrefslogtreecommitdiff
path: root/src/station_base.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-22 15:13:50 +0000
committersmatz <smatz@openttd.org>2009-05-22 15:13:50 +0000
commit62a7948af0ca9eb3b190a54918201e1075edcbbc (patch)
tree27a79b7850682cd43cac2462c3410ed8b567c4b2 /src/station_base.h
parent04723b240ebc7384954f73590be517ad2a47ce04 (diff)
downloadopenttd-62a7948af0ca9eb3b190a54918201e1075edcbbc.tar.xz
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
Diffstat (limited to 'src/station_base.h')
-rw-r--r--src/station_base.h28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/station_base.h b/src/station_base.h
index 218f1aa9e..1b580db2b 100644
--- a/src/station_base.h
+++ b/src/station_base.h
@@ -7,7 +7,7 @@
#include "station_type.h"
#include "airport.h"
-#include "oldpool.h"
+#include "core/pool.hpp"
#include "cargopacket.h"
#include "cargo_type.h"
#include "town_type.h"
@@ -20,8 +20,10 @@
#include "viewport_type.h"
#include <list>
-DECLARE_OLD_POOL(Station, Station, 6, 1000)
-DECLARE_OLD_POOL(RoadStop, RoadStop, 5, 2000)
+typedef Pool<Station, StationID, 32, 64000> StationPool;
+typedef Pool<RoadStop, RoadStopID, 32, 64000> RoadStopPool;
+extern StationPool _station_pool;
+extern RoadStopPool _roadstop_pool;
static const byte INITIAL_STATION_RATING = 175;
@@ -48,7 +50,7 @@ struct GoodsEntry {
};
/** A Stop for a Road Vehicle */
-struct RoadStop : PoolItem<RoadStop, RoadStopID, &_RoadStop_pool> {
+struct RoadStop : RoadStopPool::PoolItem<&_roadstop_pool> {
static const int cDebugCtorLevel = 5; ///< Debug level on which Contructor / Destructor messages are printed
static const uint LIMIT = 16; ///< The maximum amount of roadstops that are allowed at a single station
static const uint MAX_BAY_COUNT = 2; ///< The maximum number of loading bays
@@ -60,13 +62,7 @@ struct RoadStop : PoolItem<RoadStop, RoadStopID, &_RoadStop_pool> {
struct RoadStop *next; ///< Next stop of the given type at this station
RoadStop(TileIndex tile = INVALID_TILE);
- virtual ~RoadStop();
-
- /**
- * Determines whether a road stop exists
- * @return true if and only is the road stop exists
- */
- inline bool IsValid() const { return this->xy != INVALID_TILE; }
+ ~RoadStop();
/* For accessing status */
bool HasFreeBay() const;
@@ -110,7 +106,7 @@ struct StationRect : public Rect {
};
/** Station data structure */
-struct Station : PoolItem<Station, StationID, &_Station_pool> {
+struct Station : StationPool::PoolItem<&_station_pool> {
public:
RoadStop *GetPrimaryRoadStop(RoadStopType type) const
{
@@ -173,7 +169,7 @@ public:
static const int cDebugCtorLevel = 5;
Station(TileIndex tile = INVALID_TILE);
- virtual ~Station();
+ ~Station();
void AddFacility(byte new_facility_bit, TileIndex facil_xy);
@@ -195,12 +191,6 @@ public:
uint GetPlatformLength(TileIndex tile) const;
bool IsBuoy() const;
- /**
- * Determines whether a station exists
- * @return true if and only is the station exists
- */
- inline bool IsValid() const { return this->xy != INVALID_TILE; }
-
uint GetCatchmentRadius() const;
};