2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Begin killing off sprintf

This commit is contained in:
2013-02-01 17:39:46 -05:00
parent 470ed86187
commit dd35878465
13 changed files with 57 additions and 100 deletions

View File

@ -250,10 +250,7 @@ PF_CONSOLE_CMD( Avatar_Spawn, Respawn,"", "Moves the avatar back to the start po
PF_CONSOLE_CMD( Avatar_Spawn, SetSpawnOverride, "string spawnPointName", "Overrides the normal spawn point choice to be the object specified.")
{
plArmatureMod::SetSpawnPointOverride( (const char *)params[ 0 ] );
char str1[ 512 ];
sprintf( str1, "Spawn point override set to object %s", (const char *)params[ 0 ] );
PrintString( str1 );
PrintStringF(PrintString, "Spawn point override set to object %s", (const char *)params[ 0 ]);
}
PF_CONSOLE_CMD( Avatar_Spawn, DontPanic,"", "Toggles the Don't panic link flag.")
@ -263,9 +260,7 @@ PF_CONSOLE_CMD( Avatar_Spawn, DontPanic,"", "Toggles the Don't panic link flag."
if (avatar)
{
bool state = avatar->ToggleDontPanicLinkFlag();
char str1[256];
sprintf(str1, "DontPanic set to %s", state?"true":"false");
PrintString( str1 );
PrintStringF(PrintString, "DontPanic set to %s", state ? "true" : "false");
}
}
@ -484,10 +479,8 @@ PF_CONSOLE_CMD( Avatar,
{
plRelevanceMgr *mgr = plRelevanceMgr::Instance();
mgr->SetEnabled(!mgr->GetEnabled());
char buff[256];
sprintf(buff, "All relevance regions are now %s", (mgr->GetEnabled() ? "ENABLED" : "DISABLED"));
PrintString(buff);
PrintStringF(PrintString, "All relevance regions are now %s", (mgr->GetEnabled() ? "ENABLED" : "DISABLED"));
}
PF_CONSOLE_CMD( Avatar, SeekPoint, "string seekpoint", "Move to the given seekpoint.")
@ -756,10 +749,7 @@ PF_CONSOLE_CMD( Avatar_LOD, SetLODDistance, "float newDist", "Set Distance for s
PF_CONSOLE_CMD( Avatar_LOD, GetLODDistance, "", "Get Distance for switching Avatar LOD" )
{
char buffer[256];
sprintf(buffer, "Lod Distance = %f", plArmatureLODMod::fLODDistance);
PrintString(buffer);
PrintStringF(PrintString, "Lod Distance = %f", plArmatureLODMod::fLODDistance);
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -287,34 +287,28 @@ bool pfConsole::MsgReceive( plMessage *msg )
{
// Change the following line once we have a better way of reporting
// errors in the parsing
static char str[ 256 ];
static char msg[ 1024 ];
sprintf( str, "Error parsing %s", cmd->GetString() );
sprintf( msg, "%s:\n\nCommand: '%s'\n%s", fEngine->GetErrorMsg(), fEngine->GetLastErrorLine(),
plString str = plString::Format("Error parsing %s", cmd->GetString());
plString msg = plString::Format("%s:\n\nCommand: '%s'\n%s", fEngine->GetErrorMsg(), fEngine->GetLastErrorLine(),
#ifdef HS_DEBUGGING
"" );
hsAssert( false, msg );
hsAssert( false, msg.c_str() );
#else
"\nPress OK to continue parsing files." );
hsMessageBox( msg, str, hsMessageBoxNormal );
hsMessageBox( msg.c_str(), str.c_str(), hsMessageBoxNormal );
#endif
}
}
else if( cmd->GetCmd() == plConsoleMsg::kAddLine )
IAddParagraph( (char *)cmd->GetString() );
IAddParagraph( cmd->GetString() );
else if( cmd->GetCmd() == plConsoleMsg::kExecuteLine )
{
if( !fEngine->RunCommand( (char *)cmd->GetString(), IAddLineCallback ) )
{
// Change the following line once we have a better way of reporting
// errors in the parsing
static char msg[ 1024 ];
sprintf( msg, "%s:\n\nCommand: '%s'\n", fEngine->GetErrorMsg(), fEngine->GetLastErrorLine() );
IAddLineCallback( msg );
AddLineF("%s:\n\nCommand: '%s'\n", fEngine->GetErrorMsg(), fEngine->GetLastErrorLine());
}
}
@ -755,9 +749,7 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg )
// if there was a line then bump num lines
if ( fWorkingLine[0] != 0 )
{
char displine[300];
sprintf(displine,"... %s",fWorkingLine);
AddLine( displine );
AddLineF("... %s", fWorkingLine);
fPythonMultiLines++;
}
@ -795,9 +787,7 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg )
// was there actually anything in the input buffer?
if ( fWorkingLine[0] != 0 )
{
char displine[300];
sprintf(displine,">>> %s",fWorkingLine);
AddLine( displine );
AddLineF(">>> %s", fWorkingLine);
// check to see if this is going to be a multi line mode ( a ':' at the end)
if ( fWorkingLine[eol-1] == ':' )
{