mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
more console cleanups
(cherry picked from commit a66ff6407cdcdf233996f49c74d7a42537314562)
This commit is contained in:
parent
339393aa85
commit
fed381c945
3 changed files with 38 additions and 36 deletions
|
|
@ -116,9 +116,6 @@ U32 _ITER = 0; ///< Stack pointer for iterStack.
|
||||||
ConsoleValue stack[MaxStackSize];
|
ConsoleValue stack[MaxStackSize];
|
||||||
S32 _STK = 0;
|
S32 _STK = 0;
|
||||||
|
|
||||||
char curFieldArray[256];
|
|
||||||
char prevFieldArray[256];
|
|
||||||
|
|
||||||
const char* tsconcat(const char* strA, const char* strB, S32& outputLen)
|
const char* tsconcat(const char* strA, const char* strB, S32& outputLen)
|
||||||
{
|
{
|
||||||
S32 lenA = dStrlen(strA);
|
S32 lenA = dStrlen(strA);
|
||||||
|
|
|
||||||
|
|
@ -1549,22 +1549,23 @@ ConsoleValue evaluatef(const char* string, ...)
|
||||||
ConsoleValue _internalExecute(S32 argc, ConsoleValue argv[])
|
ConsoleValue _internalExecute(S32 argc, ConsoleValue argv[])
|
||||||
{
|
{
|
||||||
StringTableEntry funcName = StringTable->insert(argv[0].getString());
|
StringTableEntry funcName = StringTable->insert(argv[0].getString());
|
||||||
|
if (argc > 1)
|
||||||
const char** argv_str = static_cast<const char**>(malloc((argc - 1) * sizeof(char *)));
|
|
||||||
for (int i = 0; i < argc - 1; i++)
|
|
||||||
{
|
{
|
||||||
argv_str[i] = argv[i + 1].getString();
|
const char** argv_str = static_cast<const char**>(malloc((argc - 1) * sizeof(char*)));
|
||||||
|
for (int i = 0; i < argc - 1; i++)
|
||||||
|
{
|
||||||
|
argv_str[i] = argv[i + 1].getString();
|
||||||
|
}
|
||||||
|
bool result;
|
||||||
|
const char* methodRes = CInterface::CallFunction(NULL, funcName, argv_str, argc - 1, &result);
|
||||||
|
free(argv_str);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
ConsoleValue ret;
|
||||||
|
ret.setString(methodRes);
|
||||||
|
return std::move(ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool result;
|
|
||||||
const char* methodRes = CInterface::CallFunction(NULL, funcName, argv_str, argc - 1, &result);
|
|
||||||
free(argv_str);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
ConsoleValue ret;
|
|
||||||
ret.setString(methodRes);
|
|
||||||
return std::move(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
Namespace::Entry *ent;
|
Namespace::Entry *ent;
|
||||||
|
|
||||||
ent = Namespace::global()->lookup(funcName);
|
ent = Namespace::global()->lookup(funcName);
|
||||||
|
|
@ -1636,22 +1637,24 @@ static ConsoleValue _internalExecute(SimObject *object, S32 argc, ConsoleValue a
|
||||||
}
|
}
|
||||||
|
|
||||||
StringTableEntry funcName = StringTable->insert(argv[0].getString());
|
StringTableEntry funcName = StringTable->insert(argv[0].getString());
|
||||||
|
if (argc > 2)
|
||||||
const char** argv_str = static_cast<const char**>(malloc((argc - 2) * sizeof(char *)));
|
|
||||||
for (int i = 0; i < argc - 2; i++)
|
|
||||||
{
|
{
|
||||||
argv_str[i] = argv[i + 2].getString();
|
const char** argv_str = static_cast<const char**>(malloc((argc - 2) * sizeof(char*)));
|
||||||
}
|
for (int i = 0; i < argc - 2; i++)
|
||||||
bool result;
|
{
|
||||||
const char* methodRes = CInterface::CallMethod(object, funcName, argv_str, argc - 2, &result);
|
argv_str[i] = argv[i + 2].getString();
|
||||||
|
}
|
||||||
|
bool result;
|
||||||
|
const char* methodRes = CInterface::CallMethod(object, funcName, argv_str, argc - 2, &result);
|
||||||
|
|
||||||
free(argv_str);
|
free(argv_str);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
ConsoleValue val;
|
ConsoleValue val;
|
||||||
val.setString(methodRes);
|
val.setString(methodRes);
|
||||||
return val;
|
return val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(object->getNamespace())
|
if(object->getNamespace())
|
||||||
|
|
|
||||||
|
|
@ -644,18 +644,20 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
// Fetch field count.
|
// Fetch field count.
|
||||||
const U32 fieldCount = fieldList.size();
|
const U32 fieldCount = fieldList.size();
|
||||||
|
|
||||||
ConsoleObject* defaultConObject;
|
ConsoleObject* defaultConObject = NULL;
|
||||||
SimObject* defaultObject;
|
SimObject* defaultObject = NULL;
|
||||||
if (!getWriteDefaults())
|
if (!getWriteDefaults())
|
||||||
{
|
{
|
||||||
// Create a default object of the same type
|
// Create a default object of the same type
|
||||||
defaultConObject = ConsoleObject::create(pSimObject->getClassName());
|
defaultConObject = ConsoleObject::create(pSimObject->getClassName());
|
||||||
|
if (!defaultConObject)
|
||||||
|
return;
|
||||||
defaultObject = dynamic_cast<SimObject*>(defaultConObject);
|
defaultObject = dynamic_cast<SimObject*>(defaultConObject);
|
||||||
|
|
||||||
// ***Really*** shouldn't happen
|
|
||||||
if (!defaultObject)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
// ***Really*** shouldn't happen
|
||||||
|
if (!defaultConObject || !defaultObject)
|
||||||
|
return;
|
||||||
|
|
||||||
// Iterate fields.
|
// Iterate fields.
|
||||||
U8 arrayDepth = 0;
|
U8 arrayDepth = 0;
|
||||||
|
|
@ -754,7 +756,7 @@ ImplementEnumType(_TamlFormatMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save field/value.
|
// Save field/value.
|
||||||
if (arrayDepth > 0 || pField->elementCount > 1)
|
if (currentArrayNode && (arrayDepth > 0 || pField->elementCount > 1))
|
||||||
currentArrayNode->getChildren()[elementIndex]->addField(fieldName, pFieldValue);
|
currentArrayNode->getChildren()[elementIndex]->addField(fieldName, pFieldValue);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue