(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved

This commit is contained in:
smatz
2009-05-22 15:13:50 +00:00
parent 04723b240e
commit 62a7948af0
69 changed files with 834 additions and 995 deletions

View File

@@ -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;
};