From c8cdd539127dce4612d851e34647d6943b0be8cc Mon Sep 17 00:00:00 2001 From: fed <58637860+fedddddd@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:05:10 +0100 Subject: [PATCH] Small fix --- src/component/gsc.cpp | 8 ++++---- src/component/gsc.hpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/component/gsc.cpp b/src/component/gsc.cpp index 7fe7a7b..116c2ad 100644 --- a/src/component/gsc.cpp +++ b/src/component/gsc.cpp @@ -137,13 +137,13 @@ namespace gsc } } - void call_function(const function_t* function) + void call_function(const function_t& function) { const auto args = get_arguments(); try { - const auto value = function->operator()(args); + const auto value = function(args); return_value(value); } catch (const std::exception& e) @@ -152,7 +152,7 @@ namespace gsc } } - void call_method(const function_t* method, const game::scr_entref_t entref) + void call_method(const function_t& method, const game::scr_entref_t entref) { const auto args = get_arguments(); @@ -168,7 +168,7 @@ namespace gsc args_.push_back(arg); } - const auto value = method->operator()(args_); + const auto value = method(args_); return_value(value); } catch (const std::exception& e) diff --git a/src/component/gsc.hpp b/src/component/gsc.hpp index abd5f6b..04f35c1 100644 --- a/src/component/gsc.hpp +++ b/src/component/gsc.hpp @@ -56,8 +56,8 @@ namespace gsc return wrap_function(std::function(f)); } - void call_function(const function_t* function); - void call_method(const function_t* method, const game::scr_entref_t entref); + void call_function(const function_t& function); + void call_method(const function_t& method, const game::scr_entref_t entref); namespace function { @@ -70,7 +70,7 @@ namespace gsc const auto lower = utils::string::to_lower(name); static const auto [iterator, was_inserted] = functions.insert(std::make_pair(lower, function)); - static const auto function_ptr = &iterator->second; + static const auto& function_ptr = iterator->second; function_wraps[lower] = []() { @@ -102,7 +102,7 @@ namespace gsc const auto lower = utils::string::to_lower(name); static const auto [iterator, was_inserted] = functions.insert(std::make_pair(lower, function)); - static const auto function_ptr = &iterator->second; + static const auto& function_ptr = iterator->second; method_wraps[lower] = [](game::scr_entref_t entref) {