From eca86d1baf5f374d25dcc9bf0ff2bad328bdffab Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 23 Dec 2013 18:09:03 +0000 Subject: (svn r26174) -Codechange: Rename BaseStorageArray to BasePersistentStorageArray --- src/command.cpp | 6 +++--- src/genworld.cpp | 2 +- src/newgrf_storage.cpp | 10 +++++----- src/newgrf_storage.h | 16 ++++++++-------- src/openttd.cpp | 6 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/command.cpp b/src/command.cpp index 2585eda00..fe44dabde 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -597,7 +597,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac * @param cmd the command cost to return. * @param clear whether to keep the storage changes or not. */ -#define return_dcpi(cmd, clear) { _docommand_recursive = 0; ClearStorageChanges(clear); return cmd; } +#define return_dcpi(cmd, clear) { _docommand_recursive = 0; ClearPersistentStorageChanges(clear); return cmd; } /*! * Helper function for the toplevel network safe docommand function for the current company. @@ -661,7 +661,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, /* Test the command. */ _cleared_object_areas.Clear(); SetTownRatingTestMode(true); - ClearStorageChanges(false); + ClearPersistentStorageChanges(false); CommandCost res = proc(tile, flags, p1, p2, text); SetTownRatingTestMode(false); @@ -705,7 +705,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, /* Actually try and execute the command. If no cost-type is given * use the construction one */ _cleared_object_areas.Clear(); - ClearStorageChanges(false); + ClearPersistentStorageChanges(false); CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text); if (cmd_id == CMD_COMPANY_CTRL) { diff --git a/src/genworld.cpp b/src/genworld.cpp index 78fa6e3e7..cb03db062 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -141,7 +141,7 @@ static void _GenerateWorld(void *) } } - ClearStorageChanges(true); + ClearPersistentStorageChanges(true); /* These are probably pointless when inside the scenario editor. */ SetGeneratingWorldProgress(GWP_GAME_INIT, 3); diff --git a/src/newgrf_storage.cpp b/src/newgrf_storage.cpp index ac91a122f..0c6ea9fcd 100644 --- a/src/newgrf_storage.cpp +++ b/src/newgrf_storage.cpp @@ -18,12 +18,12 @@ PersistentStoragePool _persistent_storage_pool("PersistentStorage"); INSTANTIATE_POOL_METHODS(PersistentStorage) /** The changed storage arrays */ -static std::set *_changed_storage_arrays = new std::set; +static std::set *_changed_storage_arrays = new std::set; /** * Remove references to use. */ -BaseStorageArray::~BaseStorageArray() +BasePersistentStorageArray::~BasePersistentStorageArray() { _changed_storage_arrays->erase(this); } @@ -34,7 +34,7 @@ BaseStorageArray::~BaseStorageArray() * arrays, which saves quite a few clears, etc. after callbacks. * @param storage the array that has changed */ -void AddChangedStorage(BaseStorageArray *storage) +void AddChangedPersistentStorage(BasePersistentStorageArray *storage) { _changed_storage_arrays->insert(storage); } @@ -49,10 +49,10 @@ void AddChangedStorage(BaseStorageArray *storage) * - reverting to the previous version * @param keep_changes do we save or revert the changes since the last #ClearChanges? */ -void ClearStorageChanges(bool keep_changes) +void ClearPersistentStorageChanges(bool keep_changes) { /* Loop over all changes arrays */ - for (std::set::iterator it = _changed_storage_arrays->begin(); it != _changed_storage_arrays->end(); it++) { + for (std::set::iterator it = _changed_storage_arrays->begin(); it != _changed_storage_arrays->end(); it++) { (*it)->ClearChanges(keep_changes); } diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h index 9e71c0a2b..c4c4addbf 100644 --- a/src/newgrf_storage.h +++ b/src/newgrf_storage.h @@ -15,11 +15,11 @@ #include "core/pool_type.hpp" /** - * Base class for all NewGRF storage arrays. Nothing fancy, only here - * so we have a generalised class to use. + * Base class for all persistent NewGRF storage arrays. Nothing fancy, only here + * so we have a generalised access to the virtual methods. */ -struct BaseStorageArray { - virtual ~BaseStorageArray(); +struct BasePersistentStorageArray { + virtual ~BasePersistentStorageArray(); /** * Clear the changes made since the last #ClearChanges. @@ -38,7 +38,7 @@ struct BaseStorageArray { * @tparam SIZE the size of the array. */ template -struct PersistentStorageArray : BaseStorageArray { +struct PersistentStorageArray : BasePersistentStorageArray { TYPE storage[SIZE]; ///< Memory to for the storage array TYPE *prev_storage; ///< Memory to store "old" states so we can revert them on the performance of test cases for commands etc. @@ -83,7 +83,7 @@ struct PersistentStorageArray : BaseStorageArray { /* We only need to register ourselves when we made the backup * as that is the only time something will have changed */ - AddChangedStorage(this); + AddChangedPersistentStorage(this); } this->storage[pos] = value; @@ -183,8 +183,8 @@ struct TemporaryStorageArray { } }; -void AddChangedStorage(BaseStorageArray *storage); -void ClearStorageChanges(bool keep_changes); +void AddChangedPersistentStorage(BasePersistentStorageArray *storage); +void ClearPersistentStorageChanges(bool keep_changes); typedef PersistentStorageArray OldPersistentStorage; diff --git a/src/openttd.cpp b/src/openttd.cpp index e878d0894..293462651 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1352,7 +1352,7 @@ void StateGameLoop() } if (HasModalProgress()) return; - ClearStorageChanges(false); + ClearPersistentStorageChanges(false); Layouter::ReduceLineCache(); @@ -1360,7 +1360,7 @@ void StateGameLoop() RunTileLoop(); CallVehicleTicks(); CallLandscapeTick(); - ClearStorageChanges(true); + ClearPersistentStorageChanges(true); UpdateLandscapingLimits(); CallWindowTickEvent(); @@ -1384,7 +1384,7 @@ void StateGameLoop() RunTileLoop(); CallVehicleTicks(); CallLandscapeTick(); - ClearStorageChanges(true); + ClearPersistentStorageChanges(true); AI::GameLoop(); Game::GameLoop(); -- cgit v1.2.3-54-g00ecf