(svn r26174) -Codechange: Rename BaseStorageArray to BasePersistentStorageArray

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
frosch 11 years ago
parent a9e8d7a361
commit eca86d1baf

@ -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) {

@ -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);

@ -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);
}

@ -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;

@ -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();

Loading…
Cancel
Save