summaryrefslogtreecommitdiff
path: root/src/newgrf_storage.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-22 09:53:15 +0000
committerrubidium <rubidium@openttd.org>2011-01-22 09:53:15 +0000
commiteb299736c1bcb277da1862afe95c11cb897effcf (patch)
tree3bb6bff78f066da770a367e078c569dbe8ce319a /src/newgrf_storage.cpp
parent0cdb1c78cdbfce4d426441c21ef7066f1cfecf6f (diff)
downloadopenttd-eb299736c1bcb277da1862afe95c11cb897effcf.tar.xz
(svn r21886) -Codechange: move documentation towards the code to make it more likely to be updated [n].
Diffstat (limited to 'src/newgrf_storage.cpp')
-rw-r--r--src/newgrf_storage.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/newgrf_storage.cpp b/src/newgrf_storage.cpp
index eea88e4a4..27a806ab1 100644
--- a/src/newgrf_storage.cpp
+++ b/src/newgrf_storage.cpp
@@ -16,11 +16,27 @@
/** The changed storage arrays */
static std::set<BaseStorageArray*> _changed_storage_arrays;
+/**
+ * Add the changed storage array to the list of changed arrays.
+ * This is done so we only have to revert/save the changed
+ * arrays, which saves quite a few clears, etc. after callbacks.
+ * @param storage the array that has changed
+ */
void AddChangedStorage(BaseStorageArray *storage)
{
_changed_storage_arrays.insert(storage);
}
+/**
+ * Clear the changes made since the last ClearStorageChanges.
+ * This is done for *all* storages that have been registered to with
+ * AddChangedStorage since the previous ClearStorageChanges.
+ *
+ * This can be done in two ways:
+ * - saving the changes permanently
+ * - reverting to the previous version
+ * @param keep_changes do we save or revert the changes since the last ClearChanges?
+ */
void ClearStorageChanges(bool keep_changes)
{
/* Loop over all changes arrays */