Skip to content

Commit

Permalink
Fix typo ObservervedVarOps -> ObservedVarOps
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Sep 2, 2024
1 parent 5e24434 commit 99838d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/game_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void Game_Map::SetupCommon() {
}

map_cache->Clear();
using Op = Caching::ObservervedVarOps;
using Op = Caching::ObservedVarOps;

// Create the map events
events.reserve(map->events.size());
Expand All @@ -381,7 +381,7 @@ void Game_Map::SetupCommon() {
}

void Game_Map::Caching::MapCache::Clear() {
for (int i = 0; i < static_cast<int>(ObservervedVarOps_END); i++) {
for (int i = 0; i < static_cast<int>(ObservedVarOps_END); i++) {
refresh_targets_by_varid[i].clear();
}
}
Expand Down Expand Up @@ -1552,14 +1552,14 @@ void Game_Map::SetNeedRefresh(bool refresh) {
void Game_Map::SetNeedRefreshForSwitchChange(int switch_id) {
if (need_refresh)
return;
if (map_cache->GetNeedRefresh<Caching::ObservervedVarOps::SwitchSet>(switch_id))
if (map_cache->GetNeedRefresh<Caching::ObservedVarOps::SwitchSet>(switch_id))
SetNeedRefresh(true);
}

void Game_Map::SetNeedRefreshForVarChange(int var_id) {
if (need_refresh)
return;
if (map_cache->GetNeedRefresh<Caching::ObservervedVarOps::VarSet>(var_id))
if (map_cache->GetNeedRefresh<Caching::ObservedVarOps::VarSet>(var_id))
SetNeedRefresh(true);
}

Expand Down
18 changes: 9 additions & 9 deletions src/game_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,24 +691,24 @@ namespace Game_Map {

using MapEventCacheData_t = std::unordered_map<int, MapEventCache>;

enum ObservervedVarOps {
enum ObservedVarOps {
SwitchSet = 0,
VarSet,

ObservervedVarOps_END
ObservedVarOps_END
};

class MapCache {
public:
template <ObservervedVarOps Op>
template <ObservedVarOps Op>
void AddEventAsRefreshTarget(int var_id, lcf::rpg::Event& ev);

template <ObservervedVarOps Op>
template <ObservedVarOps Op>
bool GetNeedRefresh(int var_id);

void Clear();
private:
MapEventCacheData_t refresh_targets_by_varid[ObservervedVarOps_END];
MapEventCacheData_t refresh_targets_by_varid[ObservedVarOps_END];
};
}

Expand Down Expand Up @@ -877,17 +877,17 @@ inline void Game_Map::Caching::MapEventCache::AddEvent(lcf::rpg::Event& ev) {
}
}

template <Game_Map::Caching::ObservervedVarOps Op>
template <Game_Map::Caching::ObservedVarOps Op>
inline void Game_Map::Caching::MapCache::AddEventAsRefreshTarget(int var_id, lcf::rpg::Event& ev) {
static_assert(static_cast<int>(Op) >= 0 && Op < ObservervedVarOps_END);
static_assert(static_cast<int>(Op) >= 0 && Op < ObservedVarOps_END);

auto& events_cache = refresh_targets_by_varid[static_cast<int>(Op)];
events_cache[var_id].AddEvent(ev);
}

template <Game_Map::Caching::ObservervedVarOps Op>
template <Game_Map::Caching::ObservedVarOps Op>
inline bool Game_Map::Caching::MapCache::GetNeedRefresh(int var_id) {
static_assert(static_cast<int>(Op) >= 0 && Op < ObservervedVarOps_END);
static_assert(static_cast<int>(Op) >= 0 && Op < ObservedVarOps_END);

auto& events_cache = refresh_targets_by_varid[static_cast<int>(Op)];
return events_cache.find(var_id) != events_cache.end();
Expand Down

0 comments on commit 99838d3

Please sign in to comment.