From ae1bbdc1d609aaa996ab467474983d7fa5ca0406 Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sun, 12 Jan 2014 17:45:53 -0800 Subject: [PATCH] Animation SDL variable names => plString --- .../Plasma/PubUtilLib/plAvatar/plAGAnim.cpp | 19 ++----------------- Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h | 10 ++++------ .../PubUtilLib/plSurface/plLayerAnimation.cpp | 17 +++-------------- .../PubUtilLib/plSurface/plLayerAnimation.h | 7 +++---- 4 files changed, 12 insertions(+), 41 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp index ba1987a6..2182347d 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp @@ -665,30 +665,15 @@ float plEmoteAnim::GetFadeOut() const plAgeGlobalAnim::plAgeGlobalAnim() : plAGAnim() { - fGlobalVarName = nil; } // ctor -------------------------------------------------------------------- // ----- plAgeGlobalAnim::plAgeGlobalAnim(const plString &name, double start, double end) -: plAGAnim(name, start, end), - fGlobalVarName(nil) +: plAGAnim(name, start, end) { } -// dtor --------------------------- -// ----- -plAgeGlobalAnim::~plAgeGlobalAnim() -{ - delete [] fGlobalVarName; -} - -void plAgeGlobalAnim::SetGlobalVarName(char *name) -{ - delete [] fGlobalVarName; - fGlobalVarName = hsStrcpy(name); -} - // Read --------------------------------------------------- // ----- @@ -696,7 +681,7 @@ void plAgeGlobalAnim::Read(hsStream *stream, hsResMgr *mgr) { plAGAnim::Read(stream, mgr); - fGlobalVarName = stream->ReadSafeString(); + fGlobalVarName = stream->ReadSafeString_TEMP(); } // Write --------------------------------------------------- diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h index 70e9b172..2e22e1cb 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h @@ -417,11 +417,9 @@ public: /** Construct with name, start time, and end time (within the max note track) */ plAgeGlobalAnim(const plString &name, double begin, double end); - /** Destruct, freeing the underlying animation data. */ - virtual ~plAgeGlobalAnim(); - - const char * GetGlobalVarName() const { return fGlobalVarName; } - void SetGlobalVarName(char *name); + + plString GetGlobalVarName() const { return fGlobalVarName; } + void SetGlobalVarName(const plString &name) { fGlobalVarName = name; } // PLASMA PROTOCOL // rtti @@ -433,7 +431,7 @@ public: virtual void Write(hsStream* stream, hsResMgr* mgr); protected: - char *fGlobalVarName; // Name of the SDL variable we animate on. + plString fGlobalVarName; // Name of the SDL variable we animate on. }; // USEFUL HELPER FUNCTIONS diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp index dff15914..64222131 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp @@ -674,12 +674,7 @@ bool plLayerLinkAnimation::MsgReceive( plMessage* pMsg ) /////////////////////////////////////////////////////////////////////////////////////////////// -plLayerSDLAnimation::plLayerSDLAnimation() : plLayerAnimationBase(), fVar(nil), fVarName(nil) {} - -plLayerSDLAnimation::~plLayerSDLAnimation() -{ - delete [] fVarName; -} +plLayerSDLAnimation::plLayerSDLAnimation() : plLayerAnimationBase(), fVar(nil) {} uint32_t plLayerSDLAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore) { @@ -691,7 +686,7 @@ uint32_t plLayerSDLAnimation::Eval(double wSecs, uint32_t frame, uint32_t ignore if (fEvalTime < 0) { - if (fVarName != nil) + if (!fVarName.IsEmpty()) { extern const plSDLModifier *ExternFindAgeSDL(); const plSDLModifier *sdlMod = ExternFindAgeSDL(); @@ -741,7 +736,7 @@ void plLayerSDLAnimation::Read(hsStream* s, hsResMgr* mgr) { plLayerAnimationBase::Read(s, mgr); - fVarName = s->ReadSafeString(); + fVarName = s->ReadSafeString_TEMP(); } void plLayerSDLAnimation::Write(hsStream* s, hsResMgr* mgr) @@ -750,9 +745,3 @@ void plLayerSDLAnimation::Write(hsStream* s, hsResMgr* mgr) s->WriteSafeString(fVarName); } - -void plLayerSDLAnimation::SetVarName(char *name) -{ - delete [] fVarName; - fVarName = hsStrcpy(name); -} diff --git a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h index 55172273..28a0371a 100644 --- a/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h +++ b/Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h @@ -189,11 +189,10 @@ class plLayerSDLAnimation : public plLayerAnimationBase { protected: plSimpleStateVariable *fVar; - char *fVarName; + plString fVarName; public: plLayerSDLAnimation(); - virtual ~plLayerSDLAnimation(); CLASSNAME_REGISTER( plLayerSDLAnimation ); GETINTERFACE_ANY( plLayerSDLAnimation, plLayerAnimationBase ); @@ -205,8 +204,8 @@ public: virtual void Read(hsStream* s, hsResMgr* mgr); virtual void Write(hsStream* s, hsResMgr* mgr); - char *GetVarName() { return fVarName; } - void SetVarName(char *name); + plString GetVarName() const { return fVarName; } + void SetVarName(const plString &name) { fVarName = name; } }; #endif // plLayerAnimation_inc