diff --git a/src/newgrf_storage.cpp b/src/newgrf_storage.cpp new file mode 100644 --- /dev/null +++ b/src/newgrf_storage.cpp @@ -0,0 +1,27 @@ +/* $Id$ */ + +/** @file newgrf_storage.cpp Functionality related to the temporary and persistent storage arrays for NewGRFs. */ + +#include "stdafx.h" +#include "helpers.hpp" +#include "newgrf_storage.h" +#include + +/** The changed storage arrays */ +static std::set _changed_storage_arrays; + +void AddChangedStorage(BaseStorageArray *storage) +{ + _changed_storage_arrays.insert(storage); +} + +void ClearStorageChanges(bool keep_changes) +{ + /* Loop over all changes arrays */ + for (std::set::iterator it = _changed_storage_arrays.begin(); it != _changed_storage_arrays.end(); it++) { + (*it)->ClearChanges(keep_changes); + } + + /* And then clear that array */ + _changed_storage_arrays.clear(); +}