diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp index 63f0009c..83fae06d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp @@ -238,9 +238,9 @@ plMipmap *plPlate::CreateMaterial( uint32_t width, uint32_t height, bool with //// CreateFromResource ////////////////////////////////////////////////////// // Creates a plate's material from a resource of the given name. -void plPlate::CreateFromResource(const char *resName) +void plPlate::CreateFromResource(const plString& resName) { - if (resName) + if (!resName.IsEmpty()) { plMipmap* resTexture = new plMipmap; resTexture->CopyFrom(plClientResMgr::Instance().getResource(resName)); @@ -256,9 +256,9 @@ void plPlate::CreateFromResource(const char *resName) } } -void plPlate::ReloadFromResource(const char *resName) +void plPlate::ReloadFromResource(const plString& resName) { - if (resName) + if (!resName.IsEmpty()) { fMipmap->CopyFrom(plClientResMgr::Instance().getResource(resName)); } diff --git a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h index 8513f0e7..dc993a4d 100644 --- a/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h +++ b/Sources/Plasma/PubUtilLib/plPipeline/plPlates.h @@ -144,8 +144,8 @@ class plPlate void SetSize( float width, float height, bool adjustByAspectRatio = false ); plMipmap *CreateMaterial( uint32_t width, uint32_t height, bool withAlpha, plMipmap* texture = NULL ); - void CreateFromResource( const char *resName ); - void ReloadFromResource( const char *resName ); + void CreateFromResource(const plString& resName); + void ReloadFromResource(const plString& resName); }; //// plGraphPlate Class Definition /////////////////////////////////////////// diff --git a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp index a0af9574..beea394d 100644 --- a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.cpp @@ -60,14 +60,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //// plProgressMgr Functions ///////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -plProgressMgr *plProgressMgr::fManager = nil; +plProgressMgr* plProgressMgr::fManager = nullptr; #define LOADING_RES "xLoading_Linking.%02d.png" #define LOADING_RES_COUNT 18 -char* plProgressMgr::fImageRotation[LOADING_RES_COUNT]; +plString plProgressMgr::fImageRotation[LOADING_RES_COUNT]; -const char* plProgressMgr::fStaticTextIDs[] = { +const plString plProgressMgr::fStaticTextIDs[] = { "xLoading_Linking_Text.png", "xLoading_Updating_Text.png" }; @@ -76,30 +76,21 @@ const char* plProgressMgr::fStaticTextIDs[] = { plProgressMgr::plProgressMgr() { - fOperations = nil; + fOperations = nullptr; fManager = this; - fCallbackProc = nil; + fCallbackProc = nullptr; fCurrentStaticText = kNone; // Fill array with pre-computed loading frame IDs for (int i=0; i < LOADING_RES_COUNT; i++) - { - char* frameID = new char[128]; - sprintf(frameID, LOADING_RES, i); - fImageRotation[i] = frameID; - } + fImageRotation[i] = plString::Format(LOADING_RES, i); } plProgressMgr::~plProgressMgr() { - for (int i=0; i < LOADING_RES_COUNT; i++) - { - delete[] fImageRotation[i]; - } - - while( fOperations != nil ) + while (fOperations) delete fOperations; - fManager = nil; + fManager = nullptr; } //// RegisterOperation /////////////////////////////////////////////////////// @@ -238,7 +229,7 @@ void plProgressMgr::CancelAllOps( void ) fCurrentStaticText = kNone; } -char* plProgressMgr::GetLoadingFrameID(int index) +const plString plProgressMgr::GetLoadingFrameID(int index) { if (index < LOADING_RES_COUNT) return fImageRotation[index]; @@ -251,7 +242,7 @@ uint32_t plProgressMgr::NumLoadingFrames() const return LOADING_RES_COUNT; } -const char* plProgressMgr::GetStaticTextID(StaticText staticTextType) +const plString plProgressMgr::GetStaticTextID(StaticText staticTextType) { return fStaticTextIDs[staticTextType]; } diff --git a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h index 7e3cfeac..903d07fb 100644 --- a/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h +++ b/Sources/Plasma/PubUtilLib/plProgressMgr/plProgressMgr.h @@ -201,9 +201,9 @@ class plProgressMgr private: - static plProgressMgr *fManager; - static char* fImageRotation[]; - static const char* fStaticTextIDs[]; + static plProgressMgr* fManager; + static plString fImageRotation[]; + static const plString fStaticTextIDs[]; protected: @@ -235,9 +235,9 @@ class plProgressMgr virtual ~plProgressMgr(); static plProgressMgr* GetInstance() { return fManager; } - static char* GetLoadingFrameID(int index); + static const plString GetLoadingFrameID(int index); uint32_t plProgressMgr::NumLoadingFrames() const; - static const char* GetStaticTextID(StaticText staticTextType); + static const plString GetStaticTextID(StaticText staticTextType); virtual void Draw( plPipeline *p ) { }