Merge branch 'master' into jgrpp

# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/release-source.yml
#	CMakeLists.txt
#	COMPILING.md
#	src/network/network_survey.cpp
#	src/network/network_survey.h
#	src/openttd.cpp
#	src/tests/CMakeLists.txt
This commit is contained in:
Jonathan G Rennison
2023-11-17 19:16:55 +00:00
21 changed files with 217 additions and 103 deletions

View File

@@ -130,7 +130,10 @@
}
std::string json;
ScriptAdmin::MakeJSON(vm, -1, SQUIRREL_MAX_DEPTH, json);
if (!ScriptAdmin::MakeJSON(vm, -1, SQUIRREL_MAX_DEPTH, json)) {
sq_pushinteger(vm, 0);
return 1;
}
if (json.length() > NETWORK_GAMESCRIPT_JSON_LENGTH) {
ScriptLog::Error("You are trying to send a table that is too large to the AdminPort. No data sent.");

View File

@@ -37,7 +37,7 @@ public:
static bool Send(void *table);
#endif /* DOXYGEN_API */
private:
protected:
/**
* Convert a Squirrel structure into a JSON string.
* @param vm The VM to operate on.

View File

@@ -220,11 +220,11 @@ const char *ScriptEventAdminPort::ReadValue(HSQUIRRELVM vm, const char *p)
SKIP_EMPTY(p);
if (strncmp(p, "false", 5) == 0) {
sq_pushinteger(vm, 0);
sq_pushbool(vm, 0);
return p + 5;
}
if (strncmp(p, "true", 4) == 0) {
sq_pushinteger(vm, 1);
sq_pushbool(vm, 1);
return p + 4;
}
if (strncmp(p, "null", 4) == 0) {

View File

@@ -44,6 +44,7 @@ typedef bool (ScriptAsyncModeProc)();
class ScriptObject : public SimpleCountedObject {
friend class ScriptInstance;
friend class ScriptController;
friend class TestScriptController;
protected:
/**
* A class that handles the current active instance. By instantiating it at