(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

@@ -4,16 +4,15 @@
#include "stdafx.h"
#include "station_base.h"
#include "oldpool_func.h"
#include "core/pool_func.hpp"
/* Initialize the cargopacket-pool */
DEFINE_OLD_POOL_GENERIC(CargoPacket, CargoPacket)
CargoPacketPool _cargopacket_pool("CargoPacket");
INSTANTIATE_POOL_METHODS(CargoPacket)
void InitializeCargoPackets()
{
/* Clean the cargo packet pool and create 1 block in it */
_CargoPacket_pool.CleanPool();
_CargoPacket_pool.AddBlockToPool();
_cargopacket_pool.CleanPool();
}
CargoPacket::CargoPacket(StationID source, uint16 count)
@@ -30,11 +29,6 @@ CargoPacket::CargoPacket(StationID source, uint16 count)
this->paid_for = false;
}
CargoPacket::~CargoPacket()
{
this->count = 0;
}
bool CargoPacket::SameSource(const CargoPacket *cp) const
{
return this->source_xy == cp->source_xy && this->days_in_transit == cp->days_in_transit && this->paid_for == cp->paid_for;
@@ -104,7 +98,6 @@ uint CargoList::DaysInTransit() const
void CargoList::Append(CargoPacket *cp)
{
assert(cp != NULL);
assert(cp->IsValid());
for (List::iterator it = packets.begin(); it != packets.end(); it++) {
if ((*it)->SameSource(cp) && (*it)->count + cp->count <= 65535) {