diff --git a/Engine/source/Verve/Core/Persistence/VPersistence.h b/Engine/source/Verve/Core/Persistence/VPersistence.h index edbc892c8..a350005fc 100644 --- a/Engine/source/Verve/Core/Persistence/VPersistence.h +++ b/Engine/source/Verve/Core/Persistence/VPersistence.h @@ -250,8 +250,9 @@ namespace VPersistence if ( object->isMethod( "onAdd" ) ) { // Callback. - const char *retValue = Con::executef( object, "onAdd" ); - if ( !dAtob( retValue ) ) + ConsoleValue cValue = Con::executef( object, "onAdd" ); + + if ( !cValue.getBool() ) { // Delete. object->deleteObject(); diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp index 1c68256c1..f90d20f73 100644 --- a/Engine/source/afx/afxEffectron.cpp +++ b/Engine/source/afx/afxEffectron.cpp @@ -989,9 +989,10 @@ afxEffectron::start_effect(afxEffectronData* datablock, SimObject* extra) } // CALL SCRIPT afxEffectronData::onPreactivate(%params, %extra) - const char* result = Con::executef(datablock, "onPreactivate", + ConsoleValue cValue = Con::executef(datablock, "onPreactivate", Con::getIntArg(param_holder->getId()), (extra) ? Con::getIntArg(extra->getId()) : ""); + const char* result = cValue.getString(); if (result && result[0] != '\0' && !dAtob(result)) { #if defined(TORQUE_DEBUG) diff --git a/Engine/source/afx/afxSelectron.cpp b/Engine/source/afx/afxSelectron.cpp index 63157a4f1..1b6194b9a 100644 --- a/Engine/source/afx/afxSelectron.cpp +++ b/Engine/source/afx/afxSelectron.cpp @@ -1068,9 +1068,11 @@ afxSelectron::start_selectron(SceneObject* picked, U8 subcode, SimObject* extra) } // CALL SCRIPT afxSelectronData::onPreactivate(%params, %extra) - const char* result = Con::executef(datablock, "onPreactivate", + ConsoleValue cValue = Con::executef(datablock, "onPreactivate", Con::getIntArg(param_holder->getId()), - (extra) ? Con::getIntArg(extra->getId()) : "").getString(); + (extra) ? Con::getIntArg(extra->getId()) : ""); + + const char* result = cValue.getString(); if (result && result[0] != '\0' && !dAtob(result)) { #if defined(TORQUE_DEBUG) diff --git a/Engine/source/console/arrayObject.cpp b/Engine/source/console/arrayObject.cpp index 92458852d..68b34059e 100644 --- a/Engine/source/console/arrayObject.cpp +++ b/Engine/source/console/arrayObject.cpp @@ -103,7 +103,8 @@ S32 QSORT_CALLBACK ArrayObject::_keyFunctionCompare( const void* a, const void* ArrayObject::Element* ea = ( ArrayObject::Element* )( a ); ArrayObject::Element* eb = ( ArrayObject::Element* )( b ); - S32 result = dAtoi(Con::executef((const char*)smCompareFunction, ea->key, eb->key)); + ConsoleValue cValue = Con::executef((const char*)smCompareFunction, ea->key, eb->key); + S32 result = cValue.getInt(); S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 ); return ( smDecreasing ? -res : res ); } @@ -113,7 +114,8 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void ArrayObject::Element* ea = ( ArrayObject::Element* )( a ); ArrayObject::Element* eb = ( ArrayObject::Element* )( b ); - S32 result = dAtoi( Con::executef( (const char*)smCompareFunction, ea->value, eb->value ) ); + ConsoleValue cValue = Con::executef( (const char*)smCompareFunction, ea->value, eb->value ); + S32 result = cValue.getInt(); S32 res = result < 0 ? -1 : ( result > 0 ? 1 : 0 ); return ( smDecreasing ? -res : res ); } diff --git a/Engine/source/console/simObjectList.cpp b/Engine/source/console/simObjectList.cpp index 8388f6e9d..ac286f22b 100644 --- a/Engine/source/console/simObjectList.cpp +++ b/Engine/source/console/simObjectList.cpp @@ -118,7 +118,8 @@ S32 QSORT_CALLBACK SimObjectList::_callbackSort( const void *a, const void *b ) static char idB[64]; dSprintf( idB, sizeof( idB ), "%d", objB->getId() ); - return dAtoi( Con::executef( (const char*)smSortScriptCallbackFn, idA, idB ) ); + ConsoleValue cValue = Con::executef( (const char*)smSortScriptCallbackFn, idA, idB ); + return cValue.getInt(); } void SimObjectList::scriptSort( const String &scriptCallback ) diff --git a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp index ae9084588..e650fdf59 100644 --- a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp @@ -438,7 +438,8 @@ void GuiRiverEditorCtrl::_process3DMouseDown( const Gui3DMouseEvent& event ) return; } - const char *res = Con::executef( this, "createRiver" ); + ConsoleValue cValue = Con::executef( this, "createRiver" ); + const char* res = cValue.getString(); River *newRiver; if ( !Sim::findObject( res, newRiver ) ) diff --git a/Engine/source/forest/editor/forestBrushTool.cpp b/Engine/source/forest/editor/forestBrushTool.cpp index d0d64d517..5b9278ea6 100644 --- a/Engine/source/forest/editor/forestBrushTool.cpp +++ b/Engine/source/forest/editor/forestBrushTool.cpp @@ -588,7 +588,8 @@ void ForestBrushTool::_collectElements() if ( !Sim::findObject( "ForestEditBrushTree", brushTree ) ) return; - const char* objectIdList = Con::executef( brushTree, "getSelectedObjectList" ); + ConsoleValue cValue = Con::executef( brushTree, "getSelectedObjectList" ); + const char* objectIdList = cValue.getString(); // Collect those objects in a vector and mark them as selected. @@ -685,4 +686,4 @@ bool ForestBrushTool::getGroundAt( const Point3F &worldPt, F32 *zValueOut, Vecto DefineEngineMethod( ForestBrushTool, collectElements, void, (), , "" ) { object->collectElements(); -} \ No newline at end of file +} diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index e2804b1f1..aaed67a78 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -637,7 +637,9 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf) method += pClassName; if(mParentControl->isMethod(method.c_str())) { - const char* tooltip = Con::executef( mParentControl, method.c_str(), pObject->getIdString() ); + ConsoleValue cValue = Con::executef( mParentControl, method.c_str(), pObject->getIdString() ); + const char* tooltip = cValue.getString(); + dsize_t len = dStrlen(buf); S32 newBufLen = bufLen-len; if(dStrlen(tooltip) > 0 && newBufLen > 0) diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index 7c63ebe52..ba04467c2 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -226,7 +226,9 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event) if (item) { if (item->mEnabled) - dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : "")); + { + Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : ""); + } } } diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 14fff6844..6e7cb39ee 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -288,7 +288,8 @@ bool PopupMenu::canHandleID(U32 id) bool PopupMenu::handleSelect(U32 command, const char *text /* = NULL */) { - return dAtob(Con::executef(this, "onSelectItem", Con::getIntArg(command), text ? text : "")); + ConsoleValue cValue = Con::executef(this, "onSelectItem", Con::getIntArg(command), text ? text : ""); + return cValue.getBool(); } ////////////////////////////////////////////////////////////////////////// diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index d6642cd1c..d2aa75c4d 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -461,7 +461,9 @@ bool WorldEditor::pasteSelection( bool dropSel ) SimGroup *targetGroup = NULL; if( isMethod( "getNewObjectGroup" ) ) { - const char* targetGroupName = Con::executef( this, "getNewObjectGroup" ); + ConsoleValue cValue = Con::executef( this, "getNewObjectGroup" ); + const char* targetGroupName = cValue.getString(); + if( targetGroupName && targetGroupName[ 0 ] && !Sim::findObject( targetGroupName, targetGroup) ) Con::errorf( "WorldEditor::pasteSelection() - no SimGroup called '%s'", targetGroupName ); } diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index f91ae060d..08db0da6c 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -397,7 +397,8 @@ bool ModuleManager::loadModuleGroup( const char* pModuleGroup ) if ( pLoadReadyModuleDefinition->getModuleScriptFilePath() != StringTable->EmptyString() ) { // Yes, so execute the script file. - const bool scriptFileExecuted = dAtob( Con::executef("exec", pLoadReadyModuleDefinition->getModuleScriptFilePath() ) ); + ConsoleValue cValue = Con::executef("exec", pLoadReadyModuleDefinition->getModuleScriptFilePath()); + const bool scriptFileExecuted = cValue.getBool(); // Did we execute the script file? if ( scriptFileExecuted ) @@ -784,7 +785,8 @@ bool ModuleManager::loadModuleExplicit( const char* pModuleId, const U32 version if ( pLoadReadyModuleDefinition->getModuleScriptFilePath() != StringTable->EmptyString() ) { // Yes, so execute the script file. - const bool scriptFileExecuted = dAtob( Con::executef("exec", pLoadReadyModuleDefinition->getModuleScriptFilePath() ) ); + ConsoleValue cValue = Con::executef("exec", pLoadReadyModuleDefinition->getModuleScriptFilePath()); + const bool scriptFileExecuted = cValue.getBool(); // Did we execute the script file? if ( !scriptFileExecuted ) diff --git a/Engine/source/util/messaging/scriptMsgListener.cpp b/Engine/source/util/messaging/scriptMsgListener.cpp index fa47b7e7c..f64d2a6b2 100644 --- a/Engine/source/util/messaging/scriptMsgListener.cpp +++ b/Engine/source/util/messaging/scriptMsgListener.cpp @@ -121,7 +121,6 @@ IMPLEMENT_CALLBACK( ScriptMsgListener, onMessageReceived, bool, ( const char* qu bool ScriptMsgListener::onMessageReceived(StringTableEntry queue, const char* event, const char* data) { return onMessageReceived_callback(queue, event, data); - //return dAtob(Con::executef(this, "onMessageReceived", queue, event, data)); } IMPLEMENT_CALLBACK( ScriptMsgListener, onMessageObjectReceived, bool, ( const char* queue, Message *msg ), ( queue, msg ), @@ -135,7 +134,6 @@ IMPLEMENT_CALLBACK( ScriptMsgListener, onMessageObjectReceived, bool, ( const ch bool ScriptMsgListener::onMessageObjectReceived(StringTableEntry queue, Message *msg) { return onMessageObjectReceived_callback(queue, msg); - //return dAtob(Con::executef(this, "onMessageObjectReceived", queue, Con::getIntArg(msg->getId()))); } //----------------------------------------------------------------------------- @@ -150,7 +148,6 @@ IMPLEMENT_CALLBACK( ScriptMsgListener, onAddToQueue, void, ( const char* queue), void ScriptMsgListener::onAddToQueue(StringTableEntry queue) { - //Con::executef(this, "onAddToQueue", queue); onAddToQueue_callback(queue); IMLParent::onAddToQueue(queue); } @@ -176,7 +173,6 @@ IMPLEMENT_CALLBACK( ScriptMsgListener, onRemoveFromQueue, void, ( const char* qu void ScriptMsgListener::onRemoveFromQueue(StringTableEntry queue) { - //Con::executef(this, "onRemoveFromQueue", queue); onRemoveFromQueue_callback(queue); IMLParent::onRemoveFromQueue(queue); }