diff options
author | rubidium <rubidium@openttd.org> | 2009-10-21 19:42:49 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-10-21 19:42:49 +0000 |
commit | 547677a782f38346e80f3258c26c128f781c4d33 (patch) | |
tree | f3c5d51ef2f401391e47485af8ade5e974042eca /src/cargopacket.cpp | |
parent | 1528b64a68f3144b9b321efefb22800a52e64dd4 (diff) | |
download | openttd-547677a782f38346e80f3258c26c128f781c4d33.tar.xz |
(svn r17840) -Codechange: use the new pool's concepts (caching + not zeroing). Improves average CargoPacket con/destruction time by ~20%, MoveTo/Append by 5-10% and application performance by up to 2%.
Diffstat (limited to 'src/cargopacket.cpp')
-rw-r--r-- | src/cargopacket.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index f2614c9b7..2360b87cf 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -32,11 +32,16 @@ CargoPacket::CargoPacket() this->source_id = INVALID_SOURCE; } +/* NOTE: We have to zero memory ourselves here because we are using a 'new' + * that, in contrary to all other pools, does not memset to 0. */ CargoPacket::CargoPacket(StationID source, TileIndex source_xy, uint16 count, SourceType source_type, SourceID source_id) : + feeder_share(0), count(count), + days_in_transit(0), source_id(source_id), source(source), - source_xy(source_xy) + source_xy(source_xy), + loaded_at_xy(0) { assert(count != 0); this->source_type = source_type; |