From e0e5eae1eebf7a7b374743bdbc1bdfb49f764e8f Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 6 Oct 2009 17:28:06 +0000 Subject: (svn r17721) -Codechange: replace a magic number with a constant --- src/cargopacket.cpp | 2 +- src/cargopacket.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index 6e08c6f6a..4a3c9691b 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -92,7 +92,7 @@ void CargoList::Append(CargoPacket *cp) assert(cp != NULL); for (List::iterator it = packets.begin(); it != packets.end(); it++) { - if ((*it)->SameSource(cp) && (*it)->count + cp->count <= 65535) { + if ((*it)->SameSource(cp) && (*it)->count + cp->count <= CargoPacket::MAX_COUNT) { (*it)->count += cp->count; (*it)->feeder_share += cp->feeder_share; delete cp; diff --git a/src/cargopacket.h b/src/cargopacket.h index 4d66b0943..8bddaf3d4 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -45,6 +45,8 @@ private: /** We want this to be saved, right? */ friend const struct SaveLoad *GetCargoPacketDesc(); public: + /** Maximum number of items in a single cargo packet. */ + static const uint16 MAX_COUNT = UINT16_MAX; 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 -- cgit v1.2.3-70-g09d2