diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-20 14:59:34 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-20 14:59:34 +0100 |
commit | e2c27d8c99a71e5d94ffe49027ec13afeb74b021 (patch) | |
tree | 4bed8f7654c112e84bae6f8cce2ca2b2abe94cb4 /src/crepe/system/ScriptSystem.cpp | |
parent | c52742e049e68d5ad0beabf8647f543bc2497596 (diff) |
replace more vector<reference_wrapper<T>> with RefVector
Diffstat (limited to 'src/crepe/system/ScriptSystem.cpp')
-rw-r--r-- | src/crepe/system/ScriptSystem.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/crepe/system/ScriptSystem.cpp b/src/crepe/system/ScriptSystem.cpp index c4d724c..c33309c 100644 --- a/src/crepe/system/ScriptSystem.cpp +++ b/src/crepe/system/ScriptSystem.cpp @@ -1,6 +1,4 @@ -#include <forward_list> #include <functional> -#include <vector> #include "../ComponentManager.h" #include "../api/BehaviorScript.h" @@ -14,7 +12,7 @@ using namespace crepe; void ScriptSystem::update() { dbg_trace(); - forward_list<reference_wrapper<Script>> scripts = this->get_scripts(); + RefVector<Script> scripts = this->get_scripts(); for (auto & script_ref : scripts) { Script & script = script_ref.get(); @@ -26,18 +24,17 @@ void ScriptSystem::update() { } } -forward_list<reference_wrapper<Script>> ScriptSystem::get_scripts() const { - forward_list<reference_wrapper<Script>> scripts = {}; +RefVector<Script> ScriptSystem::get_scripts() const { + RefVector<Script> scripts = {}; ComponentManager & mgr = this->component_manager; - vector<reference_wrapper<BehaviorScript>> behavior_scripts - = mgr.get_components_by_type<BehaviorScript>(); + RefVector<BehaviorScript> behavior_scripts = mgr.get_components_by_type<BehaviorScript>(); for (auto behavior_script_ref : behavior_scripts) { BehaviorScript & behavior_script = behavior_script_ref.get(); if (!behavior_script.active) continue; Script * script = behavior_script.script.get(); if (script == nullptr) continue; - scripts.push_front(*script); + scripts.push_back(*script); } return scripts; |