diff --git a/Sources/Plasma/Apps/plClient/plClient.cpp b/Sources/Plasma/Apps/plClient/plClient.cpp index 553bd4e8..a22f3259 100644 --- a/Sources/Plasma/Apps/plClient/plClient.cpp +++ b/Sources/Plasma/Apps/plClient/plClient.cpp @@ -1094,14 +1094,16 @@ void plClient::IUnloadRooms(const std::vector& locs) if (node) { #ifndef PLASMA_EXTERNAL_RELEASE - plStatusLog::AddLineS("pageouts.log", "SceneNode for %s loaded; Removing node", node->GetKey()->GetUoid().GetObjectName()); + plStatusLog::AddLineS("pageouts.log", "SceneNode for %s loaded; Removing node", + node->GetKey()->GetUoid().GetObjectName().c_str()); #endif fPageMgr->RemoveNode(node); } else { #ifndef PLASMA_EXTERNAL_RELEASE - plStatusLog::AddLineS("pageouts.log", "SceneNode for %s NOT loaded", nodeKey->GetUoid().GetObjectName()); + plStatusLog::AddLineS("pageouts.log", "SceneNode for %s NOT loaded", + nodeKey->GetUoid().GetObjectName().c_str()); #endif } GetKey()->Release(nodeKey); // release notify interest in scene node @@ -1117,7 +1119,8 @@ void plClient::IUnloadRooms(const std::vector& locs) fCurrentNode = nil; #ifndef PLASMA_EXTERNAL_RELEASE - plStatusLog::AddLineS("pageouts.log", "Telling netClientMgr about paging out %s", nodeKey->GetUoid().GetObjectName()); + plStatusLog::AddLineS("pageouts.log", "Telling netClientMgr about paging out %s", + nodeKey->GetUoid().GetObjectName().c_str()); #endif if (plNetClientMgr::GetInstance() != nil) @@ -1241,7 +1244,7 @@ void plClient::IRoomLoaded(plSceneNode* node, bool hold) plgDispatch::MsgSend(loadmsg); } else - hsStatusMessageF("Done loading hold room %s, t=%f\n", pRmKey->GetName(), hsTimer::GetSeconds()); + hsStatusMessageF("Done loading hold room %s, t=%f\n", pRmKey->GetName().c_str(), hsTimer::GetSeconds()); plLocation loc = pRmKey->GetUoid().GetLocation(); for (int i = 0; i < fRoomsLoading.size(); i++) diff --git a/Sources/Plasma/CoreLib/plGeneric.h b/Sources/Plasma/CoreLib/plGeneric.h index bb98b0bf..eb57d807 100644 --- a/Sources/Plasma/CoreLib/plGeneric.h +++ b/Sources/Plasma/CoreLib/plGeneric.h @@ -88,11 +88,11 @@ public: // the cast functions will NOT cast from one type to another, use // GetType() to determine the type of parameter, then cast it to that type GenericType GetType() const {return fType;} - operator const bool() const {return fBoolVal;} - operator const int() const {return fIntVal;} - operator const double() const {return fFloatVal;} + operator bool() const {return fBoolVal;} + operator int() const {return fIntVal;} + operator double() const {return fFloatVal;} operator const wchar_t*() const {return fStringVal.c_str();} - operator const std::wstring() const {return fStringVal;} + operator std::wstring() const {return fStringVal;} int Write(hsStream* stream); int Read(hsStream* stream); diff --git a/Sources/Plasma/CoreLib/plString.h b/Sources/Plasma/CoreLib/plString.h index f2a4d4b8..48f272c3 100644 --- a/Sources/Plasma/CoreLib/plString.h +++ b/Sources/Plasma/CoreLib/plString.h @@ -112,7 +112,7 @@ public: } const _Ch *GetData() const { return fData ? fData->fStringData : 0; } - const size_t GetSize() const { return fData ? fData->fSize : 0; } + size_t GetSize() const { return fData ? fData->fSize : 0; } }; diff --git a/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp b/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp index 0e51d048..7f3f0ed3 100644 --- a/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp +++ b/Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp @@ -104,7 +104,7 @@ void plAnimDebugList::ShowReport() int y,x,i,j; const int yOff=10, startY=40, startX=10; - char str[256]; + plString str; x = startX; y = startY; @@ -124,10 +124,10 @@ void plAnimDebugList::ShowReport() plLayerAnimation *layerAnim = plLayerAnimation::ConvertNoRef(layer); if (layerAnim) { - sprintf(str, "%s: %s %.3f (%.3f)", mat->GetKeyName(), layerAnim->GetKeyName(), + str = plString::Format("%s: %s %.3f (%.3f)", mat->GetKeyName().c_str(), layerAnim->GetKeyName().c_str(), layerAnim->GetTimeConvert().CurrentAnimTime(), layerAnim->GetTimeConvert().WorldToAnimTimeNoUpdate(hsTimer::GetSysSeconds())); - txt.DrawString(x, y, str); + txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(str)); y += yOff; } layer = layer->GetOverLay(); @@ -137,7 +137,7 @@ void plAnimDebugList::ShowReport() y += yOff; txt.DrawString(x, y, "AGMaster Anims", 255, 255, 255, 255, plDebugText::kStyleBold); y += yOff; - + for (i = 0; i < fSOKeys.GetCount(); i++) { plSceneObject *so = plSceneObject::ConvertNoRef(fSOKeys[i]->ObjectIsLoaded()); @@ -148,17 +148,17 @@ void plAnimDebugList::ShowReport() if (!mod) continue; - sprintf(str, " %s", so->GetKeyName()); - txt.DrawString(x, y, str); + str = plString::Format(" %s", so->GetKeyName().c_str()); + txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(str)); y += yOff; for (j = 0; j < mod->GetNumATCAnimations(); j++) { plAGAnimInstance *anim = mod->GetATCAnimInstance(j); - sprintf(str, " %s: %.3f (%.3f)", anim->GetAnimation()->GetName(), + str = plString::Format(" %s: %.3f (%.3f)", anim->GetAnimation()->GetName().c_str(), anim->GetTimeConvert()->CurrentAnimTime(), anim->GetTimeConvert()->WorldToAnimTimeNoUpdate(hsTimer::GetSysSeconds())); - txt.DrawString(x, y, str); + txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(str)); y += yOff; } } diff --git a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp index 5fd76452..16d2046a 100644 --- a/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp +++ b/Sources/Plasma/FeatureLib/pfAudio/plRandomSoundMod.cpp @@ -253,9 +253,9 @@ void plRandomSoundMod::IPlayNext() if (plgAudioSys::AreExtendedLogsEnabled()) { if (fGroups) - plStatusLog::AddLineS("audio.log", "%s: Playing sound #%d from group %d", GetTarget(0)->GetKeyName(), fCurrent, fCurrentGroup); + plStatusLog::AddLineS("audio.log", "%s: Playing sound #%d from group %d", GetTarget(0)->GetKeyName().c_str(), fCurrent, fCurrentGroup); else - plStatusLog::AddLineS("audio.log", "%s: Playing sound #%d", GetTarget(0)->GetKeyName(), fCurrent); + plStatusLog::AddLineS("audio.log", "%s: Playing sound #%d", GetTarget(0)->GetKeyName().c_str(), fCurrent); } fEndTimes[fCurrent] = hsTimer::GetSysSeconds() + currLen; diff --git a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp index 75a72a25..1a0f465c 100644 --- a/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp +++ b/Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp @@ -1026,7 +1026,7 @@ void plCameraBrain1_Avatar::Update(hsBool forced) if (fFlags.IsBitSet(kIsTransitionCamera)) { if (GetKey()) - hsStatusMessageF("%s thinks it's the transition camera\n",GetKeyName()); + hsStatusMessageF("%s thinks it's the transition camera\n", GetKeyName().c_str()); } else { diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp index 0069cc7a..bcfbf7f4 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp @@ -173,7 +173,7 @@ PF_CONSOLE_CMD( Avatar_Spawn, Show, "", "Print a list of spawn points.") const plSpawnModifier * spawn = mgr->GetSpawnPoint(i); if(spawn) { - PrintStringF(PrintString, "%d. %s", i, spawn->GetKey()->GetName()); + PrintStringF(PrintString, "%d. %s", i, spawn->GetKey()->GetName().c_str()); } } } diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp index 1515f42a..6b1a5cfa 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp @@ -2723,12 +2723,12 @@ void MyHandyPrintFunction( const plKey &obj, void (*PrintString)( const char if( peeker->GetUoid().IsClone() ) PrintStringF( PrintString, "%d refs on %s, clone %d:%d: loaded=%d", - peeker->PeekNumNotifies(), obj->GetUoid().GetObjectName(), - peeker->GetUoid().GetCloneID(), peeker->GetUoid().GetClonePlayerID(), - obj->ObjectIsLoaded() ? 1 : 0); + peeker->PeekNumNotifies(), obj->GetUoid().GetObjectName().c_str(), + peeker->GetUoid().GetCloneID(), peeker->GetUoid().GetClonePlayerID(), + obj->ObjectIsLoaded() ? 1 : 0); else PrintStringF( PrintString, "%d refs on %s: loaded=%d", - peeker->PeekNumNotifies(), obj->GetUoid().GetObjectName(), obj->ObjectIsLoaded() ? 1 : 0 ); + peeker->PeekNumNotifies(), obj->GetUoid().GetObjectName().c_str(), obj->ObjectIsLoaded() ? 1 : 0 ); if( peeker->PeekNumNotifies() == 0 ) return; @@ -2754,7 +2754,8 @@ void MyHandyPrintFunction( const plKey &obj, void (*PrintString)( const char limit--; const plKey rcvr = msg->GetReceiver( j ); - PrintStringF( PrintString, " %s:%s", plFactory::GetNameOfClass( rcvr->GetUoid().GetClassType() ), rcvr->GetUoid().GetObjectName() ); + PrintStringF( PrintString, " %s:%s", plFactory::GetNameOfClass( rcvr->GetUoid().GetClassType() ), + rcvr->GetUoid().GetObjectName().c_str() ); } } } @@ -2928,7 +2929,7 @@ PF_CONSOLE_CMD( Camera, // groupName "increase drive turn rate" ) // helpString { plCameraBrain1_Drive::fTurnRate += 20.0f; - + } PF_CONSOLE_CMD( Camera, // groupName @@ -2939,14 +2940,14 @@ PF_CONSOLE_CMD( Camera, // groupName plCameraBrain1_Drive::fTurnRate -= 20.0f; if (plCameraBrain1_Drive::fTurnRate < 0.0) plCameraBrain1_Drive::fTurnRate = 20.0f; - + } PF_CONSOLE_CMD( Camera, SwitchTo, "string cameraName", "Switch to the named camera") { char str[256]; - plString foo = plString::Format("%s_", plString::FromUtf8(params[0])); + plString foo = plString::Format("%s_", (char*)params[0]); plKey key = FindObjectByNameAndType(foo, "plCameraModifier1", nil, str, true); PrintString(str); @@ -4338,7 +4339,7 @@ PF_CONSOLE_CMD( Access, seq->Activate(); - sprintf(str, "%s Active\n", name); + sprintf(str, "%s Active\n", name.c_str()); PrintString(str); } @@ -4359,7 +4360,7 @@ PF_CONSOLE_CMD( Access, seq->DeActivate(); - sprintf(str, "%s Unactive\n", name); + sprintf(str, "%s Unactive\n", name.c_str()); PrintString(str); } ////////////////// @@ -4504,9 +4505,7 @@ PF_CONSOLE_CMD( Access, seq->Activate(); - char str[256]; - sprintf(str, "%s Active\n", seq->GetKey()->GetName()); - PrintString(str); + PrintString(plString::Format("%s Active\n", seq->GetKey()->GetName().c_str()).c_str()); } PF_CONSOLE_CMD( Access, @@ -4523,9 +4522,7 @@ PF_CONSOLE_CMD( Access, seq->DeActivate(); - char str[256]; - sprintf(str, "%s Unactive\n", seq->GetKey()->GetName()); - PrintString(str); + PrintString(plString::Format("%s Unactive\n", seq->GetKey()->GetName().c_str()).c_str()); } PF_CONSOLE_CMD( Access, @@ -4533,7 +4530,6 @@ PF_CONSOLE_CMD( Access, "string clothItem", "Set face morphMod to affect a clothing item" ) { - char str[256]; plMorphSequence* seq = LocalMorphSequence(); if( !seq ) { @@ -4548,8 +4544,8 @@ PF_CONSOLE_CMD( Access, seq->SetUseSharedMesh(true); seq->AddSharedMesh(item->fMeshes[plClothingItem::kLODHigh]); - sprintf(str, "%s on item %s\n", seq->GetKey()->GetName(), (char *)params[0]); - PrintString(str); + PrintString(plString::Format("%s on item %s\n", seq->GetKey()->GetName().c_str(), + (char *)params[0]).c_str()); } #include "pfSurface/plFadeOpacityMod.h" diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp index d94603d9..2d2a0151 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfConsoleDirSrc.cpp @@ -102,7 +102,7 @@ hsBool pfConsoleDirSrc::ParseDirectory(const std::wstring& path, const std::wst error << errorMsg << L":\n\nCommand: '" << errorLine << L"'\n\nPress OK to continue parsing files."; hsMessageBox(error.str().c_str(), caption.str().c_str(), hsMessageBoxNormal); - + delete [] errorMsg; delete [] errorLine; diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp index 7a0b2f4c..97da27ef 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp +++ b/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp @@ -319,7 +319,7 @@ static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info) GetType(kOnRequest); GetType(kOnRemove); GetType(kOnReplace); - xtl::format(info, "Obj: %s RefType: %s", refMsg->GetRef()->GetKeyName(), typeName); + xtl::format(info, "Obj: %s RefType: %s", refMsg->GetRef()->GetKeyName().c_str(), typeName); return true; } diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp index 83bbe486..63888ae7 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp @@ -279,7 +279,7 @@ hsBool pfConsoleEngine::ExecuteFile( const wchar_t *fileName ) if( !RunCommand( string, DummyPrintFn ) ) { - sprintf( string, "Error in console file %s, command line %d: %s", fileName, line, fErrorMsg ); + sprintf( string, "Error in console file %S, command line %d: %s", fileName, line, fErrorMsg ); ISetErrorMsg( string ); stream->Close(); delete stream; diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp index a8a7003a..209ff2f5 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp @@ -221,7 +221,7 @@ pfGUIListPicture::pfGUIListPicture( plKey mipKey, hsBool respectAlpha ) : pfGUIL { // Gotta make and grab an uncompressed one plMipmap *uncompBuffer = hsCodecManager::Instance().CreateUncompressedMipmap( mip, hsCodecManager::k32BitDepth ); - plString str = plString::Format( "%s_uncomp", mip->GetKeyName() ); + plString str = plString::Format( "%s_uncomp", mip->GetKeyName().c_str() ); fMipmapKey = hsgResMgr::ResMgr()->NewKey( str, uncompBuffer, fMipmapKey->GetUoid().GetLocation() ); fMipmapKey->RefObject(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp index fa475e89..252040f7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp @@ -1274,7 +1274,7 @@ PyObject* cyAvatar::GetTintClothingItemL(const char* clothing_name, uint8_t laye } char errmsg[256]; - sprintf(errmsg,"Cannot find clothing item %d to find out what tint it is",clothing_name); + sprintf(errmsg,"Cannot find clothing item %s to find out what tint it is",clothing_name); PyErr_SetString(PyExc_KeyError, errmsg); // returning nil means an error occurred return nil; diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index 84509e15..057733b7 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp @@ -2362,7 +2362,7 @@ public: if ( guid ) { - PyObject* retVal = PyObject_CallMethod(fPyObject, "publicAgeRemoved", "s", guid->AsString()); + PyObject* retVal = PyObject_CallMethod(fPyObject, "publicAgeRemoved", "s", guid->AsString().c_str()); Py_XDECREF(retVal); } } @@ -2454,7 +2454,6 @@ const char* cyMisc::GetCameraNumber(int number) if (pCam->GetTarget()) { const char* ret = pCam->GetTarget()->GetKeyName().c_str(); - (ret==nil) ? "empty" : ret; plString str = plString::Format("saving camera named %s to chronicle\n",ret); plVirtualCam1::Instance()->AddMsgToLog(str.c_str()); return ret; diff --git a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp index 5a5d2588..f0181543 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyPhysics.cpp @@ -334,9 +334,9 @@ void cyPhysics::Move(pyVector3& direction, float distance) } else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); } } } @@ -404,9 +404,9 @@ void cyPhysics::Rotate(float rad, pyVector3& axis) } else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); } } } diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp index 41ab1ffd..c658cf2a 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp @@ -410,12 +410,12 @@ plPythonFileMod::~plPythonFileMod() PyObject *modules = PyImport_GetModuleDict(); if( modules && (m = PyDict_GetItemString(modules, fModuleName.c_str())) && PyModule_Check(m)) { - hsStatusMessageF("Module %s removed from python dictionary",fModuleName); + hsStatusMessageF("Module %s removed from python dictionary",fModuleName.c_str()); PyDict_DelItemString(modules, fModuleName.c_str()); } else { - hsStatusMessageF("Module %s not found in python dictionary. Already removed?",fModuleName); + hsStatusMessageF("Module %s not found in python dictionary. Already removed?",fModuleName.c_str()); } // the above code should have unloaded the module from python, so it will delete itself, therefore // we need to set our pointer to nil to make sure we don't try to use it diff --git a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp index 063778de..29cbf16f 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp @@ -105,7 +105,7 @@ bool pyCritterBrain::RunningBehavior(const std::string& behaviorName) const std::string pyCritterBrain::BehaviorName(int behavior) const { if (!fBrain) - return false; + return nil; return fBrain->BehaviorName(behavior); } @@ -133,14 +133,14 @@ int pyCritterBrain::NextBehavior() const std::string pyCritterBrain::IdleBehaviorName() const { if (!fBrain) - return false; + return nil; return fBrain->IdleBehaviorName(); } std::string pyCritterBrain::RunBehaviorName() const { if (!fBrain) - return false; + return nil; return fBrain->RunBehaviorName(); } diff --git a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp index 0a1fcd42..a1533cb8 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp @@ -284,9 +284,9 @@ PyObject* pySceneObject::GetLocalToWorld() return pyMatrix44::New((hsMatrix44)ci->GetLocalToWorld()); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } @@ -313,9 +313,9 @@ PyObject* pySceneObject::GetWorldToLocal() return pyMatrix44::New((hsMatrix44)ci->GetWorldToLocal()); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } @@ -342,9 +342,9 @@ PyObject* pySceneObject::GetLocalToParent() return pyMatrix44::New((hsMatrix44)ci->GetLocalToParent()); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } @@ -371,9 +371,9 @@ PyObject* pySceneObject::GetParentToLocal() return pyMatrix44::New((hsMatrix44)ci->GetParentToLocal()); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } @@ -416,9 +416,9 @@ PyObject* pySceneObject::GetWorldPosition() return pyPoint3::New((hsPoint3)ci->GetWorldPos()); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } @@ -445,9 +445,9 @@ PyObject* pySceneObject::GetViewVector() return pyVector3::New(ci->GetLocalToWorld().GetAxis(hsMatrix44::kView)); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } @@ -474,9 +474,9 @@ PyObject* pySceneObject::GetUpVector() return pyVector3::New(ci->GetLocalToWorld().GetAxis(hsMatrix44::kUp)); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } @@ -503,9 +503,9 @@ PyObject* pySceneObject::GetRightVector() return pyVector3::New(ci->GetLocalToWorld().GetAxis(hsMatrix44::kRight)); else { - char errmsg[256]; - sprintf(errmsg,"Sceneobject %s does not have a coordinate interface.",obj->GetKeyName()); - PyErr_SetString(PyExc_RuntimeError, errmsg); + plString errmsg = plString::Format("Sceneobject %s does not have a coordinate interface.", + obj->GetKeyName().c_str()); + PyErr_SetString(PyExc_RuntimeError, errmsg.c_str()); return nil; // return nil to tell python we errored } } diff --git a/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h index 56b862cc..e3b7c4da 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plEventCallbackMsg.h @@ -63,14 +63,14 @@ enum CallbackEvent class plEventCallbackMsg : public plMessage { protected: - + public: - float fEventTime; // the time for time events + float fEventTime; // the time for time events CallbackEvent fEvent; // the event - int16_t fIndex; // the index of the object we want the event to come from + int16_t fIndex; // the index of the object we want the event to come from // (where applicable, required for sounds) - int16_t fRepeats; // -1 for infinite repeats, 0 for one call, no repeats - int16_t fUser; // User defined data, useful for keeping track of multiple callbacks + int16_t fRepeats; // -1 for infinite repeats, 0 for one call, no repeats + int16_t fUser; // User defined data, useful for keeping track of multiple callbacks plEventCallbackMsg() : fEventTime(0.0f), fEvent((CallbackEvent)0), fRepeats(-1), fUser(0), fIndex(0) {;} plEventCallbackMsg (const plKey &s, @@ -78,7 +78,7 @@ public: const double* t) : plMessage(s, r, t), fEventTime(0.0f), fEvent((CallbackEvent)0), fRepeats(-1), fUser(0), fIndex(0) {;} - + plEventCallbackMsg(const plKey &receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plMessage(nil, receiver, nil), fEvent(e), fIndex(idx), fEventTime(t), fRepeats(repeats), fUser(user) {} diff --git a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h index a7e16290..a9bc47b2 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plMessage.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plMessage.h @@ -135,12 +135,12 @@ public: hsBool Send(const plKey r=nil, hsBool async=false); // Message will self-destruct after send. hsBool SendAndKeep(const plKey r=nil, hsBool async=false); // Message won't self-destruct after send. - const double GetTimeStamp() const { return fTimeStamp; } + double GetTimeStamp() const { return fTimeStamp; } plMessage& SetTimeStamp(double t) { fTimeStamp = t; return *this; } hsBool HasBCastFlag(uint32_t f) const { return 0 != (fBCastFlags & f); } plMessage& SetBCastFlag(uint32_t f, hsBool on=true) { if( on )fBCastFlags |= f; else fBCastFlags &= ~f; return *this; } - + void SetAllBCastFlags(uint32_t f) { fBCastFlags=f; } uint32_t GetAllBCastFlags() const { return fBCastFlags; } diff --git a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp index a28ef3d6..064e09ad 100644 --- a/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp +++ b/Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp @@ -141,11 +141,10 @@ hsBool plLogicModBase::MsgReceive(plMessage* msg) hsAssert(pSMsg->GetType() != plServerReplyMsg::kUnInit, "uninit server reply msg"); #if 1 - char str[256]; - sprintf(str, "LM: LogicModifier %s recvd trigger request reply:%s, wasRequesting=%d, t=%f\n", GetKeyName(), + plNetClientApp::GetInstance()->DebugMsg("LM: LogicModifier %s recvd trigger request reply:%s, wasRequesting=%d, t=%f\n", + GetKeyName().c_str(), pSMsg->GetType() == plServerReplyMsg::kDeny ? "denied" : "confirmed", HasFlag(kRequestingTrigger), hsTimer::GetSysSeconds()); - plNetClientApp::GetInstance()->DebugMsg(str); #endif if (pSMsg->GetType() == plServerReplyMsg::kDeny) @@ -191,21 +190,17 @@ void plLogicModBase::RequestTrigger(hsBool netRequest) if (HasFlag(kTriggered)) { #if 1 - char str[256]; - sprintf(str, "LM: %s ignoring RequestTrigger(), already triggered, t=%f\n", GetKeyName(), - hsTimer::GetSysSeconds()); - plNetClientApp::GetInstance()->DebugMsg(str); + plNetClientApp::GetInstance()->DebugMsg("LM: %s ignoring RequestTrigger(), already triggered, t=%f\n", + GetKeyName().c_str(), hsTimer::GetSysSeconds()); #endif return; } - + if (HasFlag(kRequestingTrigger)) { #if 1 - char str[256]; - sprintf(str, "LM: %s ignoring RequestTrigger(), already requesting trigger, t=%f\n", GetKeyName(), - hsTimer::GetSysSeconds()); - plNetClientApp::GetInstance()->DebugMsg(str); + plNetClientApp::GetInstance()->DebugMsg("LM: %s ignoring RequestTrigger(), already requesting trigger, t=%f\n", + GetKeyName().c_str(), hsTimer::GetSysSeconds()); #endif return; @@ -220,9 +215,8 @@ void plLogicModBase::RequestTrigger(hsBool netRequest) SetFlag(kRequestingTrigger); #if 1 - char str[256]; - sprintf(str, "LM: %s Setting RequestingTriggert=%f\n", GetKeyName(), hsTimer::GetSysSeconds()); - plNetClientApp::GetInstance()->DebugMsg(str); + plNetClientApp::GetInstance()->DebugMsg("LM: %s Setting RequestingTriggert=%f\n", + GetKeyName().c_str(), hsTimer::GetSysSeconds()); #endif } @@ -256,12 +250,10 @@ void plLogicModBase::PreTrigger(hsBool netRequest) void plLogicModBase::Trigger(hsBool netRequest) { #if 1 - char str[256]; - sprintf(str, "LogicModifier %s is triggering, activatorType=%d\n", - GetKeyName(), HasFlag(kTypeActivator)); - plNetClientApp::GetInstance()->DebugMsg(str); + plNetClientApp::GetInstance()->DebugMsg("LogicModifier %s is triggering, activatorType=%d\n", + GetKeyName().c_str(), HasFlag(kTypeActivator)); #endif - + ClearFlag(kRequestingTrigger); if (!HasFlag(kMultiTrigger)) SetFlag(kTriggered); diff --git a/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h b/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h index c742822d..97baf1af 100644 --- a/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h +++ b/Sources/Plasma/NucleusLib/pnNetCommon/plNetServers.h @@ -102,8 +102,8 @@ class plNetServerAgentConstants { public: static const char* GetName() { return "Server_Agent"; } - static const uint16_t GetPort() { return 4800; } - static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAgent; } + static uint16_t GetPort() { return 4800; } + static plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAgent; } }; @@ -111,8 +111,8 @@ class plNetLookupServerConstants { public: static const char* GetName() { return "Lookup_Server"; } - static const uint16_t GetPort() { return 2000; } - static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLookup; } + static uint16_t GetPort() { return 2000; } + static plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLookup; } }; @@ -120,8 +120,8 @@ class plNetLobbyServerConstants { public: static const char* GetName() { return "Generated_Lobby"; } - static const uint16_t GetPort() { return 5000; } - static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLobby; } + static uint16_t GetPort() { return 5000; } + static plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLobby; } }; @@ -129,8 +129,8 @@ class plNetVaultServerConstants { public: static const char* GetName() { return "Vault_Server"; } - static const uint16_t GetPort() { return 2001; } - static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kVault; } + static uint16_t GetPort() { return 2001; } + static plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kVault; } }; @@ -138,8 +138,8 @@ class plNetAuthServerConstants { public: static const char* GetName() { return "Auth_Server"; } - static const uint16_t GetPort() { return 2002; } - static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAuth; } + static uint16_t GetPort() { return 2002; } + static plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAuth; } }; @@ -147,17 +147,17 @@ class plNetAdminServerConstants { public: static const char* GetName() { return "Admin_Server"; } - static const uint16_t GetPort() { return 2003; } - static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAdmin; } + static uint16_t GetPort() { return 2003; } + static plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAdmin; } }; class plNetGameServerConstants { public: static const char* GetName() { return "Game_Server"; } - static const uint16_t GetLowPort() { return 5001;} - static const uint16_t GetHighPort() { return 6001;} - static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kGame; } + static uint16_t GetLowPort() { return 5001;} + static uint16_t GetHighPort() { return 6001;} + static plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kGame; } }; diff --git a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp index 61856b50..40753af6 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp +++ b/Sources/Plasma/NucleusLib/pnUUID/pnUUID_Unix.cpp @@ -106,13 +106,13 @@ bool plUUID::FromString( const char * str ) return true; } -bool plUUID::ToStdString( std::string & out ) const +bool plUUID::ToString( plString & out ) const { uuid_t g; plUUIDHelper::CopyToNative( g, this ); char buf[40]; uuid_unparse( g, buf ); - out = buf; + out = _TEMP_CONVERT_FROM_LITERAL( buf ); return true; } diff --git a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h index 5858c4e4..7e753b21 100644 --- a/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h +++ b/Sources/Plasma/PubUtilLib/plAgeDescription/plAgeDescription.h @@ -135,7 +135,7 @@ public: bool ReadFromFile( const char *fileNameToReadFrom ) ; void Read(hsStream* stream); void Write(hsStream* stream) const; - + // Overload for plInitSectionTokenReader virtual const char *GetSectionName( void ) const; diff --git a/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp b/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp index deb0a3d4..0f209580 100644 --- a/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp +++ b/Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp @@ -79,7 +79,7 @@ bool ReportRoomToServer(const plKey &key) if (skip) hsLogEntry(plNetApp::StaticDebugMsg("Not reporting room %s to server, reserved=%d, virtual=%d", - key->GetName(), keyLoc.IsReserved(), keyLoc.IsVirtual())); + key->GetName().c_str(), keyLoc.IsReserved(), keyLoc.IsVirtual())); return !skip; } @@ -110,7 +110,7 @@ void plAgeLoader::FinishedPagingInRoom(plKey* rmKey, int numRms) continue; pagingMsg->AddRoom(key); - hsLogEntry(nc->DebugMsg("\tSending PageIn/RequestState msg, room=%s\n", key->GetName())); + hsLogEntry(nc->DebugMsg("\tSending PageIn/RequestState msg, room=%s\n", key->GetName().c_str())); } if( pagingMsg->GetNumRooms() > 0 ) // all rooms were reserved { @@ -148,7 +148,7 @@ void plAgeLoader::FinishedPagingOutRoom(plKey* rmKey, int numRms) if( found != fPendingPageOuts.end() ) { fPendingPageOuts.erase( found ); - nc->DebugMsg("Finished paging out room %s", rmKey[i]->GetName()); + nc->DebugMsg("Finished paging out room %s", rmKey[i]->GetName().c_str()); } } @@ -179,7 +179,7 @@ void plAgeLoader::StartPagingOutRoom(plKey* rmKey, int numRms) continue; pagingMsg.AddRoom(rmKey[i]); - nc->DebugMsg("\tSending PageOut msg, room=%s", rmKey[i]->GetName()); + nc->DebugMsg("\tSending PageOut msg, room=%s", rmKey[i]->GetName().c_str()); } if (!pagingMsg.GetNumRooms()) // all rooms were reserved @@ -205,7 +205,7 @@ void plAgeLoader::IgnorePagingOutRoom(plKey* rmKey, int numRms) if( found != fPendingPageOuts.end() ) { fPendingPageOuts.erase( found ); - nc->DebugMsg("Ignoring paged out room %s", rmKey[i]->GetName()); + nc->DebugMsg("Ignoring paged out room %s", rmKey[i]->GetName().c_str()); } } diff --git a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp index 07d4cf71..52e10efe 100644 --- a/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp +++ b/Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp @@ -421,7 +421,8 @@ void plWinAudible::SetFilename(int index, const char *filename, hsBool isCompres } else { - plStatusLog::AddLineS("audio.log", "Cannot set filename of non-streaming sound. %s", fSoundObjs[ index ]->GetKeyName()); + plStatusLog::AddLineS("audio.log", "Cannot set filename of non-streaming sound. %s", + fSoundObjs[ index ]->GetKeyName().c_str()); } } diff --git a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp index 6ed7adbb..7c992a42 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp @@ -798,7 +798,7 @@ void plAudioSystem::IUpdateSoftSounds( const hsPoint3 &newPosition ) sortedList->fRank, sound->GetVolume() ? sound->GetVolumeRank() / sound->GetVolume() : 0, sound->GetEAXSettings().GetCurrSofts().GetOcclusion(), - sound->GetKeyName() + sound->GetKeyName().c_str() ); } else @@ -809,7 +809,7 @@ void plAudioSystem::IUpdateSoftSounds( const hsPoint3 &newPosition ) sound->GetPriority(), sortedList->fRank, sound->GetVolume() ? sound->GetVolumeRank() / sound->GetVolume() : 0, - sound->GetKeyName() + sound->GetKeyName().c_str() ); } i++; @@ -833,7 +833,7 @@ void plAudioSystem::IUpdateSoftSounds( const hsPoint3 &newPosition ) "%d %1.2f %s", sound->GetPriority(), sound->GetVolume() ? sound->GetVolumeRank() / sound->GetVolume() : 0, - sound->GetKeyName() + sound->GetKeyName().c_str() ); } diff --git a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp index 6d019be9..4011462e 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plSound.cpp @@ -590,7 +590,7 @@ void plSound::IStartFade( plFadeParams *params, float offsetIntoFade ) fFadeInParams.fVolStart = fCurrVolume; // Hopefully, we got to fFadedVolume, but maybe not fFadeInParams.fVolEnd = fDesiredVol; fCurrFadeParams = &fFadeInParams; - plStatusLog::AddLineS("audio.log", "Fading in %s", GetKeyName()); + plStatusLog::AddLineS("audio.log", "Fading in %s", GetKeyName().c_str()); } else fCurrFadeParams = params; @@ -809,7 +809,7 @@ bool plSound::ILoadDataBuffer( void ) if(!buffer) { hsAssert(false, "unable to load sound buffer"); - plStatusLog::AddLineS("audio.log", "Unable to load sound buffer: %s", GetKeyName()); + plStatusLog::AddLineS("audio.log", "Unable to load sound buffer: %s", GetKeyName().c_str()); return false; } SetLength( buffer->GetDataLengthInSecs() ); diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp index e7f3bb6c..1569daa3 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp @@ -241,7 +241,7 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D ) if( GetKey() != nil && GetKeyName().Find( "Footstep" ) >= 0 ) ; else - plStatusLog::AddLineS( "audioTimes.log", "%s (%s)", str, GetKey() ? GetKeyName().c_str() : "unkeyed" ); + plStatusLog::AddLineS( "audioTimes.log", "%s (%s)", str.c_str(), GetKey() ? GetKeyName().c_str() : "unkeyed" ); fTotalBytes = bufferSize; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp index e25190ff..8afeb6c6 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp @@ -159,7 +159,7 @@ void plWin32Sound::IActuallyStop() --fIncidentalsPlaying; } fDSoundBuffer->Stop(); - plStatusLog::AddLineS("impacts.log", "Stopping %s", GetKeyName()); + plStatusLog::AddLineS("impacts.log", "Stopping %s", GetKeyName().c_str()); } fReallyPlaying = false; diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp index 527a02fd..ee60463a 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp @@ -169,15 +169,15 @@ hsBool plWin32StaticSound::LoadSound( hsBool is3D ) { delete fDSoundBuffer; fDSoundBuffer = nil; - plStatusLog::AddLineS("audio.log", "Could not play static sound, no voices left %s", GetKeyName()); + plStatusLog::AddLineS("audio.log", "Could not play static sound, no voices left %s", GetKeyName().c_str()); return false; } - + plProfile_EndTiming( StaticSndShoveTime ); IRefreshEAXSettings( true ); fTotalBytes = bufferSize; - + plProfile_NewMem(MemSounds, fTotalBytes); // get pertinent info diff --git a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp index 3d22d128..dec0046d 100644 --- a/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp +++ b/Sources/Plasma/PubUtilLib/plAudio/plWin32StreamingSound.cpp @@ -208,13 +208,13 @@ plSoundBuffer::ELoadReturnVal plWin32StreamingSound::IPreLoadBuffer( hsBool play sprintf( str, " Readied file %s for streaming", fSrcFilename ); IPrintDbgMessage( str ); - + // dont free sound data until we have a chance to use it in load sound return fDataStream ? plSoundBuffer::kSuccess : plSoundBuffer::kError; } - - plStatusLog::AddLineS("audio.log", "EnsureLoadable failed for streaming sound %d", fDataBufferKey->GetName()); + + plStatusLog::AddLineS("audio.log", "EnsureLoadable failed for streaming sound %d", fDataBufferKey->GetName().c_str()); return plSoundBuffer::kError; } @@ -263,9 +263,9 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) if( retVal == plSoundBuffer::kError ) { - char str[ 256 ]; - sprintf( str, "Unable to open streaming source %s", fDataBufferKey->GetName() ); - IPrintDbgMessage( str, true ); + plString str = plString::Format( "Unable to open streaming source %s", + fDataBufferKey->GetName().c_str() ); + IPrintDbgMessage( str.c_str(), true ); fFailed = true; return false; } @@ -349,7 +349,7 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) delete fDSoundBuffer; fDSoundBuffer = nil; - plStatusLog::AddLineS("audio.log", "Could not play streaming sound, no voices left %s", GetKeyName()); + plStatusLog::AddLineS("audio.log", "Could not play streaming sound, no voices left %s", GetKeyName().c_str()); return false; } FreeSoundData(); @@ -361,7 +361,8 @@ hsBool plWin32StreamingSound::LoadSound( hsBool is3D ) sprintf( str, " Streaming %s.", fSrcFilename); IPrintDbgMessage( str ); - plStatusLog::AddLineS( "audioTimes.log", 0xffffffff, "Streaming %4.2f secs of %s", fDataStream->GetLengthInSecs(), GetKey()->GetUoid().GetObjectName() ); + plStatusLog::AddLineS( "audioTimes.log", 0xffffffff, "Streaming %4.2f secs of %s", + fDataStream->GetLengthInSecs(), GetKey()->GetUoid().GetObjectName().c_str() ); // Get pertinent info SetLength( (float)fDataStream->GetLengthInSecs() ); @@ -401,10 +402,10 @@ void plWin32StreamingSound::IStreamUpdate() } return; } - + if(!fDSoundBuffer->StreamingFillBuffer(fDataStream)) { - plStatusLog::AddLineS("audio.log", "%s Streaming buffer fill failed", GetKeyName()); + plStatusLog::AddLineS("audio.log", "%s Streaming buffer fill failed", GetKeyName().c_str()); } } plProfile_EndTiming( StreamSndShoveTime ); diff --git a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp index 514fd583..d175f66c 100644 --- a/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp +++ b/Sources/Plasma/PubUtilLib/plAudioCore/plAudioFileReader.cpp @@ -66,16 +66,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #define kCacheDirName "temp" -static void hsStrUpper(char *s) -{ - if (s) - { - int len = hsStrlen(s); - for (int i = 0; i < len; i++) - s[i] = toupper(s[i]); - } -} - plAudioFileReader* plAudioFileReader::CreateReader(const char* path, plAudioCore::ChannelSelect whichChan, StreamType type) { const char* ext = plFileUtils::GetFileExt(path); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp index f97c87c4..f2295e25 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp @@ -312,7 +312,7 @@ void plAGMasterMod::DumpAniGraph(const char *justThisChannel, bool optimized, do plMatrixChannel *topChannel = plMatrixChannel::ConvertNoRef(channel); if(topChannel) { - hsStatusMessageF("AGModifier: <%s>", mod->GetChannelName()); + hsStatusMessageF("AGModifier: <%s>", mod->GetChannelName().c_str()); topChannel->Dump(1, optimized, time); } } @@ -718,7 +718,7 @@ hsBool plAGMasterMod::MsgReceive(plMessage* msg) if (genRefMsg->fType == kPrivateAnim) { plAnimVector::iterator i = fPrivateAnims.begin(); - for (i; i != fPrivateAnims.end(); i++) + for ( ; i != fPrivateAnims.end(); i++) { plAGAnim *currAnim = *i; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp index c5d0154e..070a1c0e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp @@ -2652,7 +2652,7 @@ int plArmatureMod::RefreshDebugDisplay() void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt) { - sprintf(strBuf, "Armature <%s>:", fRootName); + sprintf(strBuf, "Armature <%s>:", fRootName.c_str()); debugTxt.DrawString(x, y, strBuf, 255, 128, 128); y += lineHeight; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp index 444991c4..dd25ac55 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvLadderModifier.cpp @@ -135,7 +135,8 @@ bool plAvLadderMod::IIsReadyToClimb() if (dot >= kTolerance && movingForward) { - DetectorLogSpecial("%s: Ladder starting climb (%f)", GetKeyName(), hsRadiansToDegrees(acos(dot))); + DetectorLogSpecial("%s: Ladder starting climb (%f)", + GetKeyName().c_str(), hsRadiansToDegrees(acos(dot))); return true; } else if (movingForward) @@ -179,7 +180,7 @@ hsBool plAvLadderMod::MsgReceive(plMessage* msg) // we can check every frame if (fAvatarInBox) { - DetectorLogSpecial("%s: Avatar entered ladder region", GetKeyName()); + DetectorLogSpecial("%s: Avatar entered ladder region", GetKeyName().c_str()); if (IIsReadyToClimb()) ITriggerSelf(collMsg->fOtherKey); @@ -188,7 +189,7 @@ hsBool plAvLadderMod::MsgReceive(plMessage* msg) } else { - DetectorLogSpecial("%s: Avatar exited ladder region", GetKeyName()); + DetectorLogSpecial("%s: Avatar exited ladder region", GetKeyName().c_str()); plgDispatch::Dispatch()->UnRegisterForExactType(plEvalMsg::Index(), GetKey()); } @@ -215,7 +216,7 @@ hsBool plAvLadderMod::MsgReceive(plMessage* msg) } else if (notifyMsg->fID == kNotifyAvatarOnLadder) { - DetectorLogSpecial("%s: Avatar mounted ladder", GetKeyName()); + DetectorLogSpecial("%s: Avatar mounted ladder", GetKeyName().c_str()); fAvatarMounting = false; } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp index 62a0eb18..07e4e982 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp @@ -605,7 +605,7 @@ void plAvatarMgr::AddOneShot(plOneShotMod *oneshot) { plString name = oneshot->GetTarget(0)->GetKey()->GetName(); plOneShotMod *alreadyThere = FindOneShot(name); - + if ( ! alreadyThere) { @@ -621,14 +621,14 @@ void plAvatarMgr::RemoveOneShot(plOneShotMod *oneshot) while (i != fOneShots.end()) { - plString name = (*i).first; - plOneShotMod *thisOneshot = (*i).second; + plString name = i->first; + plOneShotMod *thisOneshot = i->second; if(oneshot == thisOneshot) { - i = fOneShots.erase(i); + fOneShots.erase(i++); } else { - i++; + ++i; } } } @@ -637,12 +637,12 @@ void plAvatarMgr::RemoveOneShot(plOneShotMod *oneshot) plOneShotMod *plAvatarMgr::FindOneShot(const plString &name) { plOneShotMap::iterator found = fOneShots.find(name); - + if (found == fOneShots.end()) { return nil; } else { - return (*found).second; + return found->second; } } diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp index e01d7457..c28ae41e 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plMatrixChannel.cpp @@ -170,7 +170,7 @@ void plMatrixChannel::Dump(int indent, bool optimized, double time) { indentStr += "- "; } - hsStatusMessageF("%s matChan<%s>", indentStr.c_str(), fName); + hsStatusMessageF("%s matChan<%s>", indentStr.c_str(), fName.c_str()); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -300,9 +300,9 @@ void plMatrixTimeScale::Dump(int indent, bool optimized, double time) { indentStr += "- "; } - hsStatusMessageF("%s matTimeScale <%s> at time <%f>", indentStr.c_str(), fName, fTimeSource->Value(time, true)); + hsStatusMessageF("%s matTimeScale <%s> at time <%f>", indentStr.c_str(), fName.c_str(), fTimeSource->Value(time, true)); fChannelIn->Dump(indent + 1, optimized, time); - + } @@ -470,7 +470,7 @@ void plMatrixBlend::Dump(int indent, bool optimized, double time) { indentStr += "- "; } - hsStatusMessageF("%s matBlend<%s>, bias:<%f>", indentStr.c_str(), fName, fChannelBias->Value(time, true)); + hsStatusMessageF("%s matBlend<%s>, bias:<%f>", indentStr.c_str(), fName.c_str(), fChannelBias->Value(time, true)); if(optimized) { fOptimizedB->Dump(indent + 1, optimized, time); @@ -569,7 +569,7 @@ void plMatrixControllerChannel::Dump(int indent, bool optimized, double time) { indentStr += "- "; } - hsStatusMessageF("%s MatController<%s>", indentStr.c_str(), fName); + hsStatusMessageF("%s MatController<%s>", indentStr.c_str(), fName.c_str()); } // Write ------------------------------------------------------------- diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h index e62bf5f8..c264f0cf 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plCluster.h @@ -102,7 +102,7 @@ public: const hsBitVector& GetVisSet() const { return fGroup->GetVisSet(); } const hsBitVector& GetVisNot() const { return fGroup->GetVisNot(); } - const hsTArray& GetLights() const { fGroup->GetLights(); } + const hsTArray& GetLights() const { return fGroup->GetLights(); } const plLODDist& GetLOD() const { return fGroup->GetLOD(); } }; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h index 7ebde71c..f83ce1f3 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.h @@ -280,7 +280,7 @@ class plDrawableSpans : public plDrawable virtual const plSpan *GetSpan( uint32_t index ) const { return fSpans[ index ]; } virtual const plSpan *GetSpan( uint32_t diIndex, uint32_t index ) const { return fSpans[ (*fDIIndices[ diIndex ])[ index ] ]; } - virtual const uint32_t GetNumSpans( void ) const { return fSpans.GetCount(); } + virtual uint32_t GetNumSpans( void ) const { return fSpans.GetCount(); } virtual const hsTArray &GetSpanArray( void ) const { return fSpans; } hsMatrix44* GetMatrixPalette(int baseMatrix) const { return &fLocalToWorlds[baseMatrix]; } @@ -294,7 +294,7 @@ class plDrawableSpans : public plDrawable // BufferGroups accessed only by Pipeline and it's close personal acquaintances. plGBufferGroup* GetBufferGroup(uint32_t i) const { return fGroups[i]; } - uint32_t GetNumBufferGroups() const { return fGroups.GetCount(); } + uint32_t GetNumBufferGroups() const { return fGroups.GetCount(); } const hsTArray& GetSourceSpans() const { return fSourceSpans; } void DirtyVertexBuffer(uint32_t group, uint32_t idx); diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp index a49ed294..380f79a5 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp @@ -737,7 +737,7 @@ void plDynaDecalMgr::IAllocAuxSpan(plAuxSpan* aux, uint32_t maxNumVerts, uint32_ uint16_t* dataPtr = nil; grp->ReserveIndexStorage(maxNumIdx, &aux->fIBufferIdx, &aux->fIStartIdx, &dataPtr); - aux->fIStartIdx; + aux->fIStartIdx /* should be assigning something? */; aux->fILength = 0; diff --git a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp index e24c137a..9c234414 100644 --- a/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp +++ b/Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp @@ -1806,7 +1806,7 @@ hsGMaterial* plWaveSet7::ICreateBumpLayersPS() // Create a blank material hsGMaterial* bumpMat = new hsGMaterial; - plString buff = plString::Format("%s_BumpMatPS", GetKey()->GetName()); + plString buff = plString::Format("%s_BumpMatPS", GetKey()->GetName().c_str()); hsgResMgr::ResMgr()->NewKey(buff, bumpMat, GetKey()->GetUoid().GetLocation()); plMipmap* mipMap = ICreateBumpMipmapPS(); diff --git a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp index 55240ee3..4920c953 100644 --- a/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp +++ b/Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp @@ -520,7 +520,7 @@ bool plFileUtils::GetSecureEncryptionKey(const wchar_t* filename, uint32_t* key, std::wstring sFilename = filename; // grab parent directory - unsigned loc = sFilename.rfind(L"\\"); + size_t loc = sFilename.rfind(L"\\"); if (loc == std::wstring::npos) loc = sFilename.rfind(L"/"); diff --git a/Sources/Plasma/PubUtilLib/plGLight/plLightKonstants.h b/Sources/Plasma/PubUtilLib/plGLight/plLightKonstants.h index 1e842fe1..80206a45 100644 --- a/Sources/Plasma/PubUtilLib/plGLight/plLightKonstants.h +++ b/Sources/Plasma/PubUtilLib/plGLight/plLightKonstants.h @@ -46,7 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class plSillyLightKonstants { public: - static const float GetFarPowerKonst( void ) + static float GetFarPowerKonst( void ) { // arbitrary const, make light drop to 1/kFarPower at attenEnd. 15 just looked good to me. mf // Done as a function so we don't have to worry about a separate .cpp file diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp index a5a96fd3..b384ecf0 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp @@ -166,7 +166,7 @@ void plKeyboardDevice::HandleKeyEvent(plOSMsg message, plKeyDef key, bool bKeyDo { // update the internal keyboard state unsigned int keyCode = (unsigned int)key; - if ((key >= 0) && (key < 256)) + if (key < 256) fKeyboardState[key] = bKeyDown; if (key == KEY_SHIFT) diff --git a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp index cd095f80..4e254b7d 100644 --- a/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp +++ b/Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp @@ -182,11 +182,11 @@ void plSceneInputInterface::IHalfFadeAvatar(hsBool out) plIfaceFadeAvatarMsg* pMsg = new plIfaceFadeAvatarMsg(); pMsg->SetSubjectKey(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); pMsg->SetBCastFlag(plMessage::kBCastByExactType); - pMsg->SetBCastFlag(plMessage::kNetPropagate, FALSE); + pMsg->SetBCastFlag(plMessage::kNetPropagate, false); pMsg->SetFadeOut(out); pMsg->Send(); fFadedLocalAvatar = out; - + } @@ -270,9 +270,9 @@ hsBool plSceneInputInterface::MsgReceive( plMessage *msg ) if (fShowLOS) { if (pLOSMsg->fNoHit) - DetectorLogSpecial("%s: LOS miss", pObj->GetKeyName()); + DetectorLogSpecial("%s: LOS miss", pObj->GetKeyName().c_str()); else - DetectorLogSpecial("%s: LOS hit", pObj->GetKeyName()); + DetectorLogSpecial("%s: LOS hit", pObj->GetKeyName().c_str()); } int i; const plInterfaceInfoModifier* pMod = 0; @@ -837,17 +837,17 @@ void plSceneInputInterface::ILinkOffereeToAge() info.SetAgeInstanceGuid(&guid); std::string title; std::string desc; - + unsigned nameLen = plNetClientMgr::GetInstance()->GetPlayerName().GetSize(); if (plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 's' || plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 'S') { - xtl::format( title, "%s'", plNetClientMgr::GetInstance()->GetPlayerName() ); - xtl::format( desc, "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName() ); + xtl::format( title, "%s'", plNetClientMgr::GetInstance()->GetPlayerName().c_str() ); + xtl::format( desc, "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); } else { - xtl::format( title, "%s's", plNetClientMgr::GetInstance()->GetPlayerName() ); - xtl::format( desc, "%s's %s", plNetClientMgr::GetInstance()->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName() ); + xtl::format( title, "%s's", plNetClientMgr::GetInstance()->GetPlayerName().c_str() ); + xtl::format( desc, "%s's %s", plNetClientMgr::GetInstance()->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() ); } - + info.SetAgeUserDefinedName( title.c_str() ); info.SetAgeDescription( desc.c_str() ); diff --git a/Sources/Plasma/PubUtilLib/plMath/plRandom.h b/Sources/Plasma/PubUtilLib/plMath/plRandom.h index 5e51c839..177ce4c5 100644 --- a/Sources/Plasma/PubUtilLib/plMath/plRandom.h +++ b/Sources/Plasma/PubUtilLib/plMath/plRandom.h @@ -103,7 +103,7 @@ inline float plRandom::RandZeroToOne() const return Rand() * RandNorm(); #else // FAST_Q const uint32_t kOneExp = 0x3f800000; - register uint32_t temp = kOneExp | (uint32_t(Rand()) >> 9); + uint32_t temp = kOneExp | (uint32_t(Rand()) >> 9); return (*(float*)&temp) - 1.f; #endif // FAST_Q } @@ -117,7 +117,7 @@ inline float plRandom::RandMinusOneToOne() const return RandZeroToOne() * 2.f - 1.f; #else // FAST_Q const uint32_t kTwoExp = 0x40000000; - register uint32_t temp = kTwoExp | (uint32_t(Rand()) >> 9); + uint32_t temp = kTwoExp | (uint32_t(Rand()) >> 9); return (*(float*)&temp) - 3.f; #endif // FAST_Q } diff --git a/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp b/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp index 09842c4e..97dd29dd 100644 --- a/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp +++ b/Sources/Plasma/PubUtilLib/plMessage/plLoadCloneMsg.cpp @@ -89,7 +89,7 @@ plLoadCloneMsg::plLoadCloneMsg(const plUoid &uoidToClone, const plKey &requestor this->AddReceiver(plNetApp::GetInstance()->GetKey()); } else { char buffer[128]; - sprintf(buffer, "Can't find key named %s", uoidToClone.GetObjectName()); + sprintf(buffer, "Can't find key named %s", uoidToClone.GetObjectName().c_str()); hsAssert(0, buffer); } } else { diff --git a/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp index 6c24e203..4fdf5c16 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plLogicModifier.cpp @@ -171,7 +171,7 @@ hsBool plLogicModifier::MsgReceive(plMessage* msg) { if ( Disabled() ) { - DetectorLogRed("%s: LogicMod is disabled", GetKeyName()); + DetectorLogRed("%s: LogicMod is disabled", GetKeyName().c_str()); } else { @@ -180,11 +180,11 @@ hsBool plLogicModifier::MsgReceive(plMessage* msg) if (!fConditionList[i]->Verify(msg)) { if ( plObjectInBoxConditionalObject::ConvertNoRef(fConditionList[i]) ) - DetectorLogRed("%s: LogicMod InRegion conditional not met", fConditionList[i]->GetKeyName()); + DetectorLogRed("%s: LogicMod InRegion conditional not met", fConditionList[i]->GetKeyName().c_str()); else if ( plFacingConditionalObject::ConvertNoRef(fConditionList[i]) ) - DetectorLogRed("%s: LogicMod Facing conditional not met", fConditionList[i]->GetKeyName()); + DetectorLogRed("%s: LogicMod Facing conditional not met", fConditionList[i]->GetKeyName().c_str()); else - DetectorLogRed("%s: LogicMod conditional not met", fConditionList[i]->GetKeyName()); + DetectorLogRed("%s: LogicMod conditional not met", fConditionList[i]->GetKeyName().c_str()); } } } diff --git a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h index 5d0b57dd..9f0300bf 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.h @@ -142,8 +142,8 @@ public: // Restore callback state after load void Restore(); - - const int8_t GetState() const { return fCurState; } + + int8_t GetState() const { return fCurState; } // // Export time only // diff --git a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp index e1477e31..389a3334 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plSDLModifier.cpp @@ -178,14 +178,14 @@ void plSDLModifier::SendState(uint32_t sendFlags) { gMooseDump=true; plNetObjectDebugger::GetInstance()->SetDebugging(true); - curState->DumpToObjectDebugger(xtl::format("Object %s SENDS SDL state", - GetStateOwnerKey()->GetName(), dirtyOnly).c_str()); + curState->DumpToObjectDebugger(plString::Format("Object %s SENDS SDL state", + GetStateOwnerKey()->GetName().c_str(), dirtyOnly).c_str()); gMooseDump=false; } // cache current state, send notifications if necessary fStateCache->UpdateFrom(*curState, dirtyOnly); // update local copy of state - + ISentState(curState); } delete curState; @@ -197,14 +197,14 @@ void plSDLModifier::SendState(uint32_t sendFlags) void plSDLModifier::ReceiveState(const plStateDataRecord* srcState) { hsAssert(fStateCache, "nil stateCache"); - - if (plNetObjectDebugger::GetInstance() && + + if (plNetObjectDebugger::GetInstance() && plNetObjectDebugger::GetInstance()->IsDebugObject(GetStateOwnerKey()->ObjectIsLoaded())) { gMooseDump=true; plNetObjectDebugger::GetInstance()->SetDebugging(true); - srcState->DumpToObjectDebugger(xtl::format("Object %s RECVS SDL state", - GetStateOwnerKey()->GetName()).c_str()); + srcState->DumpToObjectDebugger(plString::Format("Object %s RECVS SDL state", + GetStateOwnerKey()->GetName().c_str()).c_str()); gMooseDump=false; } @@ -214,17 +214,17 @@ void plSDLModifier::ReceiveState(const plStateDataRecord* srcState) // apply incoming state ISetCurrentStateFrom(srcState); // apply incoming state to sceneObj - + // cache state, send notifications if necessary fStateCache->UpdateFrom(*srcState, false); // update local copy of state fSentOrRecvdState = true; } else { - plNetClientApp::GetInstance()->DebugMsg("\tReceiving and ignoring unused SDL state msg: type %s, object %s", - GetSDLName(), GetStateOwnerKey()->GetName()); + plNetClientApp::GetInstance()->DebugMsg("\tReceiving and ignoring unused SDL state msg: type %s, object %s", + GetSDLName(), GetStateOwnerKey()->GetName().c_str()); } - + if (plNetObjectDebugger::GetInstance()) plNetObjectDebugger::GetInstance()->SetDebugging(false); } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp index 843a1fe1..73d8be8f 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plLinkEffectsMgr.cpp @@ -324,11 +324,11 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) return true; } } - + plSceneObject *avatar = plSceneObject::ConvertNoRef(linkKey->ObjectIsLoaded()); if (avatar == nil) { - plNetApp::GetInstance()->DebugMsg("Can't find avatar, mod=%s\n", linkKey->GetName()); + plNetApp::GetInstance()->DebugMsg("Can't find avatar, mod=%s\n", linkKey->GetName().c_str()); return true; } @@ -338,7 +338,7 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) // hsAssert(false, "Trying to link an Avatar already in the process of linking."); // return true; // } - + if (pTriggerMsg->GetInvisLevel() && linkKey != nc->GetLocalPlayerKey()) { #ifdef PLASMA_EXTERNAL_RELEASE @@ -470,12 +470,12 @@ hsBool plLinkEffectsMgr::MsgReceive(plMessage *msg) else if (pTriggerMsg->fEffects < 0 ) { plNetApp::GetInstance()->DebugMsg("Too many link callbacks received for avatar %s. Ignoring extras.\n", - pTriggerMsg->GetLinkKey()->GetName()); + pTriggerMsg->GetLinkKey()->GetName().c_str()); } else { plNetApp::GetInstance()->DebugMsg("%d link callbacks left until avatar %s links...\n", - pTriggerMsg->fEffects, pTriggerMsg->GetLinkKey()->GetName()); + pTriggerMsg->fEffects, pTriggerMsg->GetLinkKey()->GetName().c_str()); } return true; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index b9dd262c..b3a9c693 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -1333,8 +1333,8 @@ bool plNetClientMgr::IHandlePlayerPageMsg(plPlayerPageMsg *playerMsg) if (GetLocalPlayerKey() == playerKey) { fLocalPlayerKey = nil; - DebugMsg("Net: Unloading local player %s", playerKey->GetName()); - + DebugMsg("Net: Unloading local player %s", playerKey->GetName().c_str()); + // notify server - NOTE: he might not still be around to get this... plNetMsgPlayerPage npp (playerKey->GetUoid(), playerMsg->fUnload); npp.SetNetProtocol(kNetProtocolCli2Game); @@ -1343,7 +1343,7 @@ bool plNetClientMgr::IHandlePlayerPageMsg(plPlayerPageMsg *playerMsg) else if (IsRemotePlayerKey(playerKey, &idx)) { fRemotePlayerKeys.erase(fRemotePlayerKeys.begin()+idx); // remove key from list - DebugMsg("Net: Unloading remote player %s", playerKey->GetName()); + DebugMsg("Net: Unloading remote player %s", playerKey->GetName().c_str()); } } else @@ -1362,9 +1362,9 @@ bool plNetClientMgr::IHandlePlayerPageMsg(plPlayerPageMsg *playerMsg) GetLocalPlayerKey() == playerKey, "Different local player already loaded"); - hsLogEntry(DebugMsg("Adding LOCAL player %s\n", playerKey->GetName())); + hsLogEntry(DebugMsg("Adding LOCAL player %s\n", playerKey->GetName().c_str())); playerSO->SetNetGroupConstant(plNetGroup::kNetGroupLocalPlayer); - + // don't save avatar state permanently on server playerSO->SetSynchFlagsBit(plSynchedObject::kAllStateIsVolatile); const plCoordinateInterface* co = playerSO->GetCoordinateInterface(); @@ -1385,7 +1385,7 @@ bool plNetClientMgr::IHandlePlayerPageMsg(plPlayerPageMsg *playerMsg) } else { - hsLogEntry(DebugMsg("Adding REMOTE player %s\n", playerKey->GetName())); + hsLogEntry(DebugMsg("Adding REMOTE player %s\n", playerKey->GetName().c_str())); playerSO->SetNetGroupConstant(plNetGroup::kNetGroupRemotePlayer); idx=fTransport.FindMember(playerMsg->fClientID); if( idx != -1 ) @@ -1396,7 +1396,7 @@ bool plNetClientMgr::IHandlePlayerPageMsg(plPlayerPageMsg *playerMsg) } else { - hsLogEntry(DebugMsg("Ignoring player page msg (player not found in member list) : %s\n", playerKey->GetName())); + hsLogEntry(DebugMsg("Ignoring player page msg (player not found in member list) : %s\n", playerKey->GetName().c_str())); } } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp index a27fa4e6..80fb9738 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp @@ -135,7 +135,7 @@ plKey plNetClientMgr::ILoadClone(plLoadCloneMsg *pCloneMsg) { if (!cloneKey->ObjectIsLoaded()) { - DebugMsg("ILoadClone: object %s is already unloaded, ignoring", cloneKey->GetName()); + DebugMsg("ILoadClone: object %s is already unloaded, ignoring", cloneKey->GetName().c_str()); return cloneKey; } @@ -185,7 +185,7 @@ void plNetClientMgr::IPlayerChangeAge(hsBool exitAge, int32_t spawnPt) } else if (fLocalPlayerKey) { - ErrorMsg("Can't find avatarMod %s", fLocalPlayerKey->GetName()); + ErrorMsg("Can't find avatarMod %s", fLocalPlayerKey->GetName().c_str()); } } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp index dd8b66fb..ab0904b1 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp @@ -120,7 +120,7 @@ int plNetClientMgr::ISendDirtyState(double secs) if (localOwned==plSynchedObject::kNo) { DebugMsg("Late rejection of queued SDL state, obj %s, sdl %s", - state->fObjKey->GetName(), state->fSDLName.c_str()); + state->fObjKey->GetName().c_str(), state->fSDLName.c_str()); continue; } } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp index fd3f4897..98da3ac4 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp @@ -74,7 +74,7 @@ void plNetClientMgr::IShowLists() sprintf(str, "%s%s PlyrName=%s PlyrID=%d AcctID=%d P2P=%d Join#=%d Peers=%d %.1f,%.1f,%.1f", GetFlagsBit(kSendingVoice) ? "V" : " ", GetFlagsBit(kSendingActions) ? "A" : " ", - GetPlayerName(), GetPlayerID(), 0, + GetPlayerName().c_str(), GetPlayerID(), 0, IsPeerToPeer(), GetJoinOrder(), 0, pos.fX, pos.fY, pos.fZ); txt.DrawString(x,y,str,255,255,255,255); @@ -316,9 +316,9 @@ void plNetClientMgr::IShowAvatars() hsPoint3 pos = (player ? player->GetLocalToWorld() * hsPoint3(0, 0, 0) : hsPoint3(0, 0, 0)); hsVector3 ori = (player ? player->GetLocalToWorld() * hsVector3(0, -1, 0) : hsVector3(0, 0, 0)); sprintf(str, "%s: pos(%.2f, %.2f, %.2f) ori(%.2f, %.2f, %.2f)", - GetPlayerName(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); + GetPlayerName().c_str(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); txt.DrawString(x,y,str,255,255,255,255); - + if (player) { @@ -334,7 +334,7 @@ void plNetClientMgr::IShowAvatars() hsPoint3 pos = (pObj ? pObj->GetLocalToWorld() * hsPoint3(0, 0, 0) : hsPoint3(0, 0, 0)); hsVector3 ori = (pObj ? pObj->GetLocalToWorld() * hsVector3(0, -1, 0) : hsVector3(0, 0, 0)); sprintf(str, "%s: pos(%.2f, %.2f, %.2f) ori(%.2f, %.2f, %.2f)", - pObj->GetKeyName(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); + pObj->GetKeyName().c_str(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); txt.DrawString(x,y,str,255,255,255,255); } } @@ -344,7 +344,7 @@ void plNetClientMgr::IShowAvatars() // Others y=startY; x=startX; - + plNetTransportMember** members=nil; fTransport.GetMemberListDistSorted(members); for(i=0;iAsString().c_str(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); txt.DrawString(x,y,str); y+=yOff; - + if (player) { const plArmatureMod *avMod = plArmatureMod::ConvertNoRef(player->GetModifierByType(plArmatureMod::Index())); @@ -372,13 +372,13 @@ void plNetClientMgr::IShowAvatars() plSceneObject* pObj = pNonConstArm->GetFollowerParticleSystemSO(); if (pObj) { - y+=yOff; - y+=yOff; - hsPoint3 pos = (pObj ? pObj->GetLocalToWorld() * hsPoint3(0, 0, 0) : hsPoint3(0, 0, 0)); - hsVector3 ori = (pObj ? pObj->GetLocalToWorld() * hsVector3(0, -1, 0) : hsVector3(0, 0, 0)); - sprintf(str, "%s: pos(%.2f, %.2f, %.2f) ori(%.2f, %.2f, %.2f)", - pObj->GetKeyName(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); - txt.DrawString(x,y,str,255,255,255,255); + y+=yOff; + y+=yOff; + hsPoint3 pos = (pObj ? pObj->GetLocalToWorld() * hsPoint3(0, 0, 0) : hsPoint3(0, 0, 0)); + hsVector3 ori = (pObj ? pObj->GetLocalToWorld() * hsVector3(0, -1, 0) : hsVector3(0, 0, 0)); + sprintf(str, "%s: pos(%.2f, %.2f, %.2f) ori(%.2f, %.2f, %.2f)", + pObj->GetKeyName().c_str(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); + txt.DrawString(x,y,str,255,255,255,255); } } } @@ -386,6 +386,6 @@ void plNetClientMgr::IShowAvatars() } delete [] members; - + txt.SetFont( "Courier New", 8 ); } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp index 558554d4..830611df 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp @@ -283,16 +283,17 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgSDLState) if (m->GetHasPlayerID()) pl->fPlayerID = m->GetPlayerID(); // copy originating playerID if we have it pl->fUoid = m->ObjectInfo()->GetUoid(); - + // queue up state nc->fPendingLoads.push_back(pl); - hsLogEntry( nc->DebugMsg( "Added pending SDL delivery for %s:%s", m->ObjectInfo()->GetObjectName(), des->GetName() ) ); + hsLogEntry( nc->DebugMsg( "Added pending SDL delivery for %s:%s", + m->ObjectInfo()->GetObjectName().c_str(), des->GetName() ) ); } else delete sdRec; delete [] descName; // We've only used descName for a lookup (via SDR, and some error strings. Must delete now. - + return hsOK; } diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp index 50a080a5..03112b49 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp @@ -951,9 +951,9 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) plString title; unsigned nameLen = nc->GetPlayerName().GetSize(); if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S') - title = plString::Format("%s'", nc->GetPlayerName()); + title = plString::Format("%s'", nc->GetPlayerName().c_str()); else - title = plString::Format("%s's", nc->GetPlayerName()); + title = plString::Format("%s's", nc->GetPlayerName().c_str()); info->SetAgeUserDefinedName(_TEMP_CONVERT_TO_CONST_CHAR(title)); } if (!info->HasAgeDescription()) @@ -1087,7 +1087,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) wchar_t parentAgeName[MAX_PATH]; if (link->HasParentAgeFilename()) StrToUnicode(parentAgeName, link->GetParentAgeFilename(), arrsize(parentAgeName)); - + switch(VaultAgeFindOrCreateChildAgeLink( (link->HasParentAgeFilename() ? parentAgeName : nil), info, @@ -1102,7 +1102,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void) case true: success = kLinkImmediately; } - + if (success == kLinkImmediately) info->CopyFrom(childLink.GetAgeInfo()); } diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp index 1684c5d0..99788d16 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp @@ -875,7 +875,7 @@ static void FileSrvIpAddressCallback ( ***/ //============================================================================ -const NetCommPlayer * const NetCommGetPlayer () { +const NetCommPlayer * NetCommGetPlayer () { static NetCommPlayer s_nilPlayer; return s_player ? s_player : &s_nilPlayer; } @@ -891,7 +891,7 @@ unsigned NetCommGetPlayerCount () { } //============================================================================ -const NetCommAccount * const NetCommGetAccount () { +const NetCommAccount * NetCommGetAccount () { return &s_account; } @@ -901,12 +901,12 @@ bool NetCommIsLoginComplete() { } //============================================================================ -const NetCommAge * const NetCommGetAge () { +const NetCommAge * NetCommGetAge () { return &s_age; } //============================================================================ -const NetCommAge * const NetCommGetStartupAge () { +const NetCommAge * NetCommGetStartupAge () { return &s_startupAge; } diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h index 0ffdf54f..d22e422f 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h @@ -94,10 +94,10 @@ struct NetCommAge { char spawnPtName[64]; }; -const NetCommAge * const NetCommGetAge (); -const NetCommAge * const NetCommGetStartupAge (); -const NetCommAccount * const NetCommGetAccount (); -const NetCommPlayer * const NetCommGetPlayer (); +const NetCommAge * NetCommGetAge (); +const NetCommAge * NetCommGetStartupAge (); +const NetCommAccount * NetCommGetAccount (); +const NetCommPlayer * NetCommGetPlayer (); const ARRAY(NetCommPlayer) & NetCommGetPlayerList (); unsigned NetCommGetPlayerCount (); bool NetCommIsLoginComplete (); diff --git a/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommon.h b/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommon.h index 456f0889..b32ac2f1 100644 --- a/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommon.h +++ b/Sources/Plasma/PubUtilLib/plNetCommon/plNetCommon.h @@ -199,7 +199,7 @@ namespace plNetCommon kChildAgeBook, }; - static const char * LinkingRuleStr( int rule ) + inline const char * LinkingRuleStr( int rule ) { switch ( rule ) { @@ -227,7 +227,7 @@ namespace plNetCommon kTechnical }; } - + namespace BuildType { enum Types @@ -238,7 +238,7 @@ namespace plNetCommon kExternalRelease }; - static const char * BuildTypeStr( int rule ) + inline const char * BuildTypeStr( int rule ) { switch ( rule ) { diff --git a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp index 2bb231b4..94f16859 100644 --- a/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp +++ b/Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp @@ -705,7 +705,7 @@ plString plNetMsgSDLState::AsString() const ISetDescName(); // set desc name for debug if necessary return plString::Format("object:%s, initial:%d, %s", - ObjectInfo()->GetObjectName(), fIsInitialState, plNetMsgStreamedObject::AsString().c_str() ); + ObjectInfo()->GetObjectName().c_str(), fIsInitialState, plNetMsgStreamedObject::AsString().c_str() ); } // diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp index 501d30a3..40b6a271 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.cpp @@ -58,7 +58,7 @@ static const float DEFAULT_INVERSE_MASS = 1.f; static plRandom sRandom; -const void plParticleGenerator::ComputeDirection(float pitch, float yaw, hsVector3 &direction) +void plParticleGenerator::ComputeDirection(float pitch, float yaw, hsVector3 &direction) { float cosPitch, sinPitch; float cosYaw, sinYaw; @@ -70,7 +70,7 @@ const void plParticleGenerator::ComputeDirection(float pitch, float yaw, hsVecto // Inverse function of ComputeDirection. Give it a normalized vector, and it will tell you a // pitch and yaw (angles for the unit Z vector) to get there. -const void plParticleGenerator::ComputePitchYaw(float &pitch, float &yaw, const hsVector3 &dir) +void plParticleGenerator::ComputePitchYaw(float &pitch, float &yaw, const hsVector3 &dir) { const float PI = 3.14159f; pitch = asin(dir.fY); diff --git a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h index dd8109ee..666f3e2c 100644 --- a/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h +++ b/Sources/Plasma/PubUtilLib/plParticleSystem/plParticleGenerator.h @@ -63,8 +63,8 @@ public: CLASSNAME_REGISTER( plParticleGenerator ); GETINTERFACE_ANY( plParticleGenerator, plCreatable ); - static const void ComputeDirection(float pitch, float yaw, hsVector3 &direction); - static const void ComputePitchYaw(float &pitch, float &yaw, const hsVector3 &dir); + static void ComputeDirection(float pitch, float yaw, hsVector3 &direction); + static void ComputePitchYaw(float &pitch, float &yaw, const hsVector3 &dir); static inline float GetRandomVar() { return 2.0f * (float)hsRand() / RAND_MAX - 1; } // returns a num between +/- 1.0 }; diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp index b0891d65..42cf7ed5 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plCollisionDetector.cpp @@ -252,22 +252,22 @@ void plCameraRegionDetector::ITrigger(plKey hitter, bool entering, bool immediat // PHYSX_FIXME hack for PhysX turd that sends bunches of enter/exits over one frame if (entering && fNumEvals - fLastExitEval <= 1 && fSavingSendMsg) { - DetectorLog("%s: Skipping Camera Entering volume", GetKeyName()); + DetectorLog("%s: Skipping Camera Entering volume", GetKeyName().c_str()); fLastEnterEval = fNumEvals; if (fSavingSendMsg) { - DetectorLog("%s: Dumping saved Camera Exiting volume", GetKeyName()); + DetectorLog("%s: Dumping saved Camera Exiting volume", GetKeyName().c_str()); } fSavingSendMsg = false; return; } if (!entering && fNumEvals - fLastEnterEval <= 1 && fSavingSendMsg) { - DetectorLog("%s: Skipping Exiting volume", GetKeyName()); + DetectorLog("%s: Skipping Exiting volume", GetKeyName().c_str()); fLastExitEval = fNumEvals; if (fSavingSendMsg) { - DetectorLog("%s: Dumping saved Camera Entering volume", GetKeyName()); + DetectorLog("%s: Dumping saved Camera Entering volume", GetKeyName().c_str()); } fSavingSendMsg = false; return; @@ -276,7 +276,7 @@ void plCameraRegionDetector::ITrigger(plKey hitter, bool entering, bool immediat // get rid of any saved messages... this should happen though if (fSavingSendMsg) { - DetectorLog("%s: Killing saved camera message... shouldn't happen", GetKeyName()); + DetectorLog("%s: Killing saved camera message... shouldn't happen", GetKeyName().c_str()); } // end PHYSX_FIXME hack for PhysX turd that sends bunches of enter/exits over one frame #endif // USE_PHYSX_COLLISION_FLUTTER_WORKAROUND @@ -285,12 +285,12 @@ void plCameraRegionDetector::ITrigger(plKey hitter, bool entering, bool immediat fSavedMsgEnterFlag = entering; if (entering) { - //DetectorLog("%s: Saving camera Entering volume - Evals=%d", GetKeyName(),fNumEvals); + //DetectorLog("%s: Saving camera Entering volume - Evals=%d", GetKeyName().c_str(),fNumEvals); fLastEnterEval = fNumEvals; } else { - //DetectorLog("%s: Saving camera Exiting volume - Evals=%d", GetKeyName(),fNumEvals); + //DetectorLog("%s: Saving camera Exiting volume - Evals=%d", GetKeyName().c_str(),fNumEvals); fLastExitEval = fNumEvals; } @@ -322,13 +322,13 @@ void plCameraRegionDetector::ISendSavedTriggerMsgs() if (fSavedMsgEnterFlag) { fMessages[i]->SetCmd(plCameraMsg::kEntering); - sprintf(str, "Entering cameraRegion: %s - Evals=%d -msg %d of %d\n", GetKeyName(),fNumEvals,i+1,fMessages.Count()); + sprintf(str, "Entering cameraRegion: %s - Evals=%d -msg %d of %d\n", GetKeyName().c_str(),fNumEvals,i+1,fMessages.Count()); fIsInside = true; } else { fMessages[i]->ClearCmd(plCameraMsg::kEntering); - sprintf(str, "Exiting cameraRegion: %s - Evals=%d -msg %d of %d\n", GetKeyName(),fNumEvals,i+1,fMessages.Count()); + sprintf(str, "Exiting cameraRegion: %s - Evals=%d -msg %d of %d\n", GetKeyName().c_str(),fNumEvals,i+1,fMessages.Count()); fIsInside = false; } plgDispatch::MsgSend(fMessages[i]); @@ -401,8 +401,8 @@ void plCameraRegionDetector::IHandleEval(plEvalMsg *pEval) { if(fSavedActivatorMsg) DetectorLog("%s didn't send its message. fNumEvals=%d fLastEnterEval=%d, fLastExit=%d", - GetKeyName(),fNumEvals, fLastEnterEval, fLastExitEval); - + GetKeyName().c_str(),fNumEvals, fLastEnterEval, fLastExitEval); + } } @@ -663,11 +663,11 @@ void plObjectInVolumeDetector::IHandleEval(plEvalMsg* pEval) fCurrentResidents.insert((*it)->hitter); actout->AddReceivers(fReceivers); actout->Send(); - DetectorLog("%s sent an Enter ActivatorMsg. To: %s", GetKeyName(), GetTarget()->GetKeyName() ); + DetectorLog("%s sent an Enter ActivatorMsg. To: %s", GetKeyName().c_str(), GetTarget()->GetKeyName().c_str() ); } else { - DetectorLog("%s squelched an Enter ActivatorMsg.", GetKeyName()); + DetectorLog("%s squelched an Enter ActivatorMsg.", GetKeyName().c_str()); delete actout; } } @@ -680,11 +680,11 @@ void plObjectInVolumeDetector::IHandleEval(plEvalMsg* pEval) fCurrentResidents.erase((*it)->hitter); actout->AddReceivers(fReceivers); actout->Send(); - DetectorLog("%s sent an Exit ActivatorMsg. To: %s", GetKeyName(), GetTarget()->GetKeyName()); + DetectorLog("%s sent an Exit ActivatorMsg. To: %s", GetKeyName().c_str(), GetTarget()->GetKeyName().c_str()); } else { - DetectorLog("%s squelched an Exit ActivatorMsg.", GetKeyName()); + DetectorLog("%s squelched an Exit ActivatorMsg.", GetKeyName().c_str()); delete actout; } } @@ -697,12 +697,12 @@ void plObjectInVolumeDetector::IHandleEval(plEvalMsg* pEval) DetectorLog("This is the regions inhabitants after the op"); for(ResidentSet::iterator it = fCurrentResidents.begin(); it!= fCurrentResidents.end(); it++) { - DetectorLog("%s", (*it)->GetName()); + DetectorLog("%s", (*it)->GetName().c_str()); } DetectorLog("*********"); fCollisionList.clear(); - + } void plObjectInVolumeDetector::SetTarget(plSceneObject* so) @@ -778,13 +778,13 @@ void plObjectInVolumeAndFacingDetector::ICheckForTrigger() if (facing && movingForward && !fTriggered) { - DetectorLog("%s: Trigger InVolume&Facing", GetKeyName()); + DetectorLog("%s: Trigger InVolume&Facing", GetKeyName().c_str()); fTriggered = true; ITrigger(avatar->GetKey(), true, true); } else if (!facing && fTriggered) { - DetectorLog("%s: Untrigger InVolume&Facing", GetKeyName()); + DetectorLog("%s: Untrigger InVolume&Facing", GetKeyName().c_str()); fTriggered = false; ITrigger(avatar->GetKey(), false, true); } @@ -877,7 +877,7 @@ hsBool plSubworldRegionDetector::MsgReceive(plMessage* msg) plArmatureMod* avMod = IGetAvatarModifier(pCollMsg->fOtherKey); if (avMod) { - DetectorLog("%s subworld detector %s", pCollMsg->fEntering ? "Entering" : "Exiting", GetKeyName()); + DetectorLog("%s subworld detector %s", pCollMsg->fEntering ? "Entering" : "Exiting", GetKeyName().c_str()); if ((pCollMsg->fEntering && !fOnExit) || (!pCollMsg->fEntering && fOnExit)) @@ -887,7 +887,7 @@ hsBool plSubworldRegionDetector::MsgReceive(plMessage* msg) plSceneObject* SO = plSceneObject::ConvertNoRef(fSub->ObjectIsLoaded()); if (SO) { - DetectorLogSpecial("Switching to subworld %s", fSub->GetName()); + DetectorLogSpecial("Switching to subworld %s", fSub->GetName().c_str()); plKey nilKey; plSubWorldMsg* msg = new plSubWorldMsg(GetKey(), avMod->GetKey(), fSub); diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp index 65988b56..f388555c 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp @@ -215,27 +215,27 @@ void plPhysicalSDLModifier::ILogState(const plStateDataRecord* state, bool useDi plPhysical* phys = IGetPhysical(); - std::string log = xtl::format("%s: %s", phys->GetKeyName(), prefix); + plString log = plString::Format("%s: %s", phys->GetKeyName().c_str(), prefix); if (isPosSet) - log += xtl::format(" Pos=%.1f %.1f %.1f", pos.fX, pos.fY, pos.fZ); + log += plString::Format(" Pos=%.1f %.1f %.1f", pos.fX, pos.fY, pos.fZ); else - log += " Pos=None"; + log += _TEMP_CONVERT_FROM_LITERAL(" Pos=None"); if (isLinVSet) - log += xtl::format(" LinV=%.1f %.1f %.1f", linV.fX, linV.fY, linV.fZ); + log += plString::Format(" LinV=%.1f %.1f %.1f", linV.fX, linV.fY, linV.fZ); else - log += " LinV=None"; + log += _TEMP_CONVERT_FROM_LITERAL(" LinV=None"); if (isAngVSet) - log += xtl::format(" AngV=%.1f %.1f %.1f", angV.fX, angV.fY, angV.fZ); + log += plString::Format(" AngV=%.1f %.1f %.1f", angV.fX, angV.fY, angV.fZ); else - log += " AngV=None"; + log += _TEMP_CONVERT_FROM_LITERAL(" AngV=None"); if (isRotSet) - log += xtl::format(" Rot=%.1f %.1f %.1f %.1f", rot.fX, rot.fY, rot.fZ, rot.fW); + log += plString::Format(" Rot=%.1f %.1f %.1f %.1f", rot.fX, rot.fY, rot.fZ, rot.fW); else - log += " Rot=None"; + log += _TEMP_CONVERT_FROM_LITERAL(" Rot=None"); IGetLog()->AddLine(log.c_str(), color); } diff --git a/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp b/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp index 471cbee0..145f68b3 100644 --- a/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysical/plPickingDetector.cpp @@ -91,7 +91,7 @@ hsBool plPickingDetector::MsgReceive(plMessage* msg) pMsg->fPickedObj = fProxyKey; else pMsg->fPickedObj = GetTarget()->GetKey(); - + // assume that since this is something that was PICKED that it was done by the local player. plKey locPlayerKey = plNetClientApp::GetInstance()->GetLocalPlayerKey(); if (locPlayerKey) @@ -99,10 +99,10 @@ hsBool plPickingDetector::MsgReceive(plMessage* msg) pMsg->SetSender(GetKey()); plgDispatch::MsgSend( pMsg ); - hsStatusMessageF("%s sending activate message to %s\n",GetKey()->GetName(), fReceivers[i]->GetName()); + hsStatusMessageF("%s sending activate message to %s\n",GetKey()->GetName().c_str(), fReceivers[i]->GetName().c_str()); } } - + if (RemoteMod() && RemoteMod()->MsgReceive(msg)) return true; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h index ad3fc42b..c6b5c162 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plCullTree.h @@ -209,7 +209,7 @@ public: void SetPlane(const hsVector3& n, float d) { fNorm = n; fDist = d; } const hsVector3& GetNormal() const { return fNorm; } - const float GetDist() const { return fDist; } + float GetDist() const { return fDist; } plCullStatus TestBounds(const hsBounds3Ext& bnd) const; plCullStatus TestSphere(const hsPoint3& center, float rad) const; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h index 282496d0..e8f8cc35 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDebugText.h @@ -94,7 +94,7 @@ class plDebugText }; ~plDebugText() { ; } - + static plDebugText &Instance( void ) { return fInstance; } uint32_t CalcStringWidth( const char *string ); @@ -139,12 +139,12 @@ class plDebugText void SetFont(const char *face, uint16_t size ) { hsStrncpy( fFontFace, face, sizeof( fFontFace ) ); fFontSize = size; } const char *GetFontFace( void ) { return fFontFace; } - const uint16_t GetFontSize( void ) { return fFontSize; } - uint16_t GetFontHeight(); - + uint16_t GetFontSize( void ) { return fFontSize; } + uint16_t GetFontHeight(); + void SetEnable( hsBool on ) { fEnabled = on; } void DisablePermanently( void ) { fEnabled = false; fLockEnable = true; } - const hsBool IsEnabled( void ) { return fEnabled; } + hsBool IsEnabled( void ) { return fEnabled; } void GetScreenSize( uint32_t *width, uint32_t *height ); }; diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp index 09e5d710..1f91302c 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plDynamicEnvMap.cpp @@ -573,7 +573,10 @@ void plDynamicCamMap::ISetupRenderRequest(plPipeline *pipe) hsMatrix44 w2c, c2w; if (fCamera) { - w2c.MakeCamera(&fCamera->GetTargetPos(), &fCamera->GetTargetPOA(), &hsVector3(0.f, 0.f, 1.f)); + hsPoint3 pos = fCamera->GetTargetPos(); + hsPoint3 poa = fCamera->GetTargetPOA(); + hsVector3 vec(0.f, 0.f, 1.f); + w2c.MakeCamera(&pos, &poa, &vec); w2c.GetInverse(&c2w); } else @@ -584,7 +587,8 @@ void plDynamicCamMap::ISetupRenderRequest(plPipeline *pipe) // Could be optimized, but the matrix construction work here seems cheap relative to the cost // of rerendering all this stuff to a separate target, so I doubt we'd notice. hsMatrix44 invert; - invert.MakeScaleMat(&(hsVector3(1.f, 1.f, -1.f))); + hsVector3 vec(1.f, 1.f, -1.f); + invert.MakeScaleMat(&vec); w2c = pipe->GetWorldToCamera(); c2w = pipe->GetCameraToWorld(); diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h index ad3780b5..8a16da21 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h @@ -182,9 +182,9 @@ class plGraphPlate : public plPlate void SetDataColors( const std::vector & hexColors ); const char *GetLabelText( int i ) { return fLabelText[ i ].c_str(); } - const uint32_t GetDataColor( int i ) { return fDataHexColors[ i ]; } - const uint32_t GetNumLabels() { return fLabelText.size(); } - const uint32_t GetNumColors() { return fDataHexColors.size(); } + uint32_t GetDataColor( int i ) { return fDataHexColors[ i ]; } + uint32_t GetNumLabels() { return fLabelText.size(); } + uint32_t GetNumColors() { return fDataHexColors.size(); } }; //// plPlateManager Class Definition ///////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index f2be393e..9be4fc05 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -612,7 +612,7 @@ const plLocation& plResManager::FindLocation(const char* age, const char* page) return invalidLoc; } -const void plResManager::GetLocationStrings(const plLocation& loc, char* ageBuffer, char* pageBuffer) const +void plResManager::GetLocationStrings(const plLocation& loc, char* ageBuffer, char* pageBuffer) const { plRegistryPageNode* page = FindPage(loc); const plPageInfo& info = page->GetPageInfo(); diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h index bb0d17ad..e8cf0cf3 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.h @@ -88,7 +88,7 @@ public: virtual plKey FindKey(const plUoid&); // Same as above, but will check the uoid for clones const plLocation& FindLocation(const char* age, const char* page) const; // Use nil for any strings you don't need - const void GetLocationStrings(const plLocation& loc, char* ageBuffer, char* pageBuffer) const; + void GetLocationStrings(const plLocation& loc, char* ageBuffer, char* pageBuffer) const; //--------------------------- // Establish reference linkage diff --git a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp index 4b08f612..899bf977 100644 --- a/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp +++ b/Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp @@ -2068,11 +2068,11 @@ bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, uint32_t re uint32_t cnt; s->ReadLE(&cnt); // have to read as long since we don't know how big the list is - if (cnt>=0 && cnt ut) return true; - + if ( (saveFlags & plSDL::kHasTimeStamp) || (readOptions & plSDL::kTimeStampOnRead) ) TimeStamp(ut); - + // read list if (!(saveFlags & plSDL::kSameAsDefault)) { diff --git a/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp b/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp index aef15e17..59785445 100644 --- a/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp +++ b/Sources/Plasma/PubUtilLib/plStatGather/plAutoProfile.cpp @@ -224,13 +224,12 @@ void plAutoProfileImp::INextProfile() plMipmap mipmap; if (plClient::GetInstance()->GetPipeline()->CaptureScreen(&mipmap)) { - char fileName[256]; - sprintf(fileName, "%s%s_%s.jpg", + plString fileName = plString::Format("%S%s_%s.jpg", plProfileManagerFull::Instance().GetProfilePath(), - ageName, fLastSpawnPointName); + ageName, fLastSpawnPointName.c_str()); plJPEG::Instance().SetWriteQuality(100); - plJPEG::Instance().WriteToFile(fileName, &mipmap); + plJPEG::Instance().WriteToFile(fileName.c_str(), &mipmap); } fLastSpawnPointName = plString::Null; diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp index a7793425..26e4bc94 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plShader.cpp @@ -276,7 +276,7 @@ float plShader::GetFloat(int i, int chan) const return fConsts[i].fArray[chan]; } -const float* const plShader::GetFloat4(int i) const +const float* plShader::GetFloat4(int i) const { return fConsts[i].fArray; } diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShader.h b/Sources/Plasma/PubUtilLib/plSurface/plShader.h index 9aa68578..75bc1288 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShader.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plShader.h @@ -226,8 +226,8 @@ public: hsPoint3 GetPosition(int i) const; hsVector3 GetVector(int i) const; void GetVector(int i, float& x, float& y, float& z, float& w) const; - float GetFloat(int i, int chan) const; - const float* const GetFloat4(int i) const; + float GetFloat(int i, int chan) const; + const float* GetFloat4(int i) const; void SetMatrix(int i, const plFloat44& xfm); // Will transpose void SetMatrix3(int i, const plFloat44& xfm); // Will transpose diff --git a/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h b/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h index 9d611758..bb0879a7 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plShaderTable.h @@ -113,7 +113,7 @@ public: plShaderID::ID GetID() const { return fID; } uint32_t GetByteLen() const { return fbyteLen; } const uint8_t* GetCodes() const { return fCodes; } - const char* const GetFileName() const { return fFileName; } + const char* GetFileName() const { return fFileName; } }; class plShaderTableInst