Beginnings of the "pass everything using a native type wrapper" console code.

- ConsoleValue class is now the base value class.
- ConsoleValueRef is now used to supply function parameters. Values are disposable.
- Script functions return values instead of just strings where possible.
- Variables can be disposable strings
- Bytecode changed

Fix the issues with console method parameters and fields which prevented missions from loading.
This commit is contained in:
James Urquhart 2012-09-23 09:59:48 +01:00
parent 394d87cd54
commit 38c8e52c1d
68 changed files with 1511 additions and 529 deletions

View file

@ -228,11 +228,11 @@ void SimSet::scriptSort( const String &scriptCallbackFn )
//-----------------------------------------------------------------------------
void SimSet::callOnChildren( const String &method, S32 argc, const char *argv[], bool executeOnChildGroups )
void SimSet::callOnChildren( const String &method, S32 argc, ConsoleValueRef argv[], bool executeOnChildGroups )
{
// Prep the arguments for the console exec...
// Make sure and leave args[1] empty.
const char* args[21];
ConsoleValueRef args[21];
args[0] = method.c_str();
for (S32 i = 0; i < argc; i++)
args[i + 2] = argv[i];
@ -834,7 +834,7 @@ SimGroup* SimGroup::deepClone()
//-----------------------------------------------------------------------------
bool SimGroup::processArguments(S32, const char **)
bool SimGroup::processArguments(S32, ConsoleValueRef *argv)
{
return true;
}
@ -973,7 +973,7 @@ ConsoleMethod( SimSet, callOnChildren, void, 3, 0,
"@note This method recurses into all SimSets that are children to the set.\n\n"
"@see callOnChildrenNoRecurse" )
{
object->callOnChildren( argv[2], argc - 3, argv + 3 );
object->callOnChildren( (const char*)argv[2], argc - 3, argv + 3 );
}
//-----------------------------------------------------------------------------
@ -985,7 +985,7 @@ ConsoleMethod( SimSet, callOnChildrenNoRecurse, void, 3, 0,
"@note This method does not recurse into child SimSets.\n\n"
"@see callOnChildren" )
{
object->callOnChildren( argv[2], argc - 3, argv + 3, false );
object->callOnChildren( (const char*)argv[2], argc - 3, argv + 3, false );
}
//-----------------------------------------------------------------------------
@ -1121,7 +1121,7 @@ DefineEngineMethod( SimSet, pushToBack, void, ( SimObject* obj ),,
ConsoleMethod( SimSet, sort, void, 3, 3, "( string callbackFunction ) Sort the objects in the set using the given comparison function.\n"
"@param callbackFunction Name of a function that takes two object arguments A and B and returns -1 if A is less, 1 if B is less, and 0 if both are equal." )
{
object->scriptSort( argv[2] );
object->scriptSort( (const char*)argv[2] );
}
//-----------------------------------------------------------------------------