mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-22 21:05:39 +00:00
Improvements to console refactor code
- Prevent stack corruption in a few places - Use correct type in printfs - Reduce type conversions in EngineApi & dAto* - Fix compilation on GCC - Tidy up code
This commit is contained in:
parent
e99eadd61f
commit
08d4f6ebc0
58 changed files with 733 additions and 690 deletions
|
|
@ -439,7 +439,7 @@ ConsoleMethod( LightBase, playAnimation, void, 2, 3, "( [LightAnimData anim] )\t
|
||||||
LightAnimData *animData;
|
LightAnimData *animData;
|
||||||
if ( !Sim::findObject( argv[2], animData ) )
|
if ( !Sim::findObject( argv[2], animData ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "LightBase::playAnimation() - Invalid LightAnimData '%s'.", argv[2] );
|
Con::errorf( "LightBase::playAnimation() - Invalid LightAnimData '%s'.", (const char*)argv[2] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -554,7 +554,7 @@ ConsoleMethod(SpawnSphere, spawnObject, S32, 2, 3,
|
||||||
String additionalProps;
|
String additionalProps;
|
||||||
|
|
||||||
if (argc == 3)
|
if (argc == 3)
|
||||||
additionalProps = String(argv[2]);
|
additionalProps = (const char*)argv[2];
|
||||||
|
|
||||||
SimObject* obj = object->spawnObject(additionalProps);
|
SimObject* obj = object->spawnObject(additionalProps);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,13 +147,13 @@ ConsoleFunction( physicsDestroy, void, 1, 1, "physicsDestroy()" )
|
||||||
|
|
||||||
ConsoleFunction( physicsInitWorld, bool, 2, 2, "physicsInitWorld( String worldName )" )
|
ConsoleFunction( physicsInitWorld, bool, 2, 2, "physicsInitWorld( String worldName )" )
|
||||||
{
|
{
|
||||||
return PHYSICSMGR && PHYSICSMGR->createWorld( String( argv[1] ) );
|
return PHYSICSMGR && PHYSICSMGR->createWorld( (const char*)argv[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction( physicsDestroyWorld, void, 2, 2, "physicsDestroyWorld( String worldName )" )
|
ConsoleFunction( physicsDestroyWorld, void, 2, 2, "physicsDestroyWorld( String worldName )" )
|
||||||
{
|
{
|
||||||
if ( PHYSICSMGR )
|
if ( PHYSICSMGR )
|
||||||
PHYSICSMGR->destroyWorld( String( argv[1] ) );
|
PHYSICSMGR->destroyWorld( (const char*)argv[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -162,13 +162,13 @@ ConsoleFunction( physicsDestroyWorld, void, 2, 2, "physicsDestroyWorld( String w
|
||||||
ConsoleFunction( physicsStartSimulation, void, 2, 2, "physicsStartSimulation( String worldName )" )
|
ConsoleFunction( physicsStartSimulation, void, 2, 2, "physicsStartSimulation( String worldName )" )
|
||||||
{
|
{
|
||||||
if ( PHYSICSMGR )
|
if ( PHYSICSMGR )
|
||||||
PHYSICSMGR->enableSimulation( String( argv[1] ), true );
|
PHYSICSMGR->enableSimulation( (const char*)argv[1], true );
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction( physicsStopSimulation, void, 2, 2, "physicsStopSimulation( String worldName )" )
|
ConsoleFunction( physicsStopSimulation, void, 2, 2, "physicsStopSimulation( String worldName )" )
|
||||||
{
|
{
|
||||||
if ( PHYSICSMGR )
|
if ( PHYSICSMGR )
|
||||||
PHYSICSMGR->enableSimulation( String( argv[1] ), false );
|
PHYSICSMGR->enableSimulation( (const char*)argv[1], false );
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction( physicsSimulationEnabled, bool, 1, 1, "physicsSimulationEnabled()" )
|
ConsoleFunction( physicsSimulationEnabled, bool, 1, 1, "physicsSimulationEnabled()" )
|
||||||
|
|
@ -182,7 +182,7 @@ ConsoleFunction( physicsSimulationEnabled, bool, 1, 1, "physicsSimulationEnabled
|
||||||
ConsoleFunction( physicsSetTimeScale, void, 2, 2, "physicsSetTimeScale( F32 scale )" )
|
ConsoleFunction( physicsSetTimeScale, void, 2, 2, "physicsSetTimeScale( F32 scale )" )
|
||||||
{
|
{
|
||||||
if ( PHYSICSMGR )
|
if ( PHYSICSMGR )
|
||||||
PHYSICSMGR->setTimeScale( dAtof( argv[1] ) );
|
PHYSICSMGR->setTimeScale( argv[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the currently set time scale.
|
// Get the currently set time scale.
|
||||||
|
|
@ -212,5 +212,5 @@ ConsoleFunction( physicsRestoreState, void, 1, 1, "physicsRestoreState()" )
|
||||||
ConsoleFunction( physicsDebugDraw, void, 2, 2, "physicsDebugDraw( bool enable )" )
|
ConsoleFunction( physicsDebugDraw, void, 2, 2, "physicsDebugDraw( bool enable )" )
|
||||||
{
|
{
|
||||||
if ( PHYSICSMGR )
|
if ( PHYSICSMGR )
|
||||||
PHYSICSMGR->enableDebugDraw( dAtoi( argv[1] ) );
|
PHYSICSMGR->enableDebugDraw( (S32)argv[1] );
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +307,7 @@ ConsoleFunction( addTaggedString, const char*, 2, 2, "(string str)"
|
||||||
"@see getTaggedString()\n"
|
"@see getTaggedString()\n"
|
||||||
"@ingroup Networking\n")
|
"@ingroup Networking\n")
|
||||||
{
|
{
|
||||||
NetStringHandle s(argv[1]);
|
NetStringHandle s((const char*)argv[1]);
|
||||||
gNetStringTable->incStringRefScript(s.getIndex());
|
gNetStringTable->incStringRefScript(s.getIndex());
|
||||||
|
|
||||||
char *ret = Con::getReturnBuffer(10);
|
char *ret = Con::getReturnBuffer(10);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "component/dynamicConsoleMethodComponent.h"
|
#include "component/dynamicConsoleMethodComponent.h"
|
||||||
|
#include "console/stringStack.h"
|
||||||
|
|
||||||
|
extern StringStack STR;
|
||||||
|
extern ConsoleValueStack CSTK;
|
||||||
|
|
||||||
IMPLEMENT_CO_NETOBJECT_V1(DynamicConsoleMethodComponent);
|
IMPLEMENT_CO_NETOBJECT_V1(DynamicConsoleMethodComponent);
|
||||||
|
|
||||||
|
|
@ -152,11 +156,21 @@ const char *DynamicConsoleMethodComponent::_callMethod( U32 argc, ConsoleValueRe
|
||||||
DynamicConsoleMethodComponent *pThisComponent = dynamic_cast<DynamicConsoleMethodComponent*>( pComponent );
|
DynamicConsoleMethodComponent *pThisComponent = dynamic_cast<DynamicConsoleMethodComponent*>( pComponent );
|
||||||
AssertFatal( pThisComponent, "DynamicConsoleMethodComponent::callMethod - Non DynamicConsoleMethodComponent component attempting to callback!");
|
AssertFatal( pThisComponent, "DynamicConsoleMethodComponent::callMethod - Non DynamicConsoleMethodComponent component attempting to callback!");
|
||||||
|
|
||||||
|
// Prevent stack corruption
|
||||||
|
STR.pushFrame();
|
||||||
|
CSTK.pushFrame();
|
||||||
|
// --
|
||||||
|
|
||||||
// Only call on first depth components
|
// Only call on first depth components
|
||||||
// Should isMethod check these calls? [11/22/2006 justind]
|
// Should isMethod check these calls? [11/22/2006 justind]
|
||||||
if(pComponent->isEnabled())
|
if(pComponent->isEnabled())
|
||||||
Con::execute( pThisComponent, argc, argv );
|
Con::execute( pThisComponent, argc, argv );
|
||||||
|
|
||||||
|
// Prevent stack corruption
|
||||||
|
STR.popFrame();
|
||||||
|
CSTK.popFrame();
|
||||||
|
// --
|
||||||
|
|
||||||
// Bail if this was the first element
|
// Bail if this was the first element
|
||||||
//if( nItr == componentList.begin() )
|
//if( nItr == componentList.begin() )
|
||||||
// break;
|
// break;
|
||||||
|
|
@ -164,11 +178,20 @@ const char *DynamicConsoleMethodComponent::_callMethod( U32 argc, ConsoleValueRe
|
||||||
unlockComponentList();
|
unlockComponentList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent stack corruption
|
||||||
|
STR.pushFrame();
|
||||||
|
CSTK.pushFrame();
|
||||||
|
// --
|
||||||
|
|
||||||
// Set Owner Field
|
// Set Owner Field
|
||||||
const char* result = "";
|
const char* result = "";
|
||||||
if(callThis)
|
if(callThis)
|
||||||
result = Con::execute( pThis, argc, argv, true ); // true - exec method onThisOnly, not on DCMCs
|
result = Con::execute( pThis, argc, argv, true ); // true - exec method onThisOnly, not on DCMCs
|
||||||
|
|
||||||
|
// Prevent stack corruption
|
||||||
|
STR.popFrame();
|
||||||
|
CSTK.popFrame();
|
||||||
|
// --
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ bool SimComponent::processArguments(S32 argc, ConsoleValueRef *argv)
|
||||||
if(obj)
|
if(obj)
|
||||||
addComponent(obj);
|
addComponent(obj);
|
||||||
else
|
else
|
||||||
Con::printf("SimComponent::processArguments - Invalid Component Object \"%s\"", argv[i]);
|
Con::printf("SimComponent::processArguments - Invalid Component Object \"%s\"", (const char*)argv[i]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +383,7 @@ ConsoleMethod( SimComponent, addComponents, bool, 3, 64, "%obj.addComponents( %c
|
||||||
if(obj)
|
if(obj)
|
||||||
object->addComponent(obj);
|
object->addComponent(obj);
|
||||||
else
|
else
|
||||||
Con::printf("SimComponent::addComponents - Invalid Component Object \"%s\"", argv[i]);
|
Con::printf("SimComponent::addComponents - Invalid Component Object \"%s\"", (const char*)argv[i]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -399,7 +399,7 @@ ConsoleMethod( SimComponent, removeComponents, bool, 3, 64, "%obj.removeComponen
|
||||||
if(obj)
|
if(obj)
|
||||||
object->removeComponent(obj);
|
object->removeComponent(obj);
|
||||||
else
|
else
|
||||||
Con::printf("SimComponent::removeComponents - Invalid Component Object \"%s\"", argv[i]);
|
Con::printf("SimComponent::removeComponents - Invalid Component Object \"%s\"", (const char*)argv[i]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,7 @@ S32 QSORT_CALLBACK ArrayObject::_keyFunctionCompare( const void* a, const void*
|
||||||
ArrayObject::Element* ea = ( ArrayObject::Element* )( a );
|
ArrayObject::Element* ea = ( ArrayObject::Element* )( a );
|
||||||
ArrayObject::Element* eb = ( ArrayObject::Element* )( b );
|
ArrayObject::Element* eb = ( ArrayObject::Element* )( b );
|
||||||
|
|
||||||
const char* argv[ 3 ];
|
ConsoleValueRef argv[] = { smCompareFunction, ea->key, eb->key };
|
||||||
argv[ 0 ] = smCompareFunction;
|
|
||||||
argv[ 1 ] = ea->key;
|
|
||||||
argv[ 2 ] = eb->key;
|
|
||||||
|
|
||||||
S32 result = dAtoi( Con::execute( 3, argv ) );
|
S32 result = dAtoi( Con::execute( 3, argv ) );
|
||||||
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
|
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
|
||||||
|
|
@ -118,10 +115,7 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void
|
||||||
ArrayObject::Element* ea = ( ArrayObject::Element* )( a );
|
ArrayObject::Element* ea = ( ArrayObject::Element* )( a );
|
||||||
ArrayObject::Element* eb = ( ArrayObject::Element* )( b );
|
ArrayObject::Element* eb = ( ArrayObject::Element* )( b );
|
||||||
|
|
||||||
const char* argv[ 3 ];
|
ConsoleValueRef argv[] = { smCompareFunction, ea->value, eb->value };
|
||||||
argv[ 0 ] = smCompareFunction;
|
|
||||||
argv[ 1 ] = ea->value;
|
|
||||||
argv[ 2 ] = eb->value;
|
|
||||||
|
|
||||||
S32 result = dAtoi( Con::execute( 3, argv ) );
|
S32 result = dAtoi( Con::execute( 3, argv ) );
|
||||||
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
|
S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 );
|
||||||
|
|
|
||||||
|
|
@ -1134,12 +1134,18 @@ U32 AssignExprNode::precompile(TypeReq type)
|
||||||
subType = expr->getPreferredType();
|
subType = expr->getPreferredType();
|
||||||
if(subType == TypeReqNone)
|
if(subType == TypeReqNone)
|
||||||
subType = type;
|
subType = type;
|
||||||
if(subType == TypeReqNone) {
|
if(subType == TypeReqNone)
|
||||||
// jamesu - what we need to do in this case is turn it into a VarNode reference
|
{
|
||||||
if (dynamic_cast<VarNode*>(expr) != NULL) {
|
// What we need to do in this case is turn it into a VarNode reference.
|
||||||
// Sanity check passed
|
// Unfortunately other nodes such as field access (SlotAccessNode)
|
||||||
|
// cannot be optimized in the same manner as all fields are exposed
|
||||||
|
// and set as strings.
|
||||||
|
if (dynamic_cast<VarNode*>(expr) != NULL)
|
||||||
|
{
|
||||||
subType = TypeReqVar;
|
subType = TypeReqVar;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
subType = TypeReqString;
|
subType = TypeReqString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1423,7 +1429,8 @@ U32 FuncCallExprNode::compile(U32 *codeStream, U32 ip, TypeReq type)
|
||||||
TypeReq walkType = walk->getPreferredType();
|
TypeReq walkType = walk->getPreferredType();
|
||||||
if (walkType == TypeReqNone) walkType = TypeReqString;
|
if (walkType == TypeReqNone) walkType = TypeReqString;
|
||||||
ip = walk->compile(codeStream, ip, walkType);
|
ip = walk->compile(codeStream, ip, walkType);
|
||||||
switch (walk->getPreferredType()) {
|
switch (walk->getPreferredType())
|
||||||
|
{
|
||||||
case TypeReqFloat:
|
case TypeReqFloat:
|
||||||
codeStream[ip++] = OP_PUSH_FLT;
|
codeStream[ip++] = OP_PUSH_FLT;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1856,7 +1863,8 @@ U32 ObjectDeclNode::compileSubObject(U32 *codeStream, U32 ip, bool root)
|
||||||
TypeReq walkType = exprWalk->getPreferredType();
|
TypeReq walkType = exprWalk->getPreferredType();
|
||||||
if (walkType == TypeReqNone) walkType = TypeReqString;
|
if (walkType == TypeReqNone) walkType = TypeReqString;
|
||||||
ip = exprWalk->compile(codeStream, ip, walkType);
|
ip = exprWalk->compile(codeStream, ip, walkType);
|
||||||
switch (exprWalk->getPreferredType()) {
|
switch (exprWalk->getPreferredType())
|
||||||
|
{
|
||||||
case TypeReqFloat:
|
case TypeReqFloat:
|
||||||
codeStream[ip++] = OP_PUSH_FLT;
|
codeStream[ip++] = OP_PUSH_FLT;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -192,18 +192,16 @@ namespace Con
|
||||||
return STR.getArgBuffer(bufferSize);
|
return STR.getArgBuffer(bufferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getFloatArg(F64 arg)
|
ConsoleValueRef getFloatArg(F64 arg)
|
||||||
{
|
{
|
||||||
char *ret = STR.getArgBuffer(32);
|
ConsoleValueRef ref = arg;
|
||||||
dSprintf(ret, 32, "%g", arg);
|
return ref;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getIntArg(S32 arg)
|
ConsoleValueRef getIntArg(S32 arg)
|
||||||
{
|
{
|
||||||
char *ret = STR.getArgBuffer(32);
|
ConsoleValueRef ref = arg;
|
||||||
dSprintf(ret, 32, "%d", arg);
|
return ref;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getStringArg( const char *arg )
|
char *getStringArg( const char *arg )
|
||||||
|
|
@ -287,7 +285,8 @@ inline void ExprEvalState::setStringVariable(const char *val)
|
||||||
|
|
||||||
inline void ExprEvalState::setCopyVariable()
|
inline void ExprEvalState::setCopyVariable()
|
||||||
{
|
{
|
||||||
if (copyVariable) {
|
if (copyVariable)
|
||||||
|
{
|
||||||
switch (copyVariable->value.type)
|
switch (copyVariable->value.type)
|
||||||
{
|
{
|
||||||
case ConsoleValue::TypeInternalInt:
|
case ConsoleValue::TypeInternalInt:
|
||||||
|
|
@ -531,9 +530,8 @@ ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// jamesu - reset the console stack frame which at this point will contain
|
// Reset the console stack frame which at this point will contain
|
||||||
// either nothing or argv[] which we just copied
|
// either nothing or argv[] which we just copied
|
||||||
// NOTE: it might be better to do this when we are finished?
|
|
||||||
CSTK.resetFrame();
|
CSTK.resetFrame();
|
||||||
|
|
||||||
// Grab the state of the telenet debugger here once
|
// Grab the state of the telenet debugger here once
|
||||||
|
|
@ -1589,7 +1587,6 @@ breakContinue:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_COPYVAR_TO_NONE:
|
case OP_COPYVAR_TO_NONE:
|
||||||
// nop
|
|
||||||
gEvalState.copyVariable = NULL;
|
gEvalState.copyVariable = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1960,21 +1957,17 @@ breakContinue:
|
||||||
break;
|
break;
|
||||||
case OP_PUSH:
|
case OP_PUSH:
|
||||||
STR.push();
|
STR.push();
|
||||||
//Con::printf("Pushing str: %s",STR.getPreviousStringValue());
|
|
||||||
CSTK.pushString(STR.getPreviousStringValue());
|
CSTK.pushString(STR.getPreviousStringValue());
|
||||||
break;
|
break;
|
||||||
case OP_PUSH_UINT:
|
case OP_PUSH_UINT:
|
||||||
//Con::printf("Pushing int: %i",(S32)intStack[_UINT]);
|
|
||||||
CSTK.pushUINT(intStack[_UINT]);
|
CSTK.pushUINT(intStack[_UINT]);
|
||||||
_UINT--;
|
_UINT--;
|
||||||
break;
|
break;
|
||||||
case OP_PUSH_FLT:
|
case OP_PUSH_FLT:
|
||||||
//Con::printf("Pushing float: %f",(F32)intStack[_UINT]);
|
|
||||||
CSTK.pushFLT(floatStack[_FLT]);
|
CSTK.pushFLT(floatStack[_FLT]);
|
||||||
_FLT--;
|
_FLT--;
|
||||||
break;
|
break;
|
||||||
case OP_PUSH_VAR:
|
case OP_PUSH_VAR:
|
||||||
//Con::printf("Pushing variable: %s",gEvalState.getCurrentVariable()]);
|
|
||||||
if (gEvalState.currentVariable)
|
if (gEvalState.currentVariable)
|
||||||
CSTK.pushValue(gEvalState.currentVariable->value);
|
CSTK.pushValue(gEvalState.currentVariable->value);
|
||||||
else
|
else
|
||||||
|
|
@ -2162,9 +2155,8 @@ execFinished:
|
||||||
if ( telDebuggerOn && setFrame < 0 )
|
if ( telDebuggerOn && setFrame < 0 )
|
||||||
TelDebugger->popStackFrame();
|
TelDebugger->popStackFrame();
|
||||||
|
|
||||||
if ( popFrame ) {
|
if ( popFrame )
|
||||||
gEvalState.popFrame();
|
gEvalState.popFrame();
|
||||||
}
|
|
||||||
|
|
||||||
if(argv)
|
if(argv)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -778,9 +778,8 @@ Dictionary::Entry *getAddVariableEntry(const char *name)
|
||||||
name = prependDollar(name);
|
name = prependDollar(name);
|
||||||
StringTableEntry stName = StringTable->insert(name);
|
StringTableEntry stName = StringTable->insert(name);
|
||||||
Dictionary::Entry *entry = gEvalState.globalVars.lookup(stName);
|
Dictionary::Entry *entry = gEvalState.globalVars.lookup(stName);
|
||||||
if (!entry) {
|
if (!entry)
|
||||||
entry = gEvalState.globalVars.add(stName);
|
entry = gEvalState.globalVars.add(stName);
|
||||||
}
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -789,9 +788,8 @@ Dictionary::Entry *getAddLocalVariableEntry(const char *name)
|
||||||
name = prependPercent(name);
|
name = prependPercent(name);
|
||||||
StringTableEntry stName = StringTable->insert(name);
|
StringTableEntry stName = StringTable->insert(name);
|
||||||
Dictionary::Entry *entry = gEvalState.getCurrentFrame().lookup(stName);
|
Dictionary::Entry *entry = gEvalState.getCurrentFrame().lookup(stName);
|
||||||
if (!entry) {
|
if (!entry)
|
||||||
entry = gEvalState.getCurrentFrame().add(stName);
|
entry = gEvalState.getCurrentFrame().add(stName);
|
||||||
}
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -800,9 +798,12 @@ void setVariable(const char *name, const char *value)
|
||||||
SimObject *obj = NULL;
|
SimObject *obj = NULL;
|
||||||
const char *objField = NULL;
|
const char *objField = NULL;
|
||||||
|
|
||||||
if (getVariableObjectField(name, &obj, &objField)) {
|
if (getVariableObjectField(name, &obj, &objField))
|
||||||
|
{
|
||||||
obj->setDataField(StringTable->insert(objField), 0, value);
|
obj->setDataField(StringTable->insert(objField), 0, value);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
name = prependDollar(name);
|
name = prependDollar(name);
|
||||||
gEvalState.globalVars.setVariable(StringTable->insert(name), value);
|
gEvalState.globalVars.setVariable(StringTable->insert(name), value);
|
||||||
}
|
}
|
||||||
|
|
@ -819,9 +820,12 @@ void setBoolVariable(const char *varName, bool value)
|
||||||
SimObject *obj = NULL;
|
SimObject *obj = NULL;
|
||||||
const char *objField = NULL;
|
const char *objField = NULL;
|
||||||
|
|
||||||
if (getVariableObjectField(varName, &obj, &objField)) {
|
if (getVariableObjectField(varName, &obj, &objField))
|
||||||
|
{
|
||||||
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
|
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
varName = prependDollar(varName);
|
varName = prependDollar(varName);
|
||||||
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
||||||
entry->setStringValue(value ? "1" : "0");
|
entry->setStringValue(value ? "1" : "0");
|
||||||
|
|
@ -833,11 +837,14 @@ void setIntVariable(const char *varName, S32 value)
|
||||||
SimObject *obj = NULL;
|
SimObject *obj = NULL;
|
||||||
const char *objField = NULL;
|
const char *objField = NULL;
|
||||||
|
|
||||||
if (getVariableObjectField(varName, &obj, &objField)) {
|
if (getVariableObjectField(varName, &obj, &objField))
|
||||||
|
{
|
||||||
char scratchBuffer[32];
|
char scratchBuffer[32];
|
||||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
|
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
|
||||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
varName = prependDollar(varName);
|
varName = prependDollar(varName);
|
||||||
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
||||||
entry->setIntValue(value);
|
entry->setIntValue(value);
|
||||||
|
|
@ -849,11 +856,14 @@ void setFloatVariable(const char *varName, F32 value)
|
||||||
SimObject *obj = NULL;
|
SimObject *obj = NULL;
|
||||||
const char *objField = NULL;
|
const char *objField = NULL;
|
||||||
|
|
||||||
if (getVariableObjectField(varName, &obj, &objField)) {
|
if (getVariableObjectField(varName, &obj, &objField))
|
||||||
|
{
|
||||||
char scratchBuffer[32];
|
char scratchBuffer[32];
|
||||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
|
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
|
||||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
varName = prependDollar(varName);
|
varName = prependDollar(varName);
|
||||||
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
||||||
entry->setFloatValue(value);
|
entry->setFloatValue(value);
|
||||||
|
|
@ -951,9 +961,12 @@ const char *getObjectTokenField(const char *name)
|
||||||
const char *getVariable(const char *name)
|
const char *getVariable(const char *name)
|
||||||
{
|
{
|
||||||
const char *objField = getObjectTokenField(name);
|
const char *objField = getObjectTokenField(name);
|
||||||
if (objField) {
|
if (objField)
|
||||||
|
{
|
||||||
return objField;
|
return objField;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Dictionary::Entry *entry = getVariableEntry(name);
|
Dictionary::Entry *entry = getVariableEntry(name);
|
||||||
return entry ? entry->getStringValue() : "";
|
return entry ? entry->getStringValue() : "";
|
||||||
}
|
}
|
||||||
|
|
@ -969,9 +982,12 @@ const char *getLocalVariable(const char *name)
|
||||||
bool getBoolVariable(const char *varName, bool def)
|
bool getBoolVariable(const char *varName, bool def)
|
||||||
{
|
{
|
||||||
const char *objField = getObjectTokenField(varName);
|
const char *objField = getObjectTokenField(varName);
|
||||||
if (objField) {
|
if (objField)
|
||||||
|
{
|
||||||
return *objField ? dAtob(objField) : def;
|
return *objField ? dAtob(objField) : def;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Dictionary::Entry *entry = getVariableEntry(varName);
|
Dictionary::Entry *entry = getVariableEntry(varName);
|
||||||
objField = entry ? entry->getStringValue() : "";
|
objField = entry ? entry->getStringValue() : "";
|
||||||
return *objField ? dAtob(objField) : def;
|
return *objField ? dAtob(objField) : def;
|
||||||
|
|
@ -981,9 +997,12 @@ bool getBoolVariable(const char *varName, bool def)
|
||||||
S32 getIntVariable(const char *varName, S32 def)
|
S32 getIntVariable(const char *varName, S32 def)
|
||||||
{
|
{
|
||||||
const char *objField = getObjectTokenField(varName);
|
const char *objField = getObjectTokenField(varName);
|
||||||
if (objField) {
|
if (objField)
|
||||||
|
{
|
||||||
return *objField ? dAtoi(objField) : def;
|
return *objField ? dAtoi(objField) : def;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Dictionary::Entry *entry = getVariableEntry(varName);
|
Dictionary::Entry *entry = getVariableEntry(varName);
|
||||||
return entry ? entry->getIntValue() : def;
|
return entry ? entry->getIntValue() : def;
|
||||||
}
|
}
|
||||||
|
|
@ -992,9 +1011,12 @@ S32 getIntVariable(const char *varName, S32 def)
|
||||||
F32 getFloatVariable(const char *varName, F32 def)
|
F32 getFloatVariable(const char *varName, F32 def)
|
||||||
{
|
{
|
||||||
const char *objField = getObjectTokenField(varName);
|
const char *objField = getObjectTokenField(varName);
|
||||||
if (objField) {
|
if (objField)
|
||||||
|
{
|
||||||
return *objField ? dAtof(objField) : def;
|
return *objField ? dAtof(objField) : def;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Dictionary::Entry *entry = getVariableEntry(varName);
|
Dictionary::Entry *entry = getVariableEntry(varName);
|
||||||
return entry ? entry->getFloatValue() : def;
|
return entry ? entry->getFloatValue() : def;
|
||||||
}
|
}
|
||||||
|
|
@ -1154,7 +1176,7 @@ const char *execute(S32 argc, ConsoleValueRef argv[])
|
||||||
|
|
||||||
if(!ent)
|
if(!ent)
|
||||||
{
|
{
|
||||||
warnf(ConsoleLogEntry::Script, "%s: Unknown command.", argv[0]);
|
warnf(ConsoleLogEntry::Script, "%s: Unknown command.", (const char*)argv[0]);
|
||||||
|
|
||||||
// Clean up arg buffers, if any.
|
// Clean up arg buffers, if any.
|
||||||
STR.clearFunctionOffset();
|
STR.clearFunctionOffset();
|
||||||
|
|
@ -1184,7 +1206,6 @@ const char *execute(S32 argc, const char *argv[])
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
const char *execute(SimObject *object, S32 argc, ConsoleValueRef argv[], bool thisCallOnly)
|
const char *execute(SimObject *object, S32 argc, ConsoleValueRef argv[], bool thisCallOnly)
|
||||||
{
|
{
|
||||||
//static char idBuf[16];
|
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
@ -1194,7 +1215,8 @@ const char *execute(SimObject *object, S32 argc, ConsoleValueRef argv[], bool th
|
||||||
if( !thisCallOnly )
|
if( !thisCallOnly )
|
||||||
{
|
{
|
||||||
ICallMethod *com = dynamic_cast<ICallMethod *>(object);
|
ICallMethod *com = dynamic_cast<ICallMethod *>(object);
|
||||||
if(com) {
|
if(com)
|
||||||
|
{
|
||||||
STR.pushFrame();
|
STR.pushFrame();
|
||||||
CSTK.pushFrame();
|
CSTK.pushFrame();
|
||||||
com->callMethodArgList(argc, argv, false);
|
com->callMethodArgList(argc, argv, false);
|
||||||
|
|
@ -1218,7 +1240,6 @@ const char *execute(SimObject *object, S32 argc, ConsoleValueRef argv[], bool th
|
||||||
//warnf(ConsoleLogEntry::Script, "%s: undefined for object '%s' - id %d", funcName, object->getName(), object->getId());
|
//warnf(ConsoleLogEntry::Script, "%s: undefined for object '%s' - id %d", funcName, object->getName(), object->getId());
|
||||||
|
|
||||||
// Clean up arg buffers, if any.
|
// Clean up arg buffers, if any.
|
||||||
//CSTK.
|
|
||||||
STR.clearFunctionOffset();
|
STR.clearFunctionOffset();
|
||||||
CSTK.resetFrame();
|
CSTK.resetFrame();
|
||||||
return "";
|
return "";
|
||||||
|
|
@ -1237,7 +1258,7 @@ const char *execute(SimObject *object, S32 argc, ConsoleValueRef argv[], bool th
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
warnf(ConsoleLogEntry::Script, "Con::execute - %d has no namespace: %s", object->getId(), argv[0]);
|
warnf(ConsoleLogEntry::Script, "Con::execute - %d has no namespace: %s", object->getId(), (const char*)argv[0]);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1252,7 +1273,7 @@ inline const char*_executef(SimObject *obj, S32 checkArgc, S32 argc, ConsoleValu
|
||||||
const U32 maxArg = 12;
|
const U32 maxArg = 12;
|
||||||
AssertWarn(checkArgc == argc, "Incorrect arg count passed to Con::executef(SimObject*)");
|
AssertWarn(checkArgc == argc, "Incorrect arg count passed to Con::executef(SimObject*)");
|
||||||
AssertFatal(argc <= maxArg - 1, "Too many args passed to Con::_executef(SimObject*). Please update the function to handle more.");
|
AssertFatal(argc <= maxArg - 1, "Too many args passed to Con::_executef(SimObject*). Please update the function to handle more.");
|
||||||
return execute(obj, argc, argv); // jamesu - argc should == argc
|
return execute(obj, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define A ConsoleValueRef
|
#define A ConsoleValueRef
|
||||||
|
|
@ -1589,14 +1610,16 @@ StringStackWrapper::StringStackWrapper(int targc, ConsoleValueRef targv[])
|
||||||
argv = new const char*[targc];
|
argv = new const char*[targc];
|
||||||
argc = targc;
|
argc = targc;
|
||||||
|
|
||||||
for (int i=0; i<targc; i++) {
|
for (int i=0; i<targc; i++)
|
||||||
|
{
|
||||||
argv[i] = dStrdup(targv[i]);
|
argv[i] = dStrdup(targv[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringStackWrapper::~StringStackWrapper()
|
StringStackWrapper::~StringStackWrapper()
|
||||||
{
|
{
|
||||||
for (int i=0; i<argc; i++) {
|
for (int i=0; i<argc; i++)
|
||||||
|
{
|
||||||
dFree(argv[i]);
|
dFree(argv[i]);
|
||||||
}
|
}
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
|
|
@ -1615,7 +1638,8 @@ StringStackConsoleWrapper::StringStackConsoleWrapper(int targc, const char** tar
|
||||||
|
|
||||||
StringStackConsoleWrapper::~StringStackConsoleWrapper()
|
StringStackConsoleWrapper::~StringStackConsoleWrapper()
|
||||||
{
|
{
|
||||||
for (int i=0; i<argc; i++) {
|
for (int i=0; i<argc; i++)
|
||||||
|
{
|
||||||
argv[i] = NULL;
|
argv[i] = NULL;
|
||||||
}
|
}
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
|
|
@ -1623,24 +1647,24 @@ StringStackConsoleWrapper::~StringStackConsoleWrapper()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
U32 ConsoleValue::getIntValue()
|
U32 ConsoleValue::getIntValue()
|
||||||
{
|
{
|
||||||
if(type <= TypeInternalString)
|
if(type <= TypeInternalString)
|
||||||
return ival;
|
return ival;
|
||||||
else
|
else
|
||||||
return dAtoi(Con::getData(type, dataPtr, 0, enumTable));
|
return dAtoi(Con::getData(type, dataPtr, 0, enumTable));
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 ConsoleValue::getFloatValue()
|
F32 ConsoleValue::getFloatValue()
|
||||||
{
|
{
|
||||||
if(type <= TypeInternalString)
|
if(type <= TypeInternalString)
|
||||||
return fval;
|
return fval;
|
||||||
else
|
else
|
||||||
return dAtof(Con::getData(type, dataPtr, 0, enumTable));
|
return dAtof(Con::getData(type, dataPtr, 0, enumTable));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *ConsoleValue::getStringValue()
|
const char *ConsoleValue::getStringValue()
|
||||||
{
|
{
|
||||||
if(type == TypeInternalString || type == TypeInternalStackString)
|
if(type == TypeInternalString || type == TypeInternalStackString)
|
||||||
return sval;
|
return sval;
|
||||||
if(type == TypeInternalFloat)
|
if(type == TypeInternalFloat)
|
||||||
|
|
@ -1649,10 +1673,10 @@ StringStackConsoleWrapper::~StringStackConsoleWrapper()
|
||||||
return Con::getData(TypeS32, &ival, 0);
|
return Con::getData(TypeS32, &ival, 0);
|
||||||
else
|
else
|
||||||
return Con::getData(type, dataPtr, 0, enumTable);
|
return Con::getData(type, dataPtr, 0, enumTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleValue::setIntValue(U32 val)
|
void ConsoleValue::setIntValue(U32 val)
|
||||||
{
|
{
|
||||||
if(type <= TypeInternalString)
|
if(type <= TypeInternalString)
|
||||||
{
|
{
|
||||||
fval = (F32)val;
|
fval = (F32)val;
|
||||||
|
|
@ -1669,10 +1693,10 @@ StringStackConsoleWrapper::~StringStackConsoleWrapper()
|
||||||
const char *dptr = Con::getData(TypeS32, &val, 0);
|
const char *dptr = Con::getData(TypeS32, &val, 0);
|
||||||
Con::setData(type, dataPtr, 0, 1, &dptr, enumTable);
|
Con::setData(type, dataPtr, 0, 1, &dptr, enumTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleValue::setFloatValue(F32 val)
|
void ConsoleValue::setFloatValue(F32 val)
|
||||||
{
|
{
|
||||||
if(type <= TypeInternalString)
|
if(type <= TypeInternalString)
|
||||||
{
|
{
|
||||||
fval = val;
|
fval = val;
|
||||||
|
|
@ -1689,20 +1713,22 @@ StringStackConsoleWrapper::~StringStackConsoleWrapper()
|
||||||
const char *dptr = Con::getData(TypeF32, &val, 0);
|
const char *dptr = Con::getData(TypeF32, &val, 0);
|
||||||
Con::setData(type, dataPtr, 0, 1, &dptr, enumTable);
|
Con::setData(type, dataPtr, 0, 1, &dptr, enumTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *ConsoleValueRef::getStringArgValue()
|
const char *ConsoleValueRef::getStringArgValue()
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
{
|
{
|
||||||
if (value) {
|
if (stringStackValue == NULL)
|
||||||
if (stringStackValue == NULL) {
|
|
||||||
stringStackValue = Con::getStringArg(value->getStringValue());
|
stringStackValue = Con::getStringArg(value->getStringValue());
|
||||||
}
|
|
||||||
return stringStackValue;
|
return stringStackValue;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern ConsoleValueStack CSTK;
|
extern ConsoleValueStack CSTK;
|
||||||
|
|
|
||||||
|
|
@ -197,9 +197,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Proxy class for console variables
|
// Proxy class for console variables
|
||||||
// Can point to existing console variables
|
// Can point to existing console variables,
|
||||||
// or act like a free floating value
|
// or act like a free floating value.
|
||||||
class ConsoleValueRef {
|
class ConsoleValueRef
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ConsoleValue *value;
|
ConsoleValue *value;
|
||||||
const char *stringStackValue;
|
const char *stringStackValue;
|
||||||
|
|
@ -219,13 +220,11 @@ public:
|
||||||
|
|
||||||
inline S32 getIntValue() { return value ? value->getIntValue() : 0; }
|
inline S32 getIntValue() { return value ? value->getIntValue() : 0; }
|
||||||
inline F32 getFloatValue() { return value ? value->getFloatValue() : 0.0f; }
|
inline F32 getFloatValue() { return value ? value->getFloatValue() : 0.0f; }
|
||||||
//inline F64 getDoubleValue() { return value ? value->getDoubleValue() : 0.0; }
|
|
||||||
|
|
||||||
inline operator const char*() { return getStringValue(); }
|
inline operator const char*() { return getStringValue(); }
|
||||||
inline operator String() { return String(getStringValue()); }
|
inline operator String() { return String(getStringValue()); }
|
||||||
inline operator S32() { return getIntValue(); }
|
inline operator S32() { return getIntValue(); }
|
||||||
inline operator F32() { return getFloatValue(); }
|
inline operator F32() { return getFloatValue(); }
|
||||||
//inline operator F64() { return getDoubleValue(); }
|
|
||||||
|
|
||||||
inline bool isString() { return value ? value->type >= ConsoleValue::TypeInternalStackString : true; }
|
inline bool isString() { return value ? value->type >= ConsoleValue::TypeInternalStackString : true; }
|
||||||
inline bool isInt() { return value ? value->type == ConsoleValue::TypeInternalInt : false; }
|
inline bool isInt() { return value ? value->type == ConsoleValue::TypeInternalInt : false; }
|
||||||
|
|
@ -239,6 +238,19 @@ public:
|
||||||
ConsoleValueRef& operator=(F64 newValue);
|
ConsoleValueRef& operator=(F64 newValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Overrides to allow ConsoleValueRefs to be directly converted to S32&F32
|
||||||
|
|
||||||
|
inline S32 dAtoi(ConsoleValueRef &ref)
|
||||||
|
{
|
||||||
|
return ref.getIntValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline F32 dAtof(ConsoleValueRef &ref)
|
||||||
|
{
|
||||||
|
return ref.getFloatValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Transparently converts ConsoleValue[] to const char**
|
// Transparently converts ConsoleValue[] to const char**
|
||||||
class StringStackWrapper
|
class StringStackWrapper
|
||||||
{
|
{
|
||||||
|
|
@ -342,6 +354,7 @@ namespace Con
|
||||||
/// 09/12/07 - CAF - 43->44 remove newmsg operator
|
/// 09/12/07 - CAF - 43->44 remove newmsg operator
|
||||||
/// 09/27/07 - RDB - 44->45 Patch from Andreas Kirsch: Added opcode to support correct void return
|
/// 09/27/07 - RDB - 44->45 Patch from Andreas Kirsch: Added opcode to support correct void return
|
||||||
/// 01/13/09 - TMS - 45->46 Added script assert
|
/// 01/13/09 - TMS - 45->46 Added script assert
|
||||||
|
/// 10/11/12 - JU - 46->47 Added opcodes to reduce reliance on strings in function calls
|
||||||
DSOVersion = 47,
|
DSOVersion = 47,
|
||||||
|
|
||||||
MaxLineLength = 512, ///< Maximum length of a line of console input.
|
MaxLineLength = 512, ///< Maximum length of a line of console input.
|
||||||
|
|
@ -807,8 +820,8 @@ namespace Con
|
||||||
char* getReturnBuffer( const StringBuilder& str );
|
char* getReturnBuffer( const StringBuilder& str );
|
||||||
|
|
||||||
char* getArgBuffer(U32 bufferSize);
|
char* getArgBuffer(U32 bufferSize);
|
||||||
char* getFloatArg(F64 arg);
|
ConsoleValueRef getFloatArg(F64 arg);
|
||||||
char* getIntArg (S32 arg);
|
ConsoleValueRef getIntArg (S32 arg);
|
||||||
char* getStringArg( const char *arg );
|
char* getStringArg( const char *arg );
|
||||||
char* getStringArg( const String& arg );
|
char* getStringArg( const String& arg );
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
||||||
|
|
@ -2364,7 +2364,7 @@ ConsoleFunction(isDefined, bool, 2, 3, "(string varName)"
|
||||||
if (dStrcmp(argv[1], "0") && dStrcmp(argv[1], "") && (Sim::findObject(argv[1]) != NULL))
|
if (dStrcmp(argv[1], "0") && dStrcmp(argv[1], "") && (Sim::findObject(argv[1]) != NULL))
|
||||||
return true;
|
return true;
|
||||||
else if (argc > 2)
|
else if (argc > 2)
|
||||||
Con::errorf("%s() - can't assign a value to a variable of the form \"%s\"", __FUNCTION__, argv[1]);
|
Con::errorf("%s() - can't assign a value to a variable of the form \"%s\"", __FUNCTION__, (const char*)argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -2419,7 +2419,7 @@ ConsoleFunction(getPrefsPath, const char *, 1, 2, "([relativeFileName])"
|
||||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||||
"@internal")
|
"@internal")
|
||||||
{
|
{
|
||||||
const char *filename = Platform::getPrefsPath(argc > 1 ? argv[1] : NULL);
|
const char *filename = Platform::getPrefsPath(argc > 1 ? (const char*)argv[1] : NULL);
|
||||||
if(filename == NULL || *filename == 0)
|
if(filename == NULL || *filename == 0)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,45 +34,6 @@
|
||||||
|
|
||||||
//#define DEBUG_SPEW
|
//#define DEBUG_SPEW
|
||||||
|
|
||||||
|
|
||||||
Dictionary::Entry smLocalDictionaryEntryStack[4096*4];
|
|
||||||
Dictionary::Entry *smLocalDictionaryEntryStackHead = NULL;
|
|
||||||
|
|
||||||
void setupDictionaryStack()
|
|
||||||
{
|
|
||||||
smLocalDictionaryEntryStackHead = &smLocalDictionaryEntryStack[0];
|
|
||||||
|
|
||||||
for (int i=0; i<4096*4; i++) {
|
|
||||||
(smLocalDictionaryEntryStackHead + i)->mNext = i == (4096*4)-1 ? NULL : smLocalDictionaryEntryStackHead + (i+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Dictionary::Entry * getDictionaryStackEntry()
|
|
||||||
{
|
|
||||||
Dictionary::Entry *entry = smLocalDictionaryEntryStackHead;
|
|
||||||
AssertFatal(entry, "No more local variables");
|
|
||||||
|
|
||||||
entry->reset();
|
|
||||||
|
|
||||||
Dictionary::Entry *next = entry->mNext;
|
|
||||||
|
|
||||||
smLocalDictionaryEntryStackHead = next;
|
|
||||||
|
|
||||||
entry->mNext = NULL;
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
|
||||||
|
|
||||||
void disposeDictionaryStackEntry(Dictionary::Entry *entry)
|
|
||||||
{
|
|
||||||
Dictionary::Entry *prevHead = smLocalDictionaryEntryStackHead;
|
|
||||||
smLocalDictionaryEntryStackHead = entry;
|
|
||||||
|
|
||||||
smLocalDictionaryEntryStackHead->mNext = prevHead;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define ST_INIT_SIZE 15
|
#define ST_INIT_SIZE 15
|
||||||
|
|
||||||
static char scratchBuffer[1024];
|
static char scratchBuffer[1024];
|
||||||
|
|
@ -325,10 +286,8 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name)
|
||||||
//printf("Add Variable %s\n", name);
|
//printf("Add Variable %s\n", name);
|
||||||
|
|
||||||
Entry* ret = lookup( name );
|
Entry* ret = lookup( name );
|
||||||
if( ret ) {
|
if( ret )
|
||||||
//printf("Found Variable %s (named %s)\n", name, ret->name);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
// Rehash if the table get's too crowded. Be aware that this might
|
// Rehash if the table get's too crowded. Be aware that this might
|
||||||
// modify a table that we don't own.
|
// modify a table that we don't own.
|
||||||
|
|
@ -337,7 +296,6 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name)
|
||||||
if( hashTable->count > hashTable->size * 2 )
|
if( hashTable->count > hashTable->size * 2 )
|
||||||
{
|
{
|
||||||
// Allocate a new table.
|
// Allocate a new table.
|
||||||
printf("Re-hashing dictionary...\n");
|
|
||||||
|
|
||||||
const U32 newTableSize = hashTable->size * 4 - 1;
|
const U32 newTableSize = hashTable->size * 4 - 1;
|
||||||
Entry** newTableData = new Entry*[ newTableSize ];
|
Entry** newTableData = new Entry*[ newTableSize ];
|
||||||
|
|
@ -351,9 +309,6 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name)
|
||||||
Entry* next = entry->nextEntry;
|
Entry* next = entry->nextEntry;
|
||||||
U32 index = HashPointer( entry->name ) % newTableSize;
|
U32 index = HashPointer( entry->name ) % newTableSize;
|
||||||
|
|
||||||
|
|
||||||
//printf(" Variable(%s) in bucket %i moved to bucket %i\n", entry->name, i, index);
|
|
||||||
|
|
||||||
entry->nextEntry = newTableData[ index ];
|
entry->nextEntry = newTableData[ index ];
|
||||||
newTableData[ index ] = entry;
|
newTableData[ index ] = entry;
|
||||||
|
|
||||||
|
|
@ -373,9 +328,8 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name)
|
||||||
|
|
||||||
// Add the new entry.
|
// Add the new entry.
|
||||||
|
|
||||||
ret = getDictionaryStackEntry();//hashTable->mChunker.alloc();
|
ret = hashTable->mChunker.alloc();
|
||||||
ret->name = name;
|
constructInPlace( ret, name );
|
||||||
//constructInPlace( ret, name );
|
|
||||||
U32 idx = HashPointer(name) % hashTable->size;
|
U32 idx = HashPointer(name) % hashTable->size;
|
||||||
ret->nextEntry = hashTable->data[idx];
|
ret->nextEntry = hashTable->data[idx];
|
||||||
hashTable->data[idx] = ret;
|
hashTable->data[idx] = ret;
|
||||||
|
|
@ -396,8 +350,8 @@ void Dictionary::remove(Dictionary::Entry *ent)
|
||||||
|
|
||||||
*walk = (ent->nextEntry);
|
*walk = (ent->nextEntry);
|
||||||
|
|
||||||
disposeDictionaryStackEntry( ent );
|
destructInPlace( ent );
|
||||||
//hashTable->mChunker.free( ent );
|
hashTable->mChunker.free( ent );
|
||||||
|
|
||||||
hashTable->count--;
|
hashTable->count--;
|
||||||
}
|
}
|
||||||
|
|
@ -458,13 +412,13 @@ void Dictionary::reset()
|
||||||
while( walk )
|
while( walk )
|
||||||
{
|
{
|
||||||
Entry* temp = walk->nextEntry;
|
Entry* temp = walk->nextEntry;
|
||||||
disposeDictionaryStackEntry( walk );
|
destructInPlace( walk );
|
||||||
walk = temp;
|
walk = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dMemset( ownHashTable.data, 0, ownHashTable.size * sizeof( Entry* ) );
|
dMemset( ownHashTable.data, 0, ownHashTable.size * sizeof( Entry* ) );
|
||||||
//ownHashTable.mChunker.freeBlocks( true );
|
ownHashTable.mChunker.freeBlocks( true );
|
||||||
|
|
||||||
ownHashTable.count = 0;
|
ownHashTable.count = 0;
|
||||||
hashTable = NULL;
|
hashTable = NULL;
|
||||||
|
|
@ -556,7 +510,8 @@ void ConsoleValue::setStringValue(const char * value)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (value == typeValueEmpty) {
|
if (value == typeValueEmpty)
|
||||||
|
{
|
||||||
if (sval && sval != typeValueEmpty && type != TypeInternalStackString) dFree(sval);
|
if (sval && sval != typeValueEmpty && type != TypeInternalStackString) dFree(sval);
|
||||||
sval = typeValueEmpty;
|
sval = typeValueEmpty;
|
||||||
bufferLen = 0;
|
bufferLen = 0;
|
||||||
|
|
@ -607,7 +562,8 @@ void ConsoleValue::setStackStringValue(const char * value)
|
||||||
|
|
||||||
if(type <= ConsoleValue::TypeInternalString)
|
if(type <= ConsoleValue::TypeInternalString)
|
||||||
{
|
{
|
||||||
if (value == typeValueEmpty) {
|
if (value == typeValueEmpty)
|
||||||
|
{
|
||||||
if (sval && sval != typeValueEmpty && type != ConsoleValue::TypeInternalStackString) dFree(sval);
|
if (sval && sval != typeValueEmpty && type != ConsoleValue::TypeInternalStackString) dFree(sval);
|
||||||
sval = typeValueEmpty;
|
sval = typeValueEmpty;
|
||||||
bufferLen = 0;
|
bufferLen = 0;
|
||||||
|
|
@ -647,6 +603,7 @@ S32 Dictionary::getIntVariable(StringTableEntry name, bool *entValid)
|
||||||
*entValid = true;
|
*entValid = true;
|
||||||
return ent->getIntValue();
|
return ent->getIntValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entValid)
|
if(entValid)
|
||||||
*entValid = false;
|
*entValid = false;
|
||||||
|
|
||||||
|
|
@ -662,6 +619,7 @@ F32 Dictionary::getFloatVariable(StringTableEntry name, bool *entValid)
|
||||||
*entValid = true;
|
*entValid = true;
|
||||||
return ent->getFloatValue();
|
return ent->getFloatValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entValid)
|
if(entValid)
|
||||||
*entValid = false;
|
*entValid = false;
|
||||||
|
|
||||||
|
|
@ -1141,8 +1099,6 @@ void Namespace::init()
|
||||||
mGlobalNamespace->mName = NULL;
|
mGlobalNamespace->mName = NULL;
|
||||||
mGlobalNamespace->mNext = NULL;
|
mGlobalNamespace->mNext = NULL;
|
||||||
mNamespaceList = mGlobalNamespace;
|
mNamespaceList = mGlobalNamespace;
|
||||||
|
|
||||||
setupDictionaryStack();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Namespace *Namespace::global()
|
Namespace *Namespace::global()
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ inline void EngineMarshallData( bool arg, S32& argc, ConsoleValueRef *argv )
|
||||||
}
|
}
|
||||||
inline void EngineMarshallData( S32 arg, S32& argc, ConsoleValueRef *argv )
|
inline void EngineMarshallData( S32 arg, S32& argc, ConsoleValueRef *argv )
|
||||||
{
|
{
|
||||||
argv[ argc ] = Con::getIntArg( arg );
|
argv[ argc ] = arg;
|
||||||
argc ++;
|
argc ++;
|
||||||
}
|
}
|
||||||
inline void EngineMarshallData( U32 arg, S32& argc, ConsoleValueRef *argv )
|
inline void EngineMarshallData( U32 arg, S32& argc, ConsoleValueRef *argv )
|
||||||
|
|
@ -169,7 +169,7 @@ inline void EngineMarshallData( U32 arg, S32& argc, ConsoleValueRef *argv )
|
||||||
}
|
}
|
||||||
inline void EngineMarshallData( F32 arg, S32& argc, ConsoleValueRef *argv )
|
inline void EngineMarshallData( F32 arg, S32& argc, ConsoleValueRef *argv )
|
||||||
{
|
{
|
||||||
argv[ argc ] = Con::getFloatArg( arg );
|
argv[ argc ] = arg;
|
||||||
argc ++;
|
argc ++;
|
||||||
}
|
}
|
||||||
inline void EngineMarshallData( const char* arg, S32& argc, ConsoleValueRef *argv )
|
inline void EngineMarshallData( const char* arg, S32& argc, ConsoleValueRef *argv )
|
||||||
|
|
@ -207,6 +207,11 @@ struct EngineUnmarshallData
|
||||||
template<>
|
template<>
|
||||||
struct EngineUnmarshallData< S32 >
|
struct EngineUnmarshallData< S32 >
|
||||||
{
|
{
|
||||||
|
S32 operator()( ConsoleValueRef &ref ) const
|
||||||
|
{
|
||||||
|
return (S32)ref;
|
||||||
|
}
|
||||||
|
|
||||||
S32 operator()( const char* str ) const
|
S32 operator()( const char* str ) const
|
||||||
{
|
{
|
||||||
return dAtoi( str );
|
return dAtoi( str );
|
||||||
|
|
@ -215,6 +220,11 @@ struct EngineUnmarshallData< S32 >
|
||||||
template<>
|
template<>
|
||||||
struct EngineUnmarshallData< U32 >
|
struct EngineUnmarshallData< U32 >
|
||||||
{
|
{
|
||||||
|
U32 operator()( ConsoleValueRef &ref ) const
|
||||||
|
{
|
||||||
|
return (U32)((S32)ref);
|
||||||
|
}
|
||||||
|
|
||||||
U32 operator()( const char* str ) const
|
U32 operator()( const char* str ) const
|
||||||
{
|
{
|
||||||
return dAtoui( str );
|
return dAtoui( str );
|
||||||
|
|
@ -223,6 +233,11 @@ struct EngineUnmarshallData< U32 >
|
||||||
template<>
|
template<>
|
||||||
struct EngineUnmarshallData< F32 >
|
struct EngineUnmarshallData< F32 >
|
||||||
{
|
{
|
||||||
|
F32 operator()( ConsoleValueRef &ref ) const
|
||||||
|
{
|
||||||
|
return (F32)ref;
|
||||||
|
}
|
||||||
|
|
||||||
F32 operator()( const char* str ) const
|
F32 operator()( const char* str ) const
|
||||||
{
|
{
|
||||||
return dAtof( str );
|
return dAtof( str );
|
||||||
|
|
@ -2629,7 +2644,7 @@ struct _EngineConsoleCallbackHelper
|
||||||
if (mThis->isProperlyAdded()) {
|
if (mThis->isProperlyAdded()) {
|
||||||
return Con::execute( mThis, mArgc, mArgv );
|
return Con::execute( mThis, mArgc, mArgv );
|
||||||
} else {
|
} else {
|
||||||
Con::resetStackFrame(); // jamesu - we might have pushed some vars here
|
Con::resetStackFrame(); // We might have pushed some vars here
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ ConsoleMethod(FieldBrushObject, copyFields, void, 3, 4, "(simObject, [fieldList]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch field list.
|
// Fetch field list.
|
||||||
const char* pFieldList = (argc > 3 ) ? argv[3] : NULL;
|
const char* pFieldList = (argc > 3 ) ? (const char*)argv[3] : NULL;
|
||||||
|
|
||||||
// Copy Fields.
|
// Copy Fields.
|
||||||
object->copyFields( pSimObject, pFieldList );
|
object->copyFields( pSimObject, pFieldList );
|
||||||
|
|
|
||||||
|
|
@ -2204,7 +2204,7 @@ ConsoleMethod( PersistenceManager, setDirty, void, 3, 4, "(SimObject object, [fi
|
||||||
{
|
{
|
||||||
if (!Sim::findObject(argv[2], dirtyObject))
|
if (!Sim::findObject(argv[2], dirtyObject))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid SimObject: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2213,7 +2213,7 @@ ConsoleMethod( PersistenceManager, setDirty, void, 3, 4, "(SimObject object, [fi
|
||||||
|
|
||||||
if( dirtyObject == Sim::getRootGroup() )
|
if( dirtyObject == Sim::getRootGroup() )
|
||||||
{
|
{
|
||||||
Con::errorf( "%s(): Cannot save RootGroup", argv[ 0 ] );
|
Con::errorf( "%s(): Cannot save RootGroup", (const char*)argv[ 0 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2234,7 +2234,7 @@ ConsoleMethod( PersistenceManager, removeDirty, void, 3, 3, "(SimObject object)"
|
||||||
{
|
{
|
||||||
if (!Sim::findObject(argv[2], dirtyObject))
|
if (!Sim::findObject(argv[2], dirtyObject))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid SimObject: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2251,7 +2251,7 @@ ConsoleMethod( PersistenceManager, isDirty, bool, 3, 3, "(SimObject object)"
|
||||||
{
|
{
|
||||||
if (!Sim::findObject(argv[2], dirtyObject))
|
if (!Sim::findObject(argv[2], dirtyObject))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid SimObject: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2280,7 +2280,7 @@ ConsoleMethod( PersistenceManager, getDirtyObject, S32, 3, 3, "( index )"
|
||||||
const S32 index = dAtoi( argv[2] );
|
const S32 index = dAtoi( argv[2] );
|
||||||
if ( index < 0 || index >= object->getDirtyList().size() )
|
if ( index < 0 || index >= object->getDirtyList().size() )
|
||||||
{
|
{
|
||||||
Con::warnf( "PersistenceManager::getDirtyObject() - Index (%s) out of range.", argv[2] );
|
Con::warnf( "PersistenceManager::getDirtyObject() - Index (%s) out of range.", (const char*)argv[2] );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2333,7 +2333,7 @@ ConsoleMethod( PersistenceManager, saveDirtyObject, bool, 3, 3, "(SimObject obje
|
||||||
{
|
{
|
||||||
if (!Sim::findObject(argv[2], dirtyObject))
|
if (!Sim::findObject(argv[2], dirtyObject))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid SimObject: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2358,7 +2358,7 @@ ConsoleMethod( PersistenceManager, removeObjectFromFile, void, 3, 4, "(SimObject
|
||||||
{
|
{
|
||||||
if (!Sim::findObject(argv[2], dirtyObject))
|
if (!Sim::findObject(argv[2], dirtyObject))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid SimObject: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2380,7 +2380,7 @@ ConsoleMethod( PersistenceManager, removeField, void, 4, 4, "(SimObject object,
|
||||||
{
|
{
|
||||||
if (!Sim::findObject(argv[2], dirtyObject))
|
if (!Sim::findObject(argv[2], dirtyObject))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid SimObject: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid SimObject: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -138,20 +138,20 @@ ConsoleDocFragment _spawnObject1(
|
||||||
ConsoleFunction(spawnObject, S32, 3, 6, "spawnObject(class [, dataBlock, name, properties, script])"
|
ConsoleFunction(spawnObject, S32, 3, 6, "spawnObject(class [, dataBlock, name, properties, script])"
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
String spawnClass((String)argv[1]);
|
String spawnClass((const char*)argv[1]);
|
||||||
String spawnDataBlock;
|
String spawnDataBlock;
|
||||||
String spawnName;
|
String spawnName;
|
||||||
String spawnProperties;
|
String spawnProperties;
|
||||||
String spawnScript;
|
String spawnScript;
|
||||||
|
|
||||||
if (argc >= 3)
|
if (argc >= 3)
|
||||||
spawnDataBlock = (String)argv[2];
|
spawnDataBlock = (const char*)argv[2];
|
||||||
if (argc >= 4)
|
if (argc >= 4)
|
||||||
spawnName = (String)argv[3];
|
spawnName = (const char*)argv[3];
|
||||||
if (argc >= 5)
|
if (argc >= 5)
|
||||||
spawnProperties = (String)argv[4];
|
spawnProperties = (const char*)argv[4];
|
||||||
if (argc >= 6)
|
if (argc >= 6)
|
||||||
spawnScript = (String)argv[5];
|
spawnScript = (const char*)argv[5];
|
||||||
|
|
||||||
SimObject* spawnObject = Sim::spawnObject(spawnClass, spawnDataBlock, spawnName, spawnProperties, spawnScript);
|
SimObject* spawnObject = Sim::spawnObject(spawnClass, spawnDataBlock, spawnName, spawnProperties, spawnScript);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,9 @@
|
||||||
#ifndef _MODULE_H_
|
#ifndef _MODULE_H_
|
||||||
#include "core/module.h"
|
#include "core/module.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _CONSOLE_H_
|
||||||
|
#include "console/console.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Forward Refs
|
// Forward Refs
|
||||||
class SimSet;
|
class SimSet;
|
||||||
|
|
@ -122,9 +125,15 @@ namespace Sim
|
||||||
SimDataBlockGroup *getDataBlockGroup();
|
SimDataBlockGroup *getDataBlockGroup();
|
||||||
SimGroup* getRootGroup();
|
SimGroup* getRootGroup();
|
||||||
|
|
||||||
|
SimObject* findObject(ConsoleValueRef&);
|
||||||
SimObject* findObject(SimObjectId);
|
SimObject* findObject(SimObjectId);
|
||||||
SimObject* findObject(const char* name);
|
SimObject* findObject(const char* name);
|
||||||
SimObject* findObject(const char* fileName, S32 declarationLine);
|
SimObject* findObject(const char* fileName, S32 declarationLine);
|
||||||
|
template<class T> inline bool findObject(ConsoleValueRef &ref,T*&t)
|
||||||
|
{
|
||||||
|
t = dynamic_cast<T*>(findObject(ref));
|
||||||
|
return t != NULL;
|
||||||
|
}
|
||||||
template<class T> inline bool findObject(SimObjectId iD,T*&t)
|
template<class T> inline bool findObject(SimObjectId iD,T*&t)
|
||||||
{
|
{
|
||||||
t = dynamic_cast<T*>(findObject(iD));
|
t = dynamic_cast<T*>(findObject(iD));
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ SimConsoleEvent::SimConsoleEvent(S32 argc, ConsoleValueRef *argv, bool onObject)
|
||||||
mArgc = argc;
|
mArgc = argc;
|
||||||
|
|
||||||
mArgv = new ConsoleValueRef[argc];
|
mArgv = new ConsoleValueRef[argc];
|
||||||
for (int i=0; i<argc; i++) {
|
for (int i=0; i<argc; i++)
|
||||||
|
{
|
||||||
mArgv[i].value = new ConsoleValue();
|
mArgv[i].value = new ConsoleValue();
|
||||||
mArgv[i].value->type = ConsoleValue::TypeInternalString;
|
mArgv[i].value->type = ConsoleValue::TypeInternalString;
|
||||||
mArgv[i].value->init();
|
mArgv[i].value->init();
|
||||||
|
|
@ -44,7 +45,8 @@ SimConsoleEvent::SimConsoleEvent(S32 argc, ConsoleValueRef *argv, bool onObject)
|
||||||
|
|
||||||
SimConsoleEvent::~SimConsoleEvent()
|
SimConsoleEvent::~SimConsoleEvent()
|
||||||
{
|
{
|
||||||
for (int i=0; i<mArgc; i++) {
|
for (int i=0; i<mArgc; i++)
|
||||||
|
{
|
||||||
delete mArgv[i].value;
|
delete mArgv[i].value;
|
||||||
}
|
}
|
||||||
delete[] mArgv;
|
delete[] mArgv;
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,11 @@ SimObject* findObject(const char* fileName, S32 declarationLine)
|
||||||
return gRootGroup->findObjectByLineNumber(fileName, declarationLine, true);
|
return gRootGroup->findObjectByLineNumber(fileName, declarationLine, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SimObject* findObject(ConsoleValueRef &ref)
|
||||||
|
{
|
||||||
|
return findObject((const char*)ref);
|
||||||
|
}
|
||||||
|
|
||||||
SimObject* findObject(const char* name)
|
SimObject* findObject(const char* name)
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE(SimFindObject);
|
PROFILE_SCOPE(SimFindObject);
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ bool SimPersistSet::processArguments( S32 argc, ConsoleValueRef *argv )
|
||||||
Torque::UUID uuid;
|
Torque::UUID uuid;
|
||||||
if( !uuid.fromString( argv[ i ] ) )
|
if( !uuid.fromString( argv[ i ] ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "SimPersistSet::processArguments - could not read UUID at index %i: %s", i, argv[ i ] );
|
Con::errorf( "SimPersistSet::processArguments - could not read UUID at index %i: %s", i, (const char*)argv[ i ] );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -909,7 +909,7 @@ ConsoleMethod( SimSet, add, void, 3, 0,
|
||||||
if(obj)
|
if(obj)
|
||||||
object->addObject( obj );
|
object->addObject( obj );
|
||||||
else
|
else
|
||||||
Con::printf("Set::add: Object \"%s\" doesn't exist", argv[ i ] );
|
Con::printf("Set::add: Object \"%s\" doesn't exist", (const char*)argv[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -934,7 +934,7 @@ ConsoleMethod( SimSet, remove, void, 3, 0,
|
||||||
if(obj && object->find(object->begin(),object->end(),obj) != object->end())
|
if(obj && object->find(object->begin(),object->end(),obj) != object->end())
|
||||||
object->removeObject(obj);
|
object->removeObject(obj);
|
||||||
else
|
else
|
||||||
Con::printf("Set::remove: Object \"%s\" does not exist in set", argv[i]);
|
Con::printf("Set::remove: Object \"%s\" does not exist in set", (const char*)argv[i]);
|
||||||
object->unlock();
|
object->unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,7 @@ class ConsoleValueStack
|
||||||
MaxArgs = 20,
|
MaxArgs = 20,
|
||||||
ReturnBufferSpace = 512
|
ReturnBufferSpace = 512
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConsoleValueStack();
|
ConsoleValueStack();
|
||||||
~ConsoleValueStack();
|
~ConsoleValueStack();
|
||||||
|
|
|
||||||
|
|
@ -1040,7 +1040,7 @@ void GuiMeshRoadEditorCtrl::setMode( String mode, bool sourceShortcut = false )
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
|
|
||||||
if( sourceShortcut )
|
if( sourceShortcut )
|
||||||
Con::executef( this, "paletteSync", (const char*)mode );
|
Con::executef( this, "paletteSync", mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiMeshRoadEditorCtrl::setSelectedRoad( MeshRoad *road )
|
void GuiMeshRoadEditorCtrl::setSelectedRoad( MeshRoad *road )
|
||||||
|
|
@ -1240,7 +1240,7 @@ ConsoleMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, 3, 3, "" )
|
||||||
|
|
||||||
if ( (count != 3) )
|
if ( (count != 3) )
|
||||||
{
|
{
|
||||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", argv[3]);
|
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1266,7 +1266,7 @@ ConsoleMethod( GuiMeshRoadEditorCtrl, setNodeNormal, void, 3, 3, "" )
|
||||||
|
|
||||||
if ( (count != 3) )
|
if ( (count != 3) )
|
||||||
{
|
{
|
||||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", argv[3]);
|
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1181,7 +1181,7 @@ void GuiRiverEditorCtrl::setMode( String mode, bool sourceShortcut = false )
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
|
|
||||||
if( sourceShortcut )
|
if( sourceShortcut )
|
||||||
Con::executef( this, "paletteSync", mode.utf8() );
|
Con::executef( this, "paletteSync", mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiRiverEditorCtrl::setSelectedRiver( River *river )
|
void GuiRiverEditorCtrl::setSelectedRiver( River *river )
|
||||||
|
|
@ -1444,7 +1444,7 @@ ConsoleMethod( GuiRiverEditorCtrl, setNodePosition, void, 3, 3, "" )
|
||||||
|
|
||||||
if ( (count != 3) )
|
if ( (count != 3) )
|
||||||
{
|
{
|
||||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", argv[3]);
|
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1470,7 +1470,7 @@ ConsoleMethod( GuiRiverEditorCtrl, setNodeNormal, void, 3, 3, "" )
|
||||||
|
|
||||||
if ( (count != 3) )
|
if ( (count != 3) )
|
||||||
{
|
{
|
||||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", argv[3]);
|
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -945,7 +945,7 @@ void GuiRoadEditorCtrl::setMode( String mode, bool sourceShortcut = false )
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
|
|
||||||
if( sourceShortcut )
|
if( sourceShortcut )
|
||||||
Con::executef( this, "paletteSync", mode.utf8() );
|
Con::executef( this, "paletteSync", mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiRoadEditorCtrl::setSelectedRoad( DecalRoad *road )
|
void GuiRoadEditorCtrl::setSelectedRoad( DecalRoad *road )
|
||||||
|
|
@ -1081,7 +1081,7 @@ ConsoleMethod( GuiRoadEditorCtrl, setNodePosition, void, 3, 3, "" )
|
||||||
|
|
||||||
if ( (count != 3) )
|
if ( (count != 3) )
|
||||||
{
|
{
|
||||||
Con::printf("Failed to parse node information \"px py pz\" from '%s'", argv[3]);
|
Con::printf("Failed to parse node information \"px py pz\" from '%s'", (const char*)argv[3]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ void Forest::saveDataFile( const char *path )
|
||||||
|
|
||||||
ConsoleMethod( Forest, saveDataFile, bool, 2, 3, "saveDataFile( [path] )" )
|
ConsoleMethod( Forest, saveDataFile, bool, 2, 3, "saveDataFile( [path] )" )
|
||||||
{
|
{
|
||||||
object->saveDataFile( argc == 3 ? argv[2] : NULL );
|
object->saveDataFile( argc == 3 ? (const char*)argv[2] : NULL );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -431,7 +431,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
||||||
// get it?
|
// get it?
|
||||||
if(!classRep)
|
if(!classRep)
|
||||||
{
|
{
|
||||||
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", argv[2]);
|
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -444,7 +444,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
||||||
// found it?
|
// found it?
|
||||||
if(i == classRep->mFieldList.size())
|
if(i == classRep->mFieldList.size())
|
||||||
{
|
{
|
||||||
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", argv[3], argv[2]);
|
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -454,7 +454,7 @@ ConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, 4, 4, "(string class, str
|
||||||
// check the type
|
// check the type
|
||||||
if( !conType->getEnumTable() )
|
if( !conType->getEnumTable() )
|
||||||
{
|
{
|
||||||
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", argv[3], argv[2]);
|
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -604,7 +604,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
||||||
// get it?
|
// get it?
|
||||||
if(!classRep)
|
if(!classRep)
|
||||||
{
|
{
|
||||||
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", argv[2]);
|
Con::warnf(ConsoleLogEntry::General, "failed to locate class rep for '%s'", (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -617,7 +617,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
||||||
// found it?
|
// found it?
|
||||||
if(i == classRep->mFieldList.size())
|
if(i == classRep->mFieldList.size())
|
||||||
{
|
{
|
||||||
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", argv[3], argv[2]);
|
Con::warnf(ConsoleLogEntry::General, "failed to locate field '%s' for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -627,7 +627,7 @@ ConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, 4, 4,
|
||||||
// check the type
|
// check the type
|
||||||
if( !conType->getEnumTable() )
|
if( !conType->getEnumTable() )
|
||||||
{
|
{
|
||||||
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", argv[3], argv[2]);
|
Con::warnf(ConsoleLogEntry::General, "field '%s' is not an enumeration for class '%s'", (const char*)argv[3], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4928,7 +4928,7 @@ ConsoleMethod( GuiTreeViewCtrl, setItemTooltip, void, 4, 4, "( int id, string te
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->mTooltip = (String)argv[ 3 ];
|
item->mTooltip = (const char*)argv[ 3 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )
|
ConsoleMethod( GuiTreeViewCtrl, setItemImages, void, 5, 5, "( int id, int normalImage, int expandedImage ) - Sets the normal and expanded images to show for the given item." )
|
||||||
|
|
|
||||||
|
|
@ -2007,7 +2007,7 @@ ConsoleMethod( GuiCanvas, pushDialog, void, 3, 5, "(GuiControl ctrl, int layer=0
|
||||||
|
|
||||||
if (! Sim::findObject(argv[2], gui))
|
if (! Sim::findObject(argv[2], gui))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid control: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2052,7 +2052,7 @@ ConsoleMethod( GuiCanvas, popDialog, void, 2, 3, "(GuiControl ctrl=NULL)"
|
||||||
{
|
{
|
||||||
if (!Sim::findObject(argv[2], gui))
|
if (!Sim::findObject(argv[2], gui))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid control: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2540,7 +2540,7 @@ ConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, 3, 3, "(GuiControl ctrl)")
|
||||||
|
|
||||||
if (!Sim::findObject(argv[2], addSet))
|
if (!Sim::findObject(argv[2], addSet))
|
||||||
{
|
{
|
||||||
Con::printf("%s(): Invalid control: %s", argv[0], argv[2]);
|
Con::printf("%s(): Invalid control: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
object->setCurrentAddSet(addSet);
|
object->setCurrentAddSet(addSet);
|
||||||
|
|
@ -2700,7 +2700,7 @@ ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int ax
|
||||||
GuiControl* ctrl;
|
GuiControl* ctrl;
|
||||||
if( !Sim::findObject( argv[ 2 ], ctrl ) )
|
if( !Sim::findObject( argv[ 2 ], ctrl ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "GuiEditCtrl::readGuides - no control '%s'", argv[ 2 ] );
|
Con::errorf( "GuiEditCtrl::readGuides - no control '%s'", (const char*)argv[ 2 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2711,7 +2711,7 @@ ConsoleMethod( GuiEditCtrl, readGuides, void, 3, 4, "( GuiControl ctrl [, int ax
|
||||||
S32 axis = dAtoi( argv[ 3 ] );
|
S32 axis = dAtoi( argv[ 3 ] );
|
||||||
if( axis < 0 || axis > 1 )
|
if( axis < 0 || axis > 1 )
|
||||||
{
|
{
|
||||||
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", argv[ 3 ] );
|
Con::errorf( "GuiEditCtrl::readGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2733,7 +2733,7 @@ ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int a
|
||||||
GuiControl* ctrl;
|
GuiControl* ctrl;
|
||||||
if( !Sim::findObject( argv[ 2 ], ctrl ) )
|
if( !Sim::findObject( argv[ 2 ], ctrl ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "GuiEditCtrl::writeGuides - no control '%i'", argv[ 2 ] );
|
Con::errorf( "GuiEditCtrl::writeGuides - no control '%i'", (const char*)argv[ 2 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2744,7 +2744,7 @@ ConsoleMethod( GuiEditCtrl, writeGuides, void, 3, 4, "( GuiControl ctrl [, int a
|
||||||
S32 axis = dAtoi( argv[ 3 ] );
|
S32 axis = dAtoi( argv[ 3 ] );
|
||||||
if( axis < 0 || axis > 1 )
|
if( axis < 0 || axis > 1 )
|
||||||
{
|
{
|
||||||
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", argv[ 3 ] );
|
Con::errorf( "GuiEditCtrl::writeGuides - invalid axis '%s'", (const char*)argv[ 3 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -777,7 +777,7 @@ ConsoleMethod( GuiInspector, inspect, void, 3, 3, "Inspect(Object)")
|
||||||
if(!target)
|
if(!target)
|
||||||
{
|
{
|
||||||
if(dAtoi(argv[2]) > 0)
|
if(dAtoi(argv[2]) > 0)
|
||||||
Con::warnf("%s::inspect(): invalid object: %s", argv[0], argv[2]);
|
Con::warnf("%s::inspect(): invalid object: %s", (const char*)argv[0], (const char*)argv[2]);
|
||||||
|
|
||||||
object->clearInspectObjects();
|
object->clearInspectObjects();
|
||||||
return;
|
return;
|
||||||
|
|
@ -793,7 +793,7 @@ ConsoleMethod( GuiInspector, addInspect, void, 3, 4, "( id object, (bool autoSyn
|
||||||
SimObject* obj;
|
SimObject* obj;
|
||||||
if( !Sim::findObject( argv[ 2 ], obj ) )
|
if( !Sim::findObject( argv[ 2 ], obj ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "%s::addInspect(): invalid object: %s", argv[ 0 ], argv[ 2 ] );
|
Con::errorf( "%s::addInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -810,7 +810,7 @@ ConsoleMethod( GuiInspector, removeInspect, void, 3, 3, "( id object ) - Remove
|
||||||
SimObject* obj;
|
SimObject* obj;
|
||||||
if( !Sim::findObject( argv[ 2 ], obj ) )
|
if( !Sim::findObject( argv[ 2 ], obj ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "%s::removeInspect(): invalid object: %s", argv[ 0 ], argv[ 2 ] );
|
Con::errorf( "%s::removeInspect(): invalid object: %s", (const char*)argv[ 0 ], (const char*)argv[ 2 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -571,7 +571,7 @@ void GuiInspectorTypeFileName::updateValue()
|
||||||
|
|
||||||
ConsoleMethod( GuiInspectorTypeFileName, apply, void, 3,3, "apply(newValue);" )
|
ConsoleMethod( GuiInspectorTypeFileName, apply, void, 3,3, "apply(newValue);" )
|
||||||
{
|
{
|
||||||
String path( argv[2] );
|
String path( (const char*)argv[2] );
|
||||||
if ( path.isNotEmpty() )
|
if ( path.isNotEmpty() )
|
||||||
path = Platform::makeRelativePathName( path, Platform::getMainDotCsDir() );
|
path = Platform::makeRelativePathName( path, Platform::getMainDotCsDir() );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,5 +63,5 @@ void GuiVariableInspector::loadVars( String searchStr )
|
||||||
|
|
||||||
ConsoleMethod( GuiVariableInspector, loadVars, void, 3, 3, "loadVars( searchString )" )
|
ConsoleMethod( GuiVariableInspector, loadVars, void, 3, 3, "loadVars( searchString )" )
|
||||||
{
|
{
|
||||||
object->loadVars( (const char*)argv[2] );
|
object->loadVars( argv[2] );
|
||||||
}
|
}
|
||||||
|
|
@ -175,7 +175,7 @@ ConsoleStaticMethod( EditorIconRegistry, add, void, 3, 4, "( String className, S
|
||||||
if ( argc > 3 )
|
if ( argc > 3 )
|
||||||
overwrite = dAtob( argv[3] );
|
overwrite = dAtob( argv[3] );
|
||||||
|
|
||||||
gEditorIcons.add( (const char*)argv[1], (const char*)argv[2], overwrite );
|
gEditorIcons.add( argv[1], argv[2], overwrite );
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String imagePath [, bool overwrite = true] )"
|
ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String imagePath [, bool overwrite = true] )"
|
||||||
|
|
@ -185,7 +185,7 @@ ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String ima
|
||||||
if ( argc > 2 )
|
if ( argc > 2 )
|
||||||
overwrite = dAtob( argv[2] );
|
overwrite = dAtob( argv[2] );
|
||||||
|
|
||||||
gEditorIcons.loadFromPath( (const char*)argv[1], overwrite );
|
gEditorIcons.loadFromPath( argv[1], overwrite );
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleStaticMethod( EditorIconRegistry, clear, void, 1, 1, ""
|
ConsoleStaticMethod( EditorIconRegistry, clear, void, 1, 1, ""
|
||||||
|
|
@ -212,7 +212,7 @@ ConsoleStaticMethod( EditorIconRegistry, findIconBySimObject, const char*, 2, 2,
|
||||||
SimObject *obj = NULL;
|
SimObject *obj = NULL;
|
||||||
if ( !Sim::findObject( argv[1], obj ) )
|
if ( !Sim::findObject( argv[1], obj ) )
|
||||||
{
|
{
|
||||||
Con::warnf( "EditorIconRegistry::findIcon, parameter %d was not a SimObject!", argv[1] );
|
Con::warnf( "EditorIconRegistry::findIcon, parameter %d was not a SimObject!", (const char*)argv[1] );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -782,7 +782,7 @@ void GuiDecalEditorCtrl::setMode( String mode, bool sourceShortcut = false )
|
||||||
mMode = mode;
|
mMode = mode;
|
||||||
|
|
||||||
if( sourceShortcut )
|
if( sourceShortcut )
|
||||||
Con::executef( this, "paletteSync", (const char*)mMode );
|
Con::executef( this, "paletteSync", mMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, 2, 2, "deleteSelectedDecal()" )
|
ConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, 2, 2, "deleteSelectedDecal()" )
|
||||||
|
|
@ -792,7 +792,7 @@ ConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, 2, 2, "deleteSelec
|
||||||
|
|
||||||
ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSelectedDecalDatablock( String datablock )" )
|
ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSelectedDecalDatablock( String datablock )" )
|
||||||
{
|
{
|
||||||
String lookupName( argv[2] );
|
String lookupName( (const char*)argv[2] );
|
||||||
if( lookupName == String::EmptyString )
|
if( lookupName == String::EmptyString )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -801,7 +801,7 @@ ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSele
|
||||||
|
|
||||||
ConsoleMethod( GuiDecalEditorCtrl, setMode, void, 3, 3, "setMode( String mode )()" )
|
ConsoleMethod( GuiDecalEditorCtrl, setMode, void, 3, 3, "setMode( String mode )()" )
|
||||||
{
|
{
|
||||||
String newMode = ( argv[2] );
|
String newMode = ( (const char*)argv[2] );
|
||||||
object->setMode( newMode );
|
object->setMode( newMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -868,7 +868,7 @@ ConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, 4, 4, "editDecalDetai
|
||||||
|
|
||||||
if ( (count != 7) )
|
if ( (count != 7) )
|
||||||
{
|
{
|
||||||
Con::printf("Failed to parse decal information \"px py pz tx ty tz s\" from '%s'", argv[3]);
|
Con::printf("Failed to parse decal information \"px py pz tx ty tz s\" from '%s'", (const char*)argv[3]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -894,7 +894,7 @@ ConsoleMethod( GuiDecalEditorCtrl, getSelectionCount, S32, 2, 2, "" )
|
||||||
ConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, 4, 4, "" )
|
ConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, 4, 4, "" )
|
||||||
{
|
{
|
||||||
if( dStrcmp( argv[2], "" ) != 0 && dStrcmp( argv[3], "" ) != 0 )
|
if( dStrcmp( argv[2], "" ) != 0 && dStrcmp( argv[3], "" ) != 0 )
|
||||||
object->retargetDecalDatablock( (const char*)argv[2], (const char*)argv[3] );
|
object->retargetDecalDatablock( argv[2], argv[3] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiDecalEditorCtrl::setGizmoFocus( DecalInstance * decalInstance )
|
void GuiDecalEditorCtrl::setGizmoFocus( DecalInstance * decalInstance )
|
||||||
|
|
|
||||||
|
|
@ -2500,7 +2500,7 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
|
||||||
terrains.push_back(terrBlock);
|
terrains.push_back(terrBlock);
|
||||||
|
|
||||||
if(terrains.size() == 0)
|
if(terrains.size() == 0)
|
||||||
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", argv[2]);
|
Con::errorf(ConsoleLogEntry::Script, "TerrainEditor::attach: failed to attach to object '%s'", (const char*)argv[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (terrains.size() > 0)
|
if (terrains.size() > 0)
|
||||||
|
|
@ -2714,7 +2714,7 @@ ConsoleMethod(TerrainEditor, updateMaterial, bool, 4, 4,
|
||||||
if ( index >= terr->getMaterialCount() )
|
if ( index >= terr->getMaterialCount() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
terr->updateMaterial( index, (const char*)argv[3] );
|
terr->updateMaterial( index, argv[3] );
|
||||||
|
|
||||||
object->setDirty();
|
object->setDirty();
|
||||||
|
|
||||||
|
|
@ -2729,7 +2729,7 @@ ConsoleMethod(TerrainEditor, addMaterial, S32, 3, 3,
|
||||||
if ( !terr )
|
if ( !terr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
terr->addMaterial( (const char*)argv[2] );
|
terr->addMaterial( argv[2] );
|
||||||
|
|
||||||
object->setDirty();
|
object->setDirty();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3204,7 +3204,7 @@ ConsoleMethod( WorldEditor, setActiveSelection, void, 3, 3, "( id set ) - Set th
|
||||||
WorldEditorSelection* selection;
|
WorldEditorSelection* selection;
|
||||||
if( !Sim::findObject( argv[ 2 ], selection ) )
|
if( !Sim::findObject( argv[ 2 ], selection ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "WorldEditor::setActiveSelectionSet - no selection set '%s'", argv[ 2 ] );
|
Con::errorf( "WorldEditor::setActiveSelectionSet - no selection set '%s'", (const char*)argv[ 2 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3330,14 +3330,14 @@ ConsoleMethod( WorldEditor, alignByBounds, void, 3, 3, "(int boundsAxis)"
|
||||||
"Align all selected objects against the given bounds axis.")
|
"Align all selected objects against the given bounds axis.")
|
||||||
{
|
{
|
||||||
if(!object->alignByBounds(dAtoi(argv[2])))
|
if(!object->alignByBounds(dAtoi(argv[2])))
|
||||||
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByBounds: invalid bounds axis '%s'", argv[2]));
|
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByBounds: invalid bounds axis '%s'", (const char*)argv[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( WorldEditor, alignByAxis, void, 3, 3, "(int axis)"
|
ConsoleMethod( WorldEditor, alignByAxis, void, 3, 3, "(int axis)"
|
||||||
"Align all selected objects along the given axis.")
|
"Align all selected objects along the given axis.")
|
||||||
{
|
{
|
||||||
if(!object->alignByAxis(dAtoi(argv[2])))
|
if(!object->alignByAxis(dAtoi(argv[2])))
|
||||||
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByAxis: invalid axis '%s'", argv[2]));
|
Con::warnf(ConsoleLogEntry::General, avar("worldEditor.alignByAxis: invalid axis '%s'", (const char*)argv[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( WorldEditor, resetSelectedRotation, void, 2, 2, "")
|
ConsoleMethod( WorldEditor, resetSelectedRotation, void, 2, 2, "")
|
||||||
|
|
|
||||||
|
|
@ -682,7 +682,7 @@ ConsoleMethod( WorldEditorSelection, union, void, 3, 3, "( SimSet set ) - Add al
|
||||||
SimSet* selection;
|
SimSet* selection;
|
||||||
if( !Sim::findObject( argv[ 2 ], selection ) )
|
if( !Sim::findObject( argv[ 2 ], selection ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "WorldEditorSelection::union - no SimSet '%s'", argv[ 2 ] );
|
Con::errorf( "WorldEditorSelection::union - no SimSet '%s'", (const char*)argv[ 2 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -698,7 +698,7 @@ ConsoleMethod( WorldEditorSelection, subtract, void, 3, 3, "( SimSet ) - Remove
|
||||||
SimSet* selection;
|
SimSet* selection;
|
||||||
if( !Sim::findObject( argv[ 2 ], selection ) )
|
if( !Sim::findObject( argv[ 2 ], selection ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "WorldEditorSelection::subtract - no SimSet '%s'", argv[ 2 ] );
|
Con::errorf( "WorldEditorSelection::subtract - no SimSet '%s'", (const char*)argv[ 2 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ ConsoleFunction(setCoreLangTable, void, 2, 2, "(string LangTable)"
|
||||||
if(Sim::findObject(argv[1], lt))
|
if(Sim::findObject(argv[1], lt))
|
||||||
gCoreLangTable = lt;
|
gCoreLangTable = lt;
|
||||||
else
|
else
|
||||||
Con::errorf("setCoreLangTable - Unable to find LanTable '%s'", argv[1]);
|
Con::errorf("setCoreLangTable - Unable to find LanTable '%s'", (const char*)argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ ConsoleFunction( addMaterialMapping, void, 3, 3, "(string texName, string matNam
|
||||||
"block or interior surface using the associated texture.\n\n"
|
"block or interior surface using the associated texture.\n\n"
|
||||||
"@ingroup Materials")
|
"@ingroup Materials")
|
||||||
{
|
{
|
||||||
MATMGR->mapMaterial((const char*)argv[1],(const char*)argv[2]);
|
MATMGR->mapMaterial(argv[1], argv[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction( getMaterialMapping, const char*, 2, 2, "(string texName)\n"
|
ConsoleFunction( getMaterialMapping, const char*, 2, 2, "(string texName)\n"
|
||||||
|
|
@ -474,7 +474,7 @@ ConsoleFunction( getMaterialMapping, const char*, 2, 2, "(string texName)\n"
|
||||||
"@param texName Name of the texture\n\n"
|
"@param texName Name of the texture\n\n"
|
||||||
"@ingroup Materials")
|
"@ingroup Materials")
|
||||||
{
|
{
|
||||||
return MATMGR->getMapEntry((const char*)argv[1]).c_str();
|
return MATMGR->getMapEntry(argv[1]).c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction( dumpMaterialInstances, void, 1, 1,
|
ConsoleFunction( dumpMaterialInstances, void, 1, 1,
|
||||||
|
|
@ -487,5 +487,5 @@ ConsoleFunction( dumpMaterialInstances, void, 1, 1,
|
||||||
ConsoleFunction( getMapEntry, const char *, 2, 2,
|
ConsoleFunction( getMapEntry, const char *, 2, 2,
|
||||||
"@hide")
|
"@hide")
|
||||||
{
|
{
|
||||||
return MATMGR->getMapEntry( String(argv[1]) );
|
return MATMGR->getMapEntry( argv[1] );
|
||||||
}
|
}
|
||||||
|
|
@ -884,7 +884,7 @@ bool Platform::fileTimeToString(FileTime * time, char * string, U32 strLen) { re
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#if defined(TORQUE_DEBUG)
|
#if defined(TORQUE_DEBUG)
|
||||||
ConsoleFunction(testHasSubdir,void,2,2,"tests platform::hasSubDirectory") {
|
ConsoleFunction(testHasSubdir,void,2,2,"tests platform::hasSubDirectory") {
|
||||||
Con::printf("testing %s",argv[1]);
|
Con::printf("testing %s",(const char*)argv[1]);
|
||||||
Platform::addExcludedDirectory(".svn");
|
Platform::addExcludedDirectory(".svn");
|
||||||
if(Platform::hasSubDirectory(argv[1]))
|
if(Platform::hasSubDirectory(argv[1]))
|
||||||
Con::printf(" has subdir");
|
Con::printf(" has subdir");
|
||||||
|
|
@ -901,7 +901,7 @@ ConsoleFunction(testDumpDirectories,void,4,4,"testDumpDirectories('path', int de
|
||||||
|
|
||||||
Platform::dumpDirectories(argv[1], paths, depth, noBasePath);
|
Platform::dumpDirectories(argv[1], paths, depth, noBasePath);
|
||||||
|
|
||||||
Con::printf("Dumping directories starting from %s with depth %i", argv[1],depth);
|
Con::printf("Dumping directories starting from %s with depth %i", (const char*)argv[1],depth);
|
||||||
|
|
||||||
for(Vector<StringTableEntry>::iterator itr = paths.begin(); itr != paths.end(); itr++) {
|
for(Vector<StringTableEntry>::iterator itr = paths.begin(); itr != paths.end(); itr++) {
|
||||||
Con::printf(*itr);
|
Con::printf(*itr);
|
||||||
|
|
|
||||||
|
|
@ -509,7 +509,7 @@ void Input::log( const char* format, ... )
|
||||||
ConsoleFunction( inputLog, void, 2, 2, "inputLog( string )" )
|
ConsoleFunction( inputLog, void, 2, 2, "inputLog( string )" )
|
||||||
{
|
{
|
||||||
argc;
|
argc;
|
||||||
Input::log( "%s\n", argv[1] );
|
Input::log( "%s\n", (const char*)argv[1] );
|
||||||
}
|
}
|
||||||
#endif // LOG_INPUT
|
#endif // LOG_INPUT
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ void Input::log( const char* format, ... )
|
||||||
ConsoleFunction( inputLog, void, 2, 2, "inputLog( string )" )
|
ConsoleFunction( inputLog, void, 2, 2, "inputLog( string )" )
|
||||||
{
|
{
|
||||||
argc;
|
argc;
|
||||||
Input::log( "%s\n", argv[1] );
|
Input::log( "%s\n", (const char*)argv[1] );
|
||||||
}
|
}
|
||||||
#endif // LOG_INPUT
|
#endif // LOG_INPUT
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ ConsoleFunction( MathInit, void, 1, 10, "(detect|C|FPU|MMX|3DNOW|SSE|...)")
|
||||||
properties |= CPU_PROP_SSE;
|
properties |= CPU_PROP_SSE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Con::printf("Error: MathInit(): ignoring unknown math extension '%s'", *argv);
|
Con::printf("Error: MathInit(): ignoring unknown math extension '%s'", (const char*)argv[0]);
|
||||||
}
|
}
|
||||||
Math::init(properties);
|
Math::init(properties);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,7 @@ ConsoleStaticMethod( PfxVis, open, void, 2, 3, "( PostEffect, [bool clear = fals
|
||||||
PostEffect *pfx;
|
PostEffect *pfx;
|
||||||
if ( !Sim::findObject( argv[1], pfx ) )
|
if ( !Sim::findObject( argv[1], pfx ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "PfxVis::add, argument %s was not a PostEffect", argv[1] );
|
Con::errorf( "PfxVis::add, argument %s was not a PostEffect", (const char*)argv[1] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,7 +450,7 @@ ConsoleStaticMethod( PfxVis, onWindowClosed, void, 2, 2, "( GuiWindowCtrl )"
|
||||||
GuiWindowCtrl *ctrl;
|
GuiWindowCtrl *ctrl;
|
||||||
if ( !Sim::findObject( argv[1], ctrl ) )
|
if ( !Sim::findObject( argv[1], ctrl ) )
|
||||||
{
|
{
|
||||||
Con::errorf( "PfxVis::onWindowClosed, argument %s was not a GuiWindowCtrl", argv[1] );
|
Con::errorf( "PfxVis::onWindowClosed, argument %s was not a GuiWindowCtrl", (const char*)argv[1] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1454,7 +1454,7 @@ ConsoleFunction( sfxCreateSource, S32, 2, 6,
|
||||||
description = dynamic_cast< SFXDescription* >( Sim::findObject( argv[1] ) );
|
description = dynamic_cast< SFXDescription* >( Sim::findObject( argv[1] ) );
|
||||||
if ( !description )
|
if ( !description )
|
||||||
{
|
{
|
||||||
Con::printf( "Unable to locate sound track/description '%s'", argv[1] );
|
Con::printf( "Unable to locate sound track/description '%s'", (const char*)argv[1] );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1560,7 +1560,7 @@ ConsoleFunction( sfxPlay, S32, 2, 5, "( SFXSource source | ( SFXTrack track [, f
|
||||||
SFXTrack* track = dynamic_cast<SFXTrack*>( Sim::findObject( argv[1] ) );
|
SFXTrack* track = dynamic_cast<SFXTrack*>( Sim::findObject( argv[1] ) );
|
||||||
if ( !track )
|
if ( !track )
|
||||||
{
|
{
|
||||||
Con::printf( "Unable to locate sfx track '%s'", argv[1] );
|
Con::printf( "Unable to locate sfx track '%s'", (const char*)argv[1] );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1663,7 +1663,7 @@ ConsoleFunction( sfxPlayOnce, S32, 2, 6,
|
||||||
description = dynamic_cast< SFXDescription* >( Sim::findObject( argv[1] ) );
|
description = dynamic_cast< SFXDescription* >( Sim::findObject( argv[1] ) );
|
||||||
if( !description )
|
if( !description )
|
||||||
{
|
{
|
||||||
Con::errorf( "sfxPlayOnce - Unable to locate sound track/description '%s'", argv[1] );
|
Con::errorf( "sfxPlayOnce - Unable to locate sound track/description '%s'", (const char*)argv[1] );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1803,7 +1803,6 @@ ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec
|
||||||
}
|
}
|
||||||
|
|
||||||
StringStackWrapper args(argc - 3, argv + 2);
|
StringStackWrapper args(argc - 3, argv + 2);
|
||||||
|
|
||||||
return object->processBind( args.count(), args, simObject );
|
return object->processBind( args.count(), args, simObject );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ NetConnection::NetConnection()
|
||||||
// Disable starting a new journal recording or playback from here on
|
// Disable starting a new journal recording or playback from here on
|
||||||
Journal::Disable();
|
Journal::Disable();
|
||||||
|
|
||||||
// jamesu - netAddress is not set
|
// Ensure NetAddress is cleared
|
||||||
dMemset(&mNetAddress, '\0', sizeof(NetAddress));
|
dMemset(&mNetAddress, '\0', sizeof(NetAddress));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ ConsoleMethod( TerrainBlock, exportHeightMap, bool, 3, 4, "(string filename, [st
|
||||||
UTF8 fileName[1024];
|
UTF8 fileName[1024];
|
||||||
String format = "png";
|
String format = "png";
|
||||||
if( argc > 3 )
|
if( argc > 3 )
|
||||||
format = (String)argv[ 3 ];
|
format = (const char*)argv[ 3 ];
|
||||||
|
|
||||||
Con::expandScriptFilename( fileName, sizeof( fileName ), argv[2] );
|
Con::expandScriptFilename( fileName, sizeof( fileName ), argv[2] );
|
||||||
|
|
||||||
|
|
@ -153,7 +153,7 @@ ConsoleMethod( TerrainBlock, exportLayerMaps, bool, 3, 4, "(string filePrefix, [
|
||||||
UTF8 filePrefix[1024];
|
UTF8 filePrefix[1024];
|
||||||
String format = "png";
|
String format = "png";
|
||||||
if( argc > 3 )
|
if( argc > 3 )
|
||||||
format = (String)argv[3];
|
format = (const char*)argv[3];
|
||||||
|
|
||||||
Con::expandScriptFilename( filePrefix, sizeof( filePrefix ), argv[2] );
|
Con::expandScriptFilename( filePrefix, sizeof( filePrefix ), argv[2] );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ ConsoleFunction( enumColladaForImport, bool, 3, 3,
|
||||||
GuiTreeViewCtrl* tree;
|
GuiTreeViewCtrl* tree;
|
||||||
if (!Sim::findObject(argv[2], tree))
|
if (!Sim::findObject(argv[2], tree))
|
||||||
{
|
{
|
||||||
Con::errorf("enumColladaScene::Could not find GuiTreeViewCtrl '%s'", argv[2]);
|
Con::errorf("enumColladaScene::Could not find GuiTreeViewCtrl '%s'", (const char*)argv[2]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ ConsoleFunction( loadColladaLights, bool, 2, 4,
|
||||||
if (!Sim::findObject(argv[2], group)) {
|
if (!Sim::findObject(argv[2], group)) {
|
||||||
// Create the group if it could not be found
|
// Create the group if it could not be found
|
||||||
group = new SimGroup;
|
group = new SimGroup;
|
||||||
if (group->registerObject(argv[2])) {
|
if (group->registerObject((const char*)argv[2])) {
|
||||||
if (missionGroup)
|
if (missionGroup)
|
||||||
missionGroup->addObject(group);
|
missionGroup->addObject(group);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ ConsoleMethod( EventManager, subscribe, bool, 4, 5, "( SimObject listener, Strin
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return object->subscribe( cbObj, argv[3], argc > 4 ? argv[4] : NULL );
|
return object->subscribe( cbObj, argv[3], argc > 4 ? (const char*)argv[4] : NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( EventManager, remove, void, 4, 4, "( SimObject listener, String event )\n\n"
|
ConsoleMethod( EventManager, remove, void, 4, 4, "( SimObject listener, String event )\n\n"
|
||||||
|
|
|
||||||
|
|
@ -566,7 +566,7 @@ ConsoleMethod( UndoManager, pushCompound, const char*, 2, 3, "( string name=\"\"
|
||||||
{
|
{
|
||||||
String name;
|
String name;
|
||||||
if( argc > 2 )
|
if( argc > 2 )
|
||||||
name = (String)argv[ 2 ];
|
name = (const char*)argv[ 2 ];
|
||||||
|
|
||||||
CompoundUndoAction* action = object->pushCompound( name );
|
CompoundUndoAction* action = object->pushCompound( name );
|
||||||
if( !action )
|
if( !action )
|
||||||
|
|
@ -584,7 +584,7 @@ ConsoleMethod( UndoManager, popCompound, void, 2, 3, "( bool discard=false ) - P
|
||||||
{
|
{
|
||||||
if( !object->getCompoundStackDepth() )
|
if( !object->getCompoundStackDepth() )
|
||||||
{
|
{
|
||||||
Con::errorf( "%s::popCompound - no compound on stack", argv[ 0 ] );
|
Con::errorf( "%s::popCompound - no compound on stack", (const char*)argv[ 0 ] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue