File diff r18781:e1de9a06f7cd → r18782:6453522c2154
src/cargotype.h
Show inline comments
 
@@ -82,42 +82,42 @@ struct CargoSpec {
 
	Money current_payment;
 

	
 
	/**
 
	 * Determines index of this cargospec
 
	 * @return index (in the CargoSpec::array array)
 
	 */
 
	FORCEINLINE CargoID Index() const
 
	inline CargoID Index() const
 
	{
 
		return this - CargoSpec::array;
 
	}
 

	
 
	/**
 
	 * Tests for validity of this cargospec
 
	 * @return is this cargospec valid?
 
	 * @note assert(cs->IsValid()) can be triggered when GRF config is modified
 
	 */
 
	FORCEINLINE bool IsValid() const
 
	inline bool IsValid() const
 
	{
 
		return this->bitnum != INVALID_CARGO;
 
	}
 

	
 
	/**
 
	 * Total number of cargospecs, both valid and invalid
 
	 * @return length of CargoSpec::array
 
	 */
 
	static FORCEINLINE size_t GetArraySize()
 
	static inline size_t GetArraySize()
 
	{
 
		return lengthof(CargoSpec::array);
 
	}
 

	
 
	/**
 
	 * Retrieve cargo details for the given cargo ID
 
	 * @param index ID of cargo
 
	 * @pre index is a valid cargo ID
 
	 */
 
	static FORCEINLINE CargoSpec *Get(size_t index)
 
	static inline CargoSpec *Get(size_t index)
 
	{
 
		assert(index < lengthof(CargoSpec::array));
 
		return &CargoSpec::array[index];
 
	}
 

	
 
	SpriteID GetCargoIcon() const;