mirror of
https://github.com/alicealys/t5-gsc-utils.git
synced 2025-04-19 12:32:53 +00:00
Small fix
This commit is contained in:
parent
7d4e4efc5f
commit
c8cdd53912
@ -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();
|
const auto args = get_arguments();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const auto value = function->operator()(args);
|
const auto value = function(args);
|
||||||
return_value(value);
|
return_value(value);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
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();
|
const auto args = get_arguments();
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ namespace gsc
|
|||||||
args_.push_back(arg);
|
args_.push_back(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto value = method->operator()(args_);
|
const auto value = method(args_);
|
||||||
return_value(value);
|
return_value(value);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
|
@ -56,8 +56,8 @@ namespace gsc
|
|||||||
return wrap_function(std::function(f));
|
return wrap_function(std::function(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void call_function(const function_t* function);
|
void call_function(const function_t& function);
|
||||||
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);
|
||||||
|
|
||||||
namespace function
|
namespace function
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ namespace gsc
|
|||||||
|
|
||||||
const auto lower = utils::string::to_lower(name);
|
const auto lower = utils::string::to_lower(name);
|
||||||
static const auto [iterator, was_inserted] = functions.insert(std::make_pair(lower, function));
|
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] = []()
|
function_wraps[lower] = []()
|
||||||
{
|
{
|
||||||
@ -102,7 +102,7 @@ namespace gsc
|
|||||||
|
|
||||||
const auto lower = utils::string::to_lower(name);
|
const auto lower = utils::string::to_lower(name);
|
||||||
static const auto [iterator, was_inserted] = functions.insert(std::make_pair(lower, function));
|
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)
|
method_wraps[lower] = [](game::scr_entref_t entref)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user