Console Refactor

This commit is contained in:
Lukas Aldershaab 2023-04-23 10:39:54 +02:00
parent 626de074cc
commit 89b0c7f73b
89 changed files with 1883 additions and 1553 deletions

View file

@ -27,6 +27,7 @@
#include "platform/platform.h"
#include "console/simDatablock.h"
#include "script.h"
#include "console/console.h"
#include "console/consoleInternal.h"
#include "console/engineAPI.h"
@ -34,7 +35,6 @@
#include "T3D/gameBase/gameConnection.h"
#include "core/stream/bitStream.h"
#include "console/compiler.h"
IMPLEMENT_CO_DATABLOCK_V1(SimDataBlock);
SimObjectId SimDataBlock::sNextObjectId = DataBlockObjectIdFirst;
@ -252,17 +252,14 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o
b[0] = '\0';
// perform the statement evaluation
Compiler::gSyntaxError = false;
//Con::errorf("EVAL [%s]", avar("return %s;", buffer));
const char *result = Con::evaluate(avar("return %s;", buffer), false, 0);
if (Compiler::gSyntaxError)
Con::EvalResult evalResult = Con::evaluate(avar("return %s;", buffer), false, 0);
if (evalResult.valid)
{
Con::errorf("Field Substitution Failed: field=\"%s\" substitution=\"%s\" -- syntax error",
substitutions[i]->mSlot, substitutions[i]->mValue);
Compiler::gSyntaxError = false;
return;
}
const char* result = evalResult.value;
// output a runtime console error when a substitution produces and empty result.
if (result == 0 || result[0] == '\0')