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:
jamesu 2012-10-11 21:29:39 +01:00 committed by James Urquhart
parent e99eadd61f
commit 08d4f6ebc0
58 changed files with 733 additions and 690 deletions

View file

@ -175,7 +175,7 @@ ConsoleStaticMethod( EditorIconRegistry, add, void, 3, 4, "( String className, S
if ( argc > 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] )"
@ -185,7 +185,7 @@ ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String ima
if ( argc > 2 )
overwrite = dAtob( argv[2] );
gEditorIcons.loadFromPath( (const char*)argv[1], overwrite );
gEditorIcons.loadFromPath( argv[1], overwrite );
}
ConsoleStaticMethod( EditorIconRegistry, clear, void, 1, 1, ""
@ -212,7 +212,7 @@ ConsoleStaticMethod( EditorIconRegistry, findIconBySimObject, const char*, 2, 2,
SimObject *obj = NULL;
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;
}

View file

@ -782,7 +782,7 @@ void GuiDecalEditorCtrl::setMode( String mode, bool sourceShortcut = false )
mMode = mode;
if( sourceShortcut )
Con::executef( this, "paletteSync", (const char*)mMode );
Con::executef( this, "paletteSync", mMode );
}
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 )" )
{
String lookupName( argv[2] );
String lookupName( (const char*)argv[2] );
if( lookupName == String::EmptyString )
return;
@ -801,7 +801,7 @@ ConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, 3, 3, "deleteSele
ConsoleMethod( GuiDecalEditorCtrl, setMode, void, 3, 3, "setMode( String mode )()" )
{
String newMode = ( argv[2] );
String newMode = ( (const char*)argv[2] );
object->setMode( newMode );
}
@ -868,7 +868,7 @@ ConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, 4, 4, "editDecalDetai
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;
}
@ -894,7 +894,7 @@ ConsoleMethod( GuiDecalEditorCtrl, getSelectionCount, S32, 2, 2, "" )
ConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, 4, 4, "" )
{
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 )
@ -1253,4 +1253,4 @@ void DBRetargetUndoAction::redo()
if ( mEditor->isMethod( "rebuildInstanceTree" ) )
Con::executef( mEditor, "rebuildInstanceTree" );
}
#endif
#endif

View file

@ -2500,7 +2500,7 @@ ConsoleMethod( TerrainEditor, attachTerrain, void, 2, 3, "(TerrainBlock terrain)
terrains.push_back(terrBlock);
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)
@ -2714,7 +2714,7 @@ ConsoleMethod(TerrainEditor, updateMaterial, bool, 4, 4,
if ( index >= terr->getMaterialCount() )
return false;
terr->updateMaterial( index, (const char*)argv[3] );
terr->updateMaterial( index, argv[3] );
object->setDirty();
@ -2729,7 +2729,7 @@ ConsoleMethod(TerrainEditor, addMaterial, S32, 3, 3,
if ( !terr )
return false;
terr->addMaterial( (const char*)argv[2] );
terr->addMaterial( argv[2] );
object->setDirty();

View file

@ -3204,7 +3204,7 @@ ConsoleMethod( WorldEditor, setActiveSelection, void, 3, 3, "( id set ) - Set th
WorldEditorSelection* 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;
}
@ -3330,14 +3330,14 @@ ConsoleMethod( WorldEditor, alignByBounds, void, 3, 3, "(int boundsAxis)"
"Align all selected objects against the given bounds axis.")
{
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)"
"Align all selected objects along the given axis.")
{
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, "")

View file

@ -682,7 +682,7 @@ ConsoleMethod( WorldEditorSelection, union, void, 3, 3, "( SimSet set ) - Add al
SimSet* 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;
}
@ -698,7 +698,7 @@ ConsoleMethod( WorldEditorSelection, subtract, void, 3, 3, "( SimSet ) - Remove
SimSet* 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;
}