58 assert(ignore_prev_mode || !gameloop);
59 assert(!command && !testmode);
64 assert(ignore_prev_mode || gameloop);
65 assert(!command && !testmode);
70 assert((ignore_prev_mode || !command) && !testmode);
75 assert(ignore_prev_mode || command);
80 assert(!command && (ignore_prev_mode || !testmode));
85 assert(ignore_prev_mode || testmode);
89 default: NOT_REACHED();
94 Debug(desync, 2,
"warning: discarding persistent storage changes: Feature {}, GrfID {:08X}, Tile {}", it->feature,
BSWAP32(it->grfid), it->tile);
static uint32_t BSWAP32(uint32_t x)
Perform a 32 bits endianness bitswap on x.
Functions related to debugging.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
Function to handling different endian machines.
void AddChangedPersistentStorage(BasePersistentStorageArray *storage)
Add the changed storage array to the list of changed arrays.
static std::set< BasePersistentStorageArray * > * _changed_storage_arrays
The changed storage arrays.
Functionality related to the temporary and persistent storage arrays for NewGRFs.
PersistentStorageMode
Mode switches to the behaviour of persistent storage array.
@ PSM_ENTER_GAMELOOP
Enter the gameloop, changes will be permanent.
@ PSM_LEAVE_TESTMODE
Leave command test mode, revert to previous mode.
@ PSM_LEAVE_COMMAND
Leave command scope, revert to previous mode.
@ PSM_LEAVE_GAMELOOP
Leave the gameloop, changes will be temporary.
@ PSM_ENTER_COMMAND
Enter command scope, changes will be permanent.
@ PSM_ENTER_TESTMODE
Enter command test mode, changes will be temporary.
Some methods of Pool are placed here in order to reduce compilation time and binary size.
#define INSTANTIATE_POOL_METHODS(name)
Force instantiation of pool methods so we don't get linker errors.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
Base class for all persistent NewGRF storage arrays.
static void SwitchMode(PersistentStorageMode mode, bool ignore_prev_mode=false)
Clear temporary changes made since the last call to SwitchMode, and set whether subsequent changes sh...
Class for pooled persistent storage of data.
Base class for all pools.