summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-12-23 18:09:03 +0000
committerfrosch <frosch@openttd.org>2013-12-23 18:09:03 +0000
commiteca86d1baf5f374d25dcc9bf0ff2bad328bdffab (patch)
treede92bcef7f015768dbe15e8a3a9513fbd377d911 /src
parenta9e8d7a361470b7c97a858f6663144f02a929cfd (diff)
downloadopenttd-eca86d1baf5f374d25dcc9bf0ff2bad328bdffab.tar.xz
(svn r26174) -Codechange: Rename BaseStorageArray to BasePersistentStorageArray
Diffstat (limited to 'src')
-rw-r--r--src/command.cpp6
-rw-r--r--src/genworld.cpp2
-rw-r--r--src/newgrf_storage.cpp10
-rw-r--r--src/newgrf_storage.h16
-rw-r--r--src/openttd.cpp6
5 files changed, 20 insertions, 20 deletions
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<BaseStorageArray*> *_changed_storage_arrays = new std::set<BaseStorageArray*>;
+static std::set<BasePersistentStorageArray*> *_changed_storage_arrays = new std::set<BasePersistentStorageArray*>;
/**
* 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<BaseStorageArray*>::iterator it = _changed_storage_arrays->begin(); it != _changed_storage_arrays->end(); it++) {
+ for (std::set<BasePersistentStorageArray*>::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 <typename TYPE, uint SIZE>
-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<int32, 16> 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();