(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

@@ -5,7 +5,7 @@
#ifndef CARGOPACKET_H
#define CARGOPACKET_H
#include "oldpool.h"
#include "core/pool.hpp"
#include "economy_type.h"
#include "tile_type.h"
#include "station_type.h"
@@ -15,13 +15,13 @@ typedef uint32 CargoPacketID;
struct CargoPacket;
/** We want to use a pool */
DECLARE_OLD_POOL(CargoPacket, CargoPacket, 10, 1000)
typedef Pool<CargoPacket, CargoPacketID, 1024, 1048576> CargoPacketPool;
extern CargoPacketPool _cargopacket_pool;
/**
* Container for cargo from the same location and time
*/
struct CargoPacket : PoolItem<CargoPacket, CargoPacketID, &_CargoPacket_pool> {
struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> {
Money feeder_share; ///< Value of feeder pickup to be paid for on delivery of cargo
TileIndex source_xy; ///< The origin of the cargo (first station in feeder chain)
TileIndex loaded_at_xy; ///< Location where this cargo has been loaded into the vehicle
@@ -40,14 +40,7 @@ struct CargoPacket : PoolItem<CargoPacket, CargoPacketID, &_CargoPacket_pool> {
CargoPacket(StationID source = INVALID_STATION, uint16 count = 0);
/** Destroy the packet */
virtual ~CargoPacket();
/**
* Is this a valid cargo packet ?
* @return true if and only it is valid
*/
inline bool IsValid() const { return this->count != 0; }
~CargoPacket() { }
/**
* Checks whether the cargo packet is from (exactly) the same source