From dba12758132f51b187d6902b3349dc3869f6f392 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 2 Jun 2020 13:21:23 +0200 Subject: [PATCH] Move ScriptIterator reset to get call instead of inside Macro. --- src/Battling/ScriptHandling/ScriptMacros.hpp | 2 -- src/Battling/ScriptHandling/ScriptSource.hpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Battling/ScriptHandling/ScriptMacros.hpp b/src/Battling/ScriptHandling/ScriptMacros.hpp index ac4c6aa..fb9edaf 100644 --- a/src/Battling/ScriptHandling/ScriptMacros.hpp +++ b/src/Battling/ScriptHandling/ScriptMacros.hpp @@ -1,7 +1,6 @@ #define HOOK(hookName, source, ...) \ { \ auto aggregator = source->GetScriptIterator(); \ - aggregator.Reset(); \ while (aggregator.HasNext()) { \ auto next = aggregator.GetNext(); \ if (next == nullptr) \ @@ -13,7 +12,6 @@ #define HOOK_LOCAL(hookName, source, ...) \ { \ auto aggregator = source.GetScriptIterator(); \ - aggregator.Reset(); \ while (aggregator.HasNext()) { \ auto next = aggregator.GetNext(); \ if (next == nullptr) \ diff --git a/src/Battling/ScriptHandling/ScriptSource.hpp b/src/Battling/ScriptHandling/ScriptSource.hpp index 8c84a9e..4e3104f 100644 --- a/src/Battling/ScriptHandling/ScriptSource.hpp +++ b/src/Battling/ScriptHandling/ScriptSource.hpp @@ -24,6 +24,7 @@ namespace CreatureLib::Battling { _scriptsIterator = ScriptAggregator(_scripts); _areScriptsInitialized = true; } + _scriptsIterator.Reset(); return _scriptsIterator; } };