Rename state structs

Fixes UB leading to crash when exiting the game
This commit is contained in:
Alexander Batalov 2022-11-09 11:41:53 +03:00
parent a70912d311
commit 5e9cf96106
2 changed files with 6 additions and 6 deletions

View File

@ -6,18 +6,18 @@
namespace fallout {
struct State {
struct SfallGlobalVarsState {
std::unordered_map<uint64_t, int> vars;
};
static bool sfallGlobalVarsStore(uint64_t key, int value);
static bool sfallGlobalVarsFetch(uint64_t key, int& value);
static State* _state;
static SfallGlobalVarsState* _state;
bool sfallGlobalVarsInit()
{
_state = new (std::nothrow) State();
_state = new (std::nothrow) SfallGlobalVarsState();
if (_state == nullptr) {
return false;
}

View File

@ -30,16 +30,16 @@ struct List {
size_t pos = 0;
};
struct State {
struct SfallListsState {
std::unordered_map<int, List> lists;
int nextListId = kInitialListId;
};
static State* _state = nullptr;
static SfallListsState* _state = nullptr;
bool sfallListsInit()
{
_state = new (std::nothrow) State();
_state = new (std::nothrow) SfallListsState();
if (_state == nullptr) {
return false;
}