Merge branch 'master' into jgrpp

# Conflicts:
#	src/newgrf_debug_gui.cpp
#	src/object_cmd.cpp
#	src/object_gui.cpp
This commit is contained in:
Jonathan G Rennison
2023-04-03 00:33:59 +01:00
12 changed files with 131 additions and 67 deletions

View File

@@ -573,6 +573,10 @@ void Squirrel::Initialize()
sq_pushroottable(this->vm);
squirrel_register_global_std(this);
/* Set consts table as delegate of root table, so consts/enums defined via require() are accessible */
sq_pushconsttable(this->vm);
sq_setdelegate(this->vm, -2);
}
class SQFile {
@@ -771,6 +775,12 @@ void Squirrel::Uninitialize()
{
ScriptAllocatorScope alloc_scope(this);
/* Remove the delegation */
sq_pushroottable(this->vm);
sq_pushnull(this->vm);
sq_setdelegate(this->vm, -2);
sq_pop(this->vm, 1);
/* Clean up the stuff */
sq_pop(this->vm, 1);
sq_close(this->vm);