2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-13 18:17:49 -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

@ -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;
}

View File

@ -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
}

View File

@ -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);
}