File diff r17768:a8b4e13e2113 → r17769:40a7de7cde1c
src/newgrf_storage.h
Show inline comments
 
@@ -33,13 +33,13 @@ struct BaseStorageArray
 

	
 
	/**
 
	 * Stores some value at a given position.
 
	 * @param pos   the position to write at
 
	 * @param value the value to write
 
	 */
 
	virtual void Store(uint pos, int32 value) = 0;
 
	virtual void StoreValue(uint pos, int32 value) = 0;
 
};
 

	
 
/**
 
 * Class for persistent storage of data.
 
 * On ClearChanges that data is either reverted or saved.
 
 * @param TYPE the type of variable to store.
 
@@ -72,13 +72,13 @@ struct PersistentStorageArray : BaseStor
 
	 * Stores some value at a given position.
 
	 * If there is no backup of the data that backup is made and then
 
	 * we write the data.
 
	 * @param pos   the position to write at
 
	 * @param value the value to write
 
	 */
 
	void Store(uint pos, int32 value)
 
	void StoreValue(uint pos, int32 value)
 
	{
 
		/* Out of the scope of the array */
 
		if (pos >= SIZE) return;
 

	
 
		/* The value hasn't changed, so we pretend nothing happened.
 
		 * Saves a few cycles and such and it's pretty easy to check. */
 
@@ -99,13 +99,13 @@ struct PersistentStorageArray : BaseStor
 

	
 
	/**
 
	 * Gets the value from a given position.
 
	 * @param pos the position to get the data from
 
	 * @return the data from that position
 
	 */
 
	TYPE Get(uint pos) const
 
	TYPE GetValue(uint pos) const
 
	{
 
		/* Out of the scope of the array */
 
		if (pos >= SIZE) return 0;
 

	
 
		return this->storage[pos];
 
	}
 
@@ -144,13 +144,13 @@ struct TemporaryStorageArray : BaseStora
 

	
 
	/**
 
	 * Stores some value at a given position.
 
	 * @param pos   the position to write at
 
	 * @param value the value to write
 
	 */
 
	void Store(uint pos, int32 value)
 
	void StoreValue(uint pos, int32 value)
 
	{
 
		/* Out of the scope of the array */
 
		if (pos >= SIZE) return;
 

	
 
		this->storage[pos] = value;
 
		AddChangedStorage(this);
 
@@ -158,13 +158,13 @@ struct TemporaryStorageArray : BaseStora
 

	
 
	/**
 
	 * Gets the value from a given position.
 
	 * @param pos the position to get the data from
 
	 * @return the data from that position
 
	 */
 
	TYPE Get(uint pos) const
 
	TYPE GetValue(uint pos) const
 
	{
 
		/* Out of the scope of the array */
 
		if (pos >= SIZE) return 0;
 

	
 
		return this->storage[pos];
 
	}