Functionality related to the temporary and persistent storage arrays for NewGRFs. More...
#include "stdafx.h"
#include "newgrf_storage.h"
#include <set>
Go to the source code of this file.
Functions | |
void | AddChangedStorage (BaseStorageArray *storage) |
Add the changed storage array to the list of changed arrays. | |
void | ClearStorageChanges (bool keep_changes) |
Clear the changes made since the last ClearStorageChanges. | |
Variables | |
static std::set < BaseStorageArray * > | _changed_storage_arrays |
The changed storage arrays. |
Functionality related to the temporary and persistent storage arrays for NewGRFs.
Definition in file newgrf_storage.cpp.
void AddChangedStorage | ( | BaseStorageArray * | storage | ) |
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.
storage | the array that has changed |
Definition at line 25 of file newgrf_storage.cpp.
References _changed_storage_arrays.
Referenced by TemporaryStorageArray< TYPE, SIZE >::Store(), and PersistentStorageArray< int32, 16 >::Store().
void ClearStorageChanges | ( | bool | keep_changes | ) |
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:
keep_changes | do we save or revert the changes since the last ClearChanges? |
Definition at line 40 of file newgrf_storage.cpp.
References _changed_storage_arrays.
Referenced by _GenerateWorld(), and StateGameLoop().