inline void Actions::clearMap(ActionUseMap& map) { for(ActionUseMap::iterator it = map.begin(); it != map.end(); ++it) delete it->second; map.clear(); }
void Actions::clearMap(ActionUseMap& map, bool fromLua) { for (auto it = map.begin(); it != map.end(); ) { if (fromLua == it->second.fromLua) { it = map.erase(it); } else { ++it; } } }
inline void Actions::clearMap(ActionUseMap& map) { ActionUseMap::iterator it = map.begin(); while(it != map.end()) { delete it->second; map.erase(it); it = map.begin(); } }
inline void Actions::clearMap(ActionUseMap& map) { // Filter out duplicates to avoid double-free std::unordered_set<Action*> set; for (const auto& it : map) { set.insert(it.second); } map.clear(); for (Action* action : set) { delete action; } }