diff --git a/src/game/scripting/event_handler.cpp b/src/game/scripting/event_handler.cpp index 6fd8411..c1d5db8 100644 --- a/src/game/scripting/event_handler.cpp +++ b/src/game/scripting/event_handler.cpp @@ -32,7 +32,7 @@ namespace game { std::vector arguments; - for (const auto& argument : event->arguments) + for (auto argument : event->arguments) { arguments.push_back(this->context_->get_parameters()->load(argument)); } @@ -49,7 +49,7 @@ namespace game void event_handler::dispatch_to_specific_listeners(event* event, const std::vector& arguments) { - for (const auto& listener : this->event_listeners_) + for (auto listener : this->event_listeners_) { if (listener->event == event->name && listener->entity_id == event->entity_id) { @@ -66,7 +66,7 @@ namespace game void event_handler::dispatch_to_generic_listeners(event* event, const std::vector& arguments) { - for (const auto& listener : this->generic_event_listeners_) + for (auto listener : this->generic_event_listeners_) { if (listener->event == event->name) { @@ -96,7 +96,7 @@ namespace game void event_handler::remove(const event_listener_handle& handle) { - for (const auto& task : this->event_listeners_) + for (auto task : this->event_listeners_) { if (task->id == handle.id) { @@ -105,7 +105,7 @@ namespace game } } - for (const auto& task : this->generic_event_listeners_) + for (auto task : this->generic_event_listeners_) { if (task->id == handle.id) { diff --git a/src/game/scripting/executer.cpp b/src/game/scripting/executer.cpp index 87bbc24..1585547 100644 --- a/src/game/scripting/executer.cpp +++ b/src/game/scripting/executer.cpp @@ -100,7 +100,7 @@ namespace game stack_isolation _; std::reverse(arguments.begin(), arguments.end()); - for (const auto& argument : arguments) + for (auto argument : arguments) { this->context_->get_parameters()->push(argument); } diff --git a/src/game/scripting/scheduler.cpp b/src/game/scripting/scheduler.cpp index 7d2c28a..0deff9e 100644 --- a/src/game/scripting/scheduler.cpp +++ b/src/game/scripting/scheduler.cpp @@ -40,7 +40,7 @@ namespace game void scheduler::run_frame() { - for (const auto& task : this->tasks_) + for (auto task : this->tasks_) { const auto now = std::chrono::steady_clock::now(); if ((now - task->last_execution) > task->delay) @@ -79,7 +79,7 @@ namespace game void scheduler::remove(const task_handle& handle) { - for (const auto& task : this->tasks_) + for (auto task : this->tasks_) { if(task->id == handle.id) { diff --git a/src/module/scheduler.cpp b/src/module/scheduler.cpp index d361e46..e512cfa 100644 --- a/src/module/scheduler.cpp +++ b/src/module/scheduler.cpp @@ -39,13 +39,14 @@ __declspec(naked) void scheduler::execute() void scheduler::execute_safe() { - for (const auto& callback : callbacks_) + for (auto callback : callbacks_) { (*callback)(); } - for (const auto& callback : single_callbacks_) + for (auto callback : single_callbacks_) { + single_callbacks_.remove(callback); (*callback)(); } }