summaryrefslogtreecommitdiff
path: root/src/cargopacket.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/cargopacket.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/cargopacket.h')
-rw-r--r--src/cargopacket.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/cargopacket.h b/src/cargopacket.h
index 739e7f3ed..26b38342c 100644
--- a/src/cargopacket.h
+++ b/src/cargopacket.h
@@ -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