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:
@ -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);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -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] == ':' )
|
||||
{
|
||||
|
@ -187,12 +187,11 @@ bool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char *
|
||||
}
|
||||
|
||||
/// That's it!
|
||||
sprintf( string, "\nHelp for the command %s:", cmd->GetName() );
|
||||
PrintFn( string );
|
||||
sprintf( string, "\\i%s", cmd->GetHelp() );
|
||||
PrintFn( string );
|
||||
sprintf( string, "\\iUsage: %s", cmd->GetSignature() );
|
||||
PrintFn( string );
|
||||
plStringStream ss;
|
||||
ss << "\nHelp for the command " << cmd->GetName() << ":\n";
|
||||
ss << "\\i" << cmd->GetHelp() << "\n";
|
||||
ss << "\\iUsage: " << cmd->GetSignature();
|
||||
PrintFn(ss.GetString().c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -204,7 +203,6 @@ const char *pfConsoleEngine::GetCmdSignature( char *name )
|
||||
pfConsoleCmd *cmd;
|
||||
pfConsoleCmdGroup *group, *subGrp;
|
||||
const char *ptr;
|
||||
static char string[ 512 ];
|
||||
|
||||
|
||||
/// Scan for subgroups. This can be an empty loop
|
||||
@ -236,7 +234,7 @@ const char *pfConsoleEngine::GetCmdSignature( char *name )
|
||||
}
|
||||
|
||||
/// That's it!
|
||||
return (char *)cmd->GetSignature();
|
||||
return cmd->GetSignature();
|
||||
}
|
||||
|
||||
//// Dummy Local Function ////////////////////////////////////////////////////
|
||||
|
@ -1267,9 +1267,8 @@ PyObject* cyAvatar::GetTintClothingItemL(const char* clothing_name, uint8_t laye
|
||||
}
|
||||
}
|
||||
|
||||
char errmsg[256];
|
||||
sprintf(errmsg,"Cannot find clothing item %s to find out what tint it is",clothing_name);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg);
|
||||
plString errmsg = plString::Format("Cannot find clothing item %s to find out what tint it is", clothing_name);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
// returning nil means an error occurred
|
||||
return nil;
|
||||
}
|
||||
@ -1332,10 +1331,8 @@ PyObject* cyAvatar::GetTintSkin()
|
||||
return pyColor::New(tint);
|
||||
}
|
||||
}
|
||||
|
||||
char errmsg[256];
|
||||
sprintf(errmsg,"Cannot find the skin of the player. Whatever that means!");
|
||||
PyErr_SetString(PyExc_KeyError, errmsg);
|
||||
|
||||
PyErr_SetString(PyExc_KeyError, "Cannot find the skin of the player. Whatever that means!");
|
||||
// returning nil means an error occurred
|
||||
return nil;
|
||||
}
|
||||
|
@ -935,9 +935,8 @@ PyObject* cyMisc::GetDialogFromTagID(uint32_t tag)
|
||||
return pyGUIDialog::New(pdialog->GetKey());
|
||||
}
|
||||
|
||||
char errmsg[256];
|
||||
sprintf(errmsg,"GUIDialog TagID %d not found",tag);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg);
|
||||
plString errmsg = plString::Format("GUIDialog TagID %d not found", tag);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
return nil; // return nil, cause we threw an error
|
||||
}
|
||||
|
||||
@ -952,9 +951,8 @@ PyObject* cyMisc::GetDialogFromString(const char* name)
|
||||
return pyGUIDialog::New(pdialog->GetKey());
|
||||
}
|
||||
|
||||
char errmsg[256];
|
||||
sprintf(errmsg,"GUIDialog %s not found",name);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg);
|
||||
plString errmsg = plString::Format("GUIDialog %s not found", name);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
return nil; // return nil, cause we threw an error
|
||||
}
|
||||
|
||||
@ -989,9 +987,7 @@ PyObject* cyMisc::GetLocalAvatar()
|
||||
if ( so )
|
||||
return pySceneObject::New(so->GetKey());
|
||||
|
||||
char errmsg[256];
|
||||
sprintf(errmsg,"Local avatar not found");
|
||||
PyErr_SetString(PyExc_NameError, errmsg);
|
||||
PyErr_SetString(PyExc_NameError, "Local avatar not found");
|
||||
return nil; // returns nil, cause we threw an error
|
||||
}
|
||||
|
||||
@ -1570,14 +1566,14 @@ void cyMisc::FogSetDefExp2(float end, float density)
|
||||
void cyMisc::SetClearColor(float red, float green, float blue)
|
||||
{
|
||||
// do this command via the console to keep the maxplugins from barfing
|
||||
char command[256];
|
||||
sprintf(command,"Graphics.Renderer.SetClearColor %f %f %f",red,green,blue);
|
||||
plString command = plString::Format("Graphics.Renderer.SetClearColor %f %f %f", red, green, blue);
|
||||
|
||||
// create message to send to the console
|
||||
plControlEventMsg* pMsg = new plControlEventMsg;
|
||||
pMsg->SetBCastFlag(plMessage::kBCastByType);
|
||||
pMsg->SetControlCode(B_CONTROL_CONSOLE_COMMAND);
|
||||
pMsg->SetControlActivated(true);
|
||||
pMsg->SetCmdString(command);
|
||||
pMsg->SetCmdString(command.c_str());
|
||||
plgDispatch::MsgSend( pMsg ); // whoosh... off it goes
|
||||
}
|
||||
|
||||
|
@ -2003,9 +2003,7 @@ PyObject* PythonInterface::CreateModule(const char* module)
|
||||
if ((m = PyDict_GetItemString(modules, module)) != NULL && PyModule_Check(m))
|
||||
{
|
||||
// clear it
|
||||
char message[256];
|
||||
sprintf(message,"ERROR! Creating a python module of the same name - %s",module);
|
||||
hsAssert(false,message);
|
||||
hsAssert(false, plString::Format("ERROR! Creating a python module of the same name - %s", module).c_str());
|
||||
_PyModule_Clear(m);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user