Small gsc changes
This commit is contained in:
parent
6107a587f4
commit
7ce3d81583
@ -78,12 +78,14 @@ namespace gsc
|
||||
{
|
||||
const auto& pos = function.value();
|
||||
unknown_function_error = std::format(
|
||||
"while processing function '{}' in script '{}':\nunknown script '{}'", pos.first, pos.second, scripting::current_file
|
||||
"while processing function '{}' in script '{}':\nunknown script '{}' ({})",
|
||||
pos.first, pos.second, scripting::current_file, scripting::current_file_id
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
unknown_function_error = std::format("unknown script '{}'", scripting::current_file);
|
||||
unknown_function_error = std::format("unknown script '{}' ({})",
|
||||
scripting::current_file, scripting::current_file_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +95,8 @@ namespace gsc
|
||||
const auto name = scripting::get_token(thread_name);
|
||||
|
||||
unknown_function_error = std::format(
|
||||
"while processing script '{}':\nunknown function '{}::{}'", scripting::current_file, filename, name
|
||||
"while processing script '{}':\nunknown function '{}::{}'",
|
||||
scripting::current_file, filename, name
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ namespace gsc
|
||||
|
||||
if (func == nullptr)
|
||||
{
|
||||
scr_error("function doesn't exist");
|
||||
scr_error(utils::string::va("builtin function \"%s\" doesn't exist", gsc_ctx->func_name(function_id).data()), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ namespace gsc
|
||||
|
||||
if (meth == nullptr)
|
||||
{
|
||||
scr_error("function doesn't exist");
|
||||
scr_error(utils::string::va("builtin method \"%s\" doesn't exist", gsc_ctx->meth_name(method_id).data()), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -252,9 +252,9 @@ namespace gsc
|
||||
}
|
||||
}
|
||||
|
||||
void scr_error(const char* error)
|
||||
void scr_error(const char* error, const bool force_print)
|
||||
{
|
||||
force_error_print = true;
|
||||
force_error_print = force_print;
|
||||
gsc_error_msg = error;
|
||||
|
||||
game::Scr_ErrorInternal();
|
||||
|
@ -34,7 +34,7 @@ namespace gsc
|
||||
|
||||
extern const game::dvar_t* developer_script;
|
||||
|
||||
void scr_error(const char* error);
|
||||
void scr_error(const char* error, const bool force_print = false);
|
||||
|
||||
namespace function
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ namespace scripting
|
||||
utils::concurrency::container<shared_table_t> shared_table;
|
||||
|
||||
std::string current_file;
|
||||
unsigned int current_file_id{};
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -46,8 +47,7 @@ namespace scripting
|
||||
|
||||
utils::hook::detour db_find_xasset_header_hook;
|
||||
|
||||
std::string current_script_file;
|
||||
unsigned int current_file_id{};
|
||||
const char* current_script_file_name;
|
||||
|
||||
game::dvar_t* g_dump_scripts;
|
||||
|
||||
@ -153,7 +153,7 @@ namespace scripting
|
||||
|
||||
void process_script_stub(const char* filename)
|
||||
{
|
||||
current_script_file = filename;
|
||||
current_script_file_name = filename;
|
||||
|
||||
const auto file_id = atoi(filename);
|
||||
if (file_id)
|
||||
@ -176,7 +176,7 @@ namespace scripting
|
||||
|
||||
if (!script_function_table_sort.contains(filename))
|
||||
{
|
||||
const auto script = gsc::find_script(game::ASSET_TYPE_SCRIPTFILE, current_script_file.data(), false);
|
||||
const auto script = gsc::find_script(game::ASSET_TYPE_SCRIPTFILE, current_script_file_name, false);
|
||||
if (script)
|
||||
{
|
||||
const auto end = &script->bytecode[script->bytecodeLen];
|
||||
|
@ -13,6 +13,7 @@ namespace scripting
|
||||
extern utils::concurrency::container<shared_table_t> shared_table;
|
||||
|
||||
extern std::string current_file;
|
||||
extern unsigned int current_file_id;
|
||||
|
||||
void on_shutdown(const std::function<void(bool, bool)>& callback);
|
||||
std::optional<std::string> get_canonical_string(const unsigned int id);
|
||||
|
Loading…
Reference in New Issue
Block a user