Revert change to RemoveCustomGameActions

This commit is contained in:
Ted John 2020-04-24 13:38:27 +01:00
parent 4162ad0eb6
commit 4ebd8da630
1 changed files with 11 additions and 2 deletions

View File

@ -821,8 +821,17 @@ bool ScriptEngine::RegisterCustomAction(
void ScriptEngine::RemoveCustomGameActions(const std::shared_ptr<Plugin>& plugin)
{
auto isOwner = [&] (auto& obj) { return obj.second.Owner == plugin; }
std::erase(std::remove_if(_customActions.begin(), _customActions.end(), isOwner), _customActions.end());
for (auto it = _customActions.begin(); it != _customActions.end();)
{
if (it->second.Owner == plugin)
{
it = _customActions.erase(it);
}
else
{
it++;
}
}
}
void ScriptEngine::RunGameActionHooks(const GameAction& action, std::unique_ptr<GameActionResult>& result, bool isExecute)