mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Convert many of the now-deprecated plString::Format calls to plFormat
This commit is contained in:
@ -1272,7 +1272,7 @@ PyObject* cyAvatar::GetTintClothingItemL(const plString& clothing_name, uint8_t
|
||||
}
|
||||
}
|
||||
|
||||
plString errmsg = plString::Format("Cannot find clothing item %s to find out what tint it is", clothing_name.c_str());
|
||||
plString errmsg = plFormat("Cannot find clothing item {} to find out what tint it is", clothing_name);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
// returning nil means an error occurred
|
||||
return nil;
|
||||
|
@ -215,7 +215,7 @@ PyObject* cyMisc::FindSceneObject(const plString& name, const char* ageName)
|
||||
|
||||
if ( key == nil )
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s not found",name.c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} not found", name);
|
||||
PyErr_SetString(PyExc_NameError, errmsg.c_str());
|
||||
return nil; // return nil cause we errored
|
||||
}
|
||||
@ -935,7 +935,7 @@ PyObject* cyMisc::GetDialogFromTagID(uint32_t tag)
|
||||
return pyGUIDialog::New(pdialog->GetKey());
|
||||
}
|
||||
|
||||
plString errmsg = plString::Format("GUIDialog TagID %d not found", tag);
|
||||
plString errmsg = plFormat("GUIDialog TagID {} not found", tag);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
return nil; // return nil, cause we threw an error
|
||||
}
|
||||
@ -951,7 +951,7 @@ PyObject* cyMisc::GetDialogFromString(const char* name)
|
||||
return pyGUIDialog::New(pdialog->GetKey());
|
||||
}
|
||||
|
||||
plString errmsg = plString::Format("GUIDialog %s not found", name);
|
||||
plString errmsg = plFormat("GUIDialog {} not found", name);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
return nil; // return nil, cause we threw an error
|
||||
}
|
||||
@ -2497,7 +2497,7 @@ plString cyMisc::GetCameraNumber(int number)
|
||||
if (pCam && pCam->GetTarget())
|
||||
{
|
||||
plString ret = pCam->GetTarget()->GetKeyName();
|
||||
plString log = plString::Format("saving camera named %s to chronicle\n", ret.c_str());
|
||||
plString log = plFormat("saving camera named {} to chronicle\n", ret);
|
||||
plVirtualCam1::Instance()->AddMsgToLog(log.c_str());
|
||||
return ret;
|
||||
}
|
||||
@ -2508,7 +2508,7 @@ plString cyMisc::GetCameraNumber(int number)
|
||||
void cyMisc::RebuildCameraStack(const plString& name, const char* ageName)
|
||||
{
|
||||
plKey key=nil;
|
||||
plString str = plString::Format("attempting to restore camera named %s from chronicle\n",name.c_str());
|
||||
plString str = plFormat("attempting to restore camera named {} from chronicle\n", name);
|
||||
plVirtualCam1::Instance()->AddMsgToLog(str.c_str());
|
||||
|
||||
if (name.Compare("empty") == 0)
|
||||
@ -2525,7 +2525,7 @@ void cyMisc::RebuildCameraStack(const plString& name, const char* ageName)
|
||||
{
|
||||
// give up and force built in 3rd person
|
||||
plVirtualCam1::Instance()->PushThirdPerson();
|
||||
plString errmsg = plString::Format("Sceneobject %s not found",name.c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} not found", name);
|
||||
PyErr_SetString(PyExc_NameError, errmsg.c_str());
|
||||
}
|
||||
}
|
||||
@ -2549,7 +2549,7 @@ void cyMisc::RebuildCameraStack(const plString& name, const char* ageName)
|
||||
}
|
||||
}
|
||||
plVirtualCam1::Instance()->PushThirdPerson();
|
||||
plString errmsg = plString::Format("Sceneobject %s has no camera modifier",name.c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} has no camera modifier", name);
|
||||
PyErr_SetString(PyExc_NameError, errmsg.c_str());
|
||||
}
|
||||
|
||||
|
@ -322,8 +322,8 @@ void cyPhysics::Move(pyVector3& direction, float distance)
|
||||
}
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
}
|
||||
}
|
||||
@ -392,8 +392,8 @@ void cyPhysics::Rotate(float rad, pyVector3& axis)
|
||||
}
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -2003,7 +2003,7 @@ PyObject* PythonInterface::CreateModule(const char* module)
|
||||
if ((m = PyDict_GetItemString(modules, module)) != NULL && PyModule_Check(m))
|
||||
{
|
||||
// clear it
|
||||
hsAssert(false, plString::Format("ERROR! Creating a python module of the same name - %s", module).c_str());
|
||||
hsAssert(false, plFormat("ERROR! Creating a python module of the same name - {}", module).c_str());
|
||||
_PyModule_Clear(m);
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ bool plPythonFileMod::ILoadPythonCode()
|
||||
#ifndef PLASMA_EXTERNAL_RELEASE
|
||||
// get code from file and execute in module
|
||||
// see if the file exists first before trying to import it
|
||||
plFileName pyfile = plFileName::Join(".", "python", plString::Format("%s.py", fPythonFile.c_str()));
|
||||
plFileName pyfile = plFileName::Join(".", "python", plFormat("{}.py", fPythonFile));
|
||||
if (plFileInfo(pyfile).Exists())
|
||||
{
|
||||
char fromLoad[256];
|
||||
@ -1002,7 +1002,8 @@ plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj)
|
||||
}
|
||||
|
||||
modulename[k] = '\0';
|
||||
plString name = plString::FromUtf8(modulename);
|
||||
plStringStream name;
|
||||
name << modulename;
|
||||
|
||||
// check to see if we are attaching to a clone?
|
||||
plKeyImp* pKeyImp = (plKeyImp*)(sKey);
|
||||
@ -1012,7 +1013,7 @@ plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj)
|
||||
// add the cloneID to the end of the module name
|
||||
// and set the fIAmAClone flag
|
||||
uint32_t cloneID = pKeyImp->GetUoid().GetCloneID();
|
||||
name += plString::Format("%d", cloneID);
|
||||
name << cloneID;
|
||||
fAmIAttachedToClone = true;
|
||||
}
|
||||
|
||||
@ -1021,10 +1022,10 @@ plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj)
|
||||
{
|
||||
// if not unique then add the sequence number to the end of the modulename
|
||||
uint32_t seqID = pKeyImp->GetUoid().GetLocation().GetSequenceNumber();
|
||||
name += plString::Format("%d", seqID);
|
||||
name << seqID;
|
||||
}
|
||||
|
||||
return name;
|
||||
return name.GetString();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -209,8 +209,8 @@ PyObject* plPythonPack::OpenPacked(const plString& fileName)
|
||||
{
|
||||
char *buf = new char[size];
|
||||
uint32_t readSize = fPackStream->Read(size, buf);
|
||||
hsAssert(readSize <= size, plString::Format("Python PackFile %s: Incorrect amount of data, read %d instead of %d",
|
||||
fileName.c_str(), readSize, size).c_str());
|
||||
hsAssert(readSize <= size, plFormat("Python PackFile {}: Incorrect amount of data, read {} instead of {}",
|
||||
fileName, readSize, size).c_str());
|
||||
|
||||
// let the python marshal make it back into a code object
|
||||
PyObject *pythonCode = PyMarshal_ReadObjectFromString(buf, size);
|
||||
|
@ -105,7 +105,7 @@ PyObject* plPythonSDLModifier::GetItem(const plString& key)
|
||||
|
||||
if (it == fMap.end())
|
||||
{
|
||||
plString errmsg = plString::Format("SDL key %s not found", key.c_str());
|
||||
plString errmsg = plFormat("SDL key {} not found", key);
|
||||
PyErr_SetString(PyExc_KeyError, errmsg.c_str());
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
@ -190,9 +190,9 @@ plString pyAgeInfoStruct::GetDisplayName() const
|
||||
{
|
||||
int32_t seq = GetAgeSequenceNumber();
|
||||
if (seq > 0)
|
||||
return plString::Format("%s (%d) %s", user.c_str(), seq, instance.c_str());
|
||||
return plFormat("{} ({}) {}", user, seq, instance);
|
||||
else
|
||||
return plString::Format("%s %s", user.c_str(), instance.c_str());
|
||||
return plFormat("{} {}", user, instance);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,8 +275,8 @@ plString pyAgeInfoStructRef::GetDisplayName() const
|
||||
{
|
||||
int32_t seq = GetAgeSequenceNumber();
|
||||
if (seq > 0)
|
||||
return plString::Format("%s (%d) %s", user.c_str(), seq, instance.c_str());
|
||||
return plFormat("{} ({}) {}", user, seq, instance);
|
||||
else
|
||||
return plString::Format("%s %s", user.c_str(), instance.c_str());
|
||||
return plFormat("{} {}", user, instance);
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ PyObject* pyImage::LoadJPEGFromDisk(const plFileName& filename, uint16_t width,
|
||||
}
|
||||
|
||||
// let's create a nice name for this thing based on the filename
|
||||
plString name = plString::Format("PtImageFromDisk_%s", filename.AsString().c_str());
|
||||
plString name = plFormat("PtImageFromDisk_{}", filename);
|
||||
|
||||
hsgResMgr::ResMgr()->NewKey(name, theMipmap, plLocation::kGlobalFixedLoc);
|
||||
|
||||
@ -235,7 +235,7 @@ PyObject* pyImage::LoadPNGFromDisk(const plFileName& filename, uint16_t width, u
|
||||
}
|
||||
|
||||
// let's create a nice name for this thing based on the filename
|
||||
plString name = plString::Format("PtImageFromDisk_%s", filename.AsString().c_str());
|
||||
plString name = plFormat("PtImageFromDisk_{}", filename);
|
||||
|
||||
hsgResMgr::ResMgr()->NewKey(name, theMipmap, plLocation::kGlobalFixedLoc);
|
||||
|
||||
|
@ -62,7 +62,7 @@ uint32_t pyJournalBook::fNextKeyID = 0;
|
||||
|
||||
void pyJournalBook::IMakeNewKey( void )
|
||||
{
|
||||
plString name = plString::Format( "pyJournalBook-%d", fNextKeyID++ );
|
||||
plString name = plFormat("pyJournalBook-{}", fNextKeyID++);
|
||||
hsgResMgr::ResMgr()->NewKey( name, fBook, plLocation::kGlobalFixedLoc );
|
||||
|
||||
fBook->GetKey()->RefObject();
|
||||
|
@ -293,8 +293,8 @@ PyObject* pySceneObject::GetLocalToWorld()
|
||||
return pyMatrix44::New((hsMatrix44)ci->GetLocalToWorld());
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
@ -322,8 +322,8 @@ PyObject* pySceneObject::GetWorldToLocal()
|
||||
return pyMatrix44::New((hsMatrix44)ci->GetWorldToLocal());
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
@ -351,8 +351,8 @@ PyObject* pySceneObject::GetLocalToParent()
|
||||
return pyMatrix44::New((hsMatrix44)ci->GetLocalToParent());
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
@ -380,8 +380,8 @@ PyObject* pySceneObject::GetParentToLocal()
|
||||
return pyMatrix44::New((hsMatrix44)ci->GetParentToLocal());
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
@ -425,8 +425,8 @@ PyObject* pySceneObject::GetWorldPosition()
|
||||
return pyPoint3::New((hsPoint3)ci->GetWorldPos());
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
@ -454,8 +454,8 @@ PyObject* pySceneObject::GetViewVector()
|
||||
return pyVector3::New(ci->GetLocalToWorld().GetAxis(hsMatrix44::kView));
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
@ -483,8 +483,8 @@ PyObject* pySceneObject::GetUpVector()
|
||||
return pyVector3::New(ci->GetLocalToWorld().GetAxis(hsMatrix44::kUp));
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
@ -512,8 +512,8 @@ PyObject* pySceneObject::GetRightVector()
|
||||
return pyVector3::New(ci->GetLocalToWorld().GetAxis(hsMatrix44::kRight));
|
||||
else
|
||||
{
|
||||
plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.",
|
||||
obj->GetKeyName().c_str());
|
||||
plString errmsg = plFormat("Sceneobject {} does not have a coordinate interface.",
|
||||
obj->GetKeyName());
|
||||
PyErr_SetString(PyExc_RuntimeError, errmsg.c_str());
|
||||
return nil; // return nil to tell python we errored
|
||||
}
|
||||
|
@ -670,13 +670,13 @@ void pyVault::CreateNeighborhood()
|
||||
unsigned nameLen = nc->GetPlayerName().GetSize();
|
||||
if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S')
|
||||
{
|
||||
title = plString::Format( "%s'", nc->GetPlayerName().c_str() );
|
||||
desc = plString::Format( "%s' %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName().c_str() );
|
||||
title = plFormat("{}'", nc->GetPlayerName());
|
||||
desc = plFormat("{}' {}", nc->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName());
|
||||
}
|
||||
else
|
||||
{
|
||||
title = plString::Format( "%s's", nc->GetPlayerName().c_str() );
|
||||
desc = plString::Format( "%s's %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName().c_str() );
|
||||
title = plFormat("{}'s", nc->GetPlayerName());
|
||||
desc = plFormat("{}'s {}", nc->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName());
|
||||
}
|
||||
|
||||
plUUID guid = plUUID::Generate();
|
||||
|
@ -68,7 +68,7 @@ static unsigned s_keyseq;
|
||||
|
||||
//============================================================================
|
||||
static plKey CreateAndRefImageKey (unsigned nodeId, plMipmap * mipmap) {
|
||||
plString keyName = plString::Format("VaultImg_%u_%u", nodeId, s_keyseq++);
|
||||
plString keyName = plFormat("VaultImg_{}_{}", nodeId, s_keyseq++);
|
||||
|
||||
plKey key = hsgResMgr::ResMgr()->NewKey(keyName, mipmap, plLocation::kGlobalFixedLoc);
|
||||
|
||||
|
Reference in New Issue
Block a user