changeset 13214:835409aa5da2 draft

(svn r17721) -Codechange: replace a magic number with a constant
author rubidium <rubidium@openttd.org>
date Tue, 06 Oct 2009 17:28:06 +0000
parents cbc7f8fe50ee
children 5065fbe3e545
files src/cargopacket.cpp src/cargopacket.h
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cargopacket.cpp
+++ b/src/cargopacket.cpp
@@ -92,7 +92,7 @@
 	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;
--- a/src/cargopacket.h
+++ b/src/cargopacket.h
@@ -45,6 +45,8 @@
 	/** 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