From 44886c8f9f9166adc27b4c42f5b11e658c0a9349 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Sat, 26 Jun 2021 00:42:00 +0200 Subject: [PATCH] Small change --- src/component/io.cpp | 2 +- src/component/json.cpp | 2 +- src/game/scripting/script_value.cpp | 18 ++++++++++++++++++ src/game/scripting/script_value.hpp | 6 ++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/component/io.cpp b/src/component/io.cpp index 4530d21..98e2c46 100644 --- a/src/component/io.cpp +++ b/src/component/io.cpp @@ -150,7 +150,7 @@ namespace io array.push(file); } - return array.get_raw(); + return array; }); gsc::function::add("copyfolder", [](const gsc::function_args& args) diff --git a/src/component/json.cpp b/src/component/json.cpp index 0377177..01ba058 100644 --- a/src/component/json.cpp +++ b/src/component/json.cpp @@ -168,7 +168,7 @@ namespace json array[key] = args[i + 1]; } - return array.get_raw(); + return array; }); gsc::function::add("jsonparse", [](const gsc::function_args& args) diff --git a/src/game/scripting/script_value.cpp b/src/game/scripting/script_value.cpp index 8b85e5e..f821464 100644 --- a/src/game/scripting/script_value.cpp +++ b/src/game/scripting/script_value.cpp @@ -103,6 +103,24 @@ namespace scripting this->value_ = variable; } + script_value::script_value(const array& value) + { + game::VariableValue variable{}; + variable.type = game::SCRIPT_OBJECT; + variable.u.pointerValue = value.get_entity_id(); + + this->value_ = variable; + } + + script_value::script_value(const function& value) + { + game::VariableValue variable{}; + variable.type = game::SCRIPT_OBJECT; + variable.u.codePosValue = value.get_pos(); + + this->value_ = variable; + } + /*************************************************************** * Integer **************************************************************/ diff --git a/src/game/scripting/script_value.hpp b/src/game/scripting/script_value.hpp index 0e159b6..8fb4267 100644 --- a/src/game/scripting/script_value.hpp +++ b/src/game/scripting/script_value.hpp @@ -6,6 +6,8 @@ namespace scripting { class entity; + class array; + class function; class script_value { @@ -29,6 +31,10 @@ namespace scripting script_value(const vector& value); + script_value(const array& value); + + script_value(const function& value); + template bool is() const;