summaryrefslogtreecommitdiff
path: root/src/newgrf_storage.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-22 13:56:38 +0000
committerrubidium <rubidium@openttd.org>2007-09-22 13:56:38 +0000
commit60f1eb21fa31d64c9b2651a09193a62472174a20 (patch)
tree1f92395e697eada656f8d47222f9f227028ec271 /src/newgrf_storage.h
parentc68c83dffa2edbf854935effedeac0c4697d5db7 (diff)
downloadopenttd-60f1eb21fa31d64c9b2651a09193a62472174a20.tar.xz
(svn r11139) -Codechange: add support for persistent storage for NewGRFs.
Diffstat (limited to 'src/newgrf_storage.h')
-rw-r--r--src/newgrf_storage.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h
index 93aab09dc..cf7690a92 100644
--- a/src/newgrf_storage.h
+++ b/src/newgrf_storage.h
@@ -21,7 +21,14 @@ struct BaseStorageArray
* - reverting to the previous version
* @param keep_changes do we save or revert the changes since the last ClearChanges?
*/
- virtual void ClearChanges(bool keep_changes) {}
+ virtual void ClearChanges(bool keep_changes) = 0;
+
+ /**
+ * 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, uint32 value) = 0;
};
/**
@@ -54,7 +61,7 @@ struct PersistentStorageArray : BaseStorageArray {
* @param pos the position to write at
* @param value the value to write
*/
- void Store(uint pos, TYPE value)
+ void Store(uint pos, uint32 value)
{
/* Out of the scope of the array */
if (pos >= SIZE) return;
@@ -83,7 +90,7 @@ struct PersistentStorageArray : BaseStorageArray {
* @param pos the position to get the data from
* @return the data from that position
*/
- TYPE Get(uint pos)
+ TYPE Get(uint pos) const
{
/* Out of the scope of the array */
if (pos >= SIZE) return 0;
@@ -124,7 +131,7 @@ struct TemporaryStorageArray : BaseStorageArray {
* @param pos the position to write at
* @param value the value to write
*/
- void Store(uint pos, TYPE value)
+ void Store(uint pos, uint32 value)
{
/* Out of the scope of the array */
if (pos >= SIZE) return;
@@ -138,7 +145,7 @@ struct TemporaryStorageArray : BaseStorageArray {
* @param pos the position to get the data from
* @return the data from that position
*/
- TYPE Get(uint pos)
+ TYPE Get(uint pos) const
{
/* Out of the scope of the array */
if (pos >= SIZE) return 0;