aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/ScriptSystem.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-21 10:41:08 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-21 10:41:08 +0100
commit5134bebc19c46e4e07a5ec3af1d3f3d2d17a86dd (patch)
tree837daf5b5de189d557b6ae8eaed149354a3b5030 /src/crepe/system/ScriptSystem.cpp
parent70b1bf50de703330436f2ae9cb103fe33cbb567e (diff)
parent115d6f50152dc018073345800ca90b85846ebaa9 (diff)
merge `master` into `loek/scripts`
Diffstat (limited to 'src/crepe/system/ScriptSystem.cpp')
-rw-r--r--src/crepe/system/ScriptSystem.cpp13
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;