Changeset - r13204:037e2fceda8f
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2009-10-06 17:28:06
rubidium@openttd.org
(svn r17721) -Codechange: replace a magic number with a constant
2 files changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/cargopacket.cpp
Show inline comments
 
@@ -89,13 +89,13 @@ void CargoList::AgeCargo()
 

	
 
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;
 

	
 
			InvalidateCache();
 
			return;
src/cargopacket.h
Show inline comments
 
@@ -42,12 +42,14 @@ private:
 

	
 
	/** The CargoList caches, thus needs to know about it. */
 
	friend class CargoList;
 
	/** 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
 
	StationID source;           ///< The station where the cargo came from first
 
	SourceTypeByte source_type; ///< Type of #source_id
 
	SourceID source_id;         ///< Index of source, INVALID_SOURCE if unknown/invalid
0 comments (0 inline, 0 general)