mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-07 06:39:08 +00:00
(svn r26174) -Codechange: Rename BaseStorageArray to BasePersistentStorageArray
This commit is contained in:
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 cmd the command cost to return.
|
||||||
* @param clear whether to keep the storage changes or not.
|
* @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.
|
* 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. */
|
/* Test the command. */
|
||||||
_cleared_object_areas.Clear();
|
_cleared_object_areas.Clear();
|
||||||
SetTownRatingTestMode(true);
|
SetTownRatingTestMode(true);
|
||||||
ClearStorageChanges(false);
|
ClearPersistentStorageChanges(false);
|
||||||
CommandCost res = proc(tile, flags, p1, p2, text);
|
CommandCost res = proc(tile, flags, p1, p2, text);
|
||||||
SetTownRatingTestMode(false);
|
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
|
/* Actually try and execute the command. If no cost-type is given
|
||||||
* use the construction one */
|
* use the construction one */
|
||||||
_cleared_object_areas.Clear();
|
_cleared_object_areas.Clear();
|
||||||
ClearStorageChanges(false);
|
ClearPersistentStorageChanges(false);
|
||||||
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
|
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
|
||||||
|
|
||||||
if (cmd_id == CMD_COMPANY_CTRL) {
|
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. */
|
/* These are probably pointless when inside the scenario editor. */
|
||||||
SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
|
SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
|
||||||
|
@ -18,12 +18,12 @@ PersistentStoragePool _persistent_storage_pool("PersistentStorage");
|
|||||||
INSTANTIATE_POOL_METHODS(PersistentStorage)
|
INSTANTIATE_POOL_METHODS(PersistentStorage)
|
||||||
|
|
||||||
/** The changed storage arrays */
|
/** 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.
|
* Remove references to use.
|
||||||
*/
|
*/
|
||||||
BaseStorageArray::~BaseStorageArray()
|
BasePersistentStorageArray::~BasePersistentStorageArray()
|
||||||
{
|
{
|
||||||
_changed_storage_arrays->erase(this);
|
_changed_storage_arrays->erase(this);
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ BaseStorageArray::~BaseStorageArray()
|
|||||||
* arrays, which saves quite a few clears, etc. after callbacks.
|
* arrays, which saves quite a few clears, etc. after callbacks.
|
||||||
* @param storage the array that has changed
|
* @param storage the array that has changed
|
||||||
*/
|
*/
|
||||||
void AddChangedStorage(BaseStorageArray *storage)
|
void AddChangedPersistentStorage(BasePersistentStorageArray *storage)
|
||||||
{
|
{
|
||||||
_changed_storage_arrays->insert(storage);
|
_changed_storage_arrays->insert(storage);
|
||||||
}
|
}
|
||||||
@ -49,10 +49,10 @@ void AddChangedStorage(BaseStorageArray *storage)
|
|||||||
* - reverting to the previous version
|
* - reverting to the previous version
|
||||||
* @param keep_changes do we save or revert the changes since the last #ClearChanges?
|
* @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 */
|
/* 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);
|
(*it)->ClearChanges(keep_changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
#include "core/pool_type.hpp"
|
#include "core/pool_type.hpp"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all NewGRF storage arrays. Nothing fancy, only here
|
* Base class for all persistent NewGRF storage arrays. Nothing fancy, only here
|
||||||
* so we have a generalised class to use.
|
* so we have a generalised access to the virtual methods.
|
||||||
*/
|
*/
|
||||||
struct BaseStorageArray {
|
struct BasePersistentStorageArray {
|
||||||
virtual ~BaseStorageArray();
|
virtual ~BasePersistentStorageArray();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the changes made since the last #ClearChanges.
|
* Clear the changes made since the last #ClearChanges.
|
||||||
@ -38,7 +38,7 @@ struct BaseStorageArray {
|
|||||||
* @tparam SIZE the size of the array.
|
* @tparam SIZE the size of the array.
|
||||||
*/
|
*/
|
||||||
template <typename TYPE, uint SIZE>
|
template <typename TYPE, uint SIZE>
|
||||||
struct PersistentStorageArray : BaseStorageArray {
|
struct PersistentStorageArray : BasePersistentStorageArray {
|
||||||
TYPE storage[SIZE]; ///< Memory to for the storage array
|
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.
|
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
|
/* We only need to register ourselves when we made the backup
|
||||||
* as that is the only time something will have changed */
|
* as that is the only time something will have changed */
|
||||||
AddChangedStorage(this);
|
AddChangedPersistentStorage(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->storage[pos] = value;
|
this->storage[pos] = value;
|
||||||
@ -183,8 +183,8 @@ struct TemporaryStorageArray {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddChangedStorage(BaseStorageArray *storage);
|
void AddChangedPersistentStorage(BasePersistentStorageArray *storage);
|
||||||
void ClearStorageChanges(bool keep_changes);
|
void ClearPersistentStorageChanges(bool keep_changes);
|
||||||
|
|
||||||
|
|
||||||
typedef PersistentStorageArray<int32, 16> OldPersistentStorage;
|
typedef PersistentStorageArray<int32, 16> OldPersistentStorage;
|
||||||
|
@ -1352,7 +1352,7 @@ void StateGameLoop()
|
|||||||
}
|
}
|
||||||
if (HasModalProgress()) return;
|
if (HasModalProgress()) return;
|
||||||
|
|
||||||
ClearStorageChanges(false);
|
ClearPersistentStorageChanges(false);
|
||||||
|
|
||||||
Layouter::ReduceLineCache();
|
Layouter::ReduceLineCache();
|
||||||
|
|
||||||
@ -1360,7 +1360,7 @@ void StateGameLoop()
|
|||||||
RunTileLoop();
|
RunTileLoop();
|
||||||
CallVehicleTicks();
|
CallVehicleTicks();
|
||||||
CallLandscapeTick();
|
CallLandscapeTick();
|
||||||
ClearStorageChanges(true);
|
ClearPersistentStorageChanges(true);
|
||||||
UpdateLandscapingLimits();
|
UpdateLandscapingLimits();
|
||||||
|
|
||||||
CallWindowTickEvent();
|
CallWindowTickEvent();
|
||||||
@ -1384,7 +1384,7 @@ void StateGameLoop()
|
|||||||
RunTileLoop();
|
RunTileLoop();
|
||||||
CallVehicleTicks();
|
CallVehicleTicks();
|
||||||
CallLandscapeTick();
|
CallLandscapeTick();
|
||||||
ClearStorageChanges(true);
|
ClearPersistentStorageChanges(true);
|
||||||
|
|
||||||
AI::GameLoop();
|
AI::GameLoop();
|
||||||
Game::GameLoop();
|
Game::GameLoop();
|
||||||
|
Loading…
Reference in New Issue
Block a user