From 71c9771cfbb8b38f275e881ab25b4689be4c950a Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Thu, 9 Jan 2014 23:10:57 -0800 Subject: [PATCH] plOneShotMod => plString --- .../PubUtilLib/plAvatar/plOneShotMod.cpp | 22 +++++-------------- .../Plasma/PubUtilLib/plAvatar/plOneShotMod.h | 11 +++++----- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp index 0dbadf3b..b06c2071 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp @@ -61,37 +61,36 @@ plOneShotMod::plOneShotMod() fReversable(false), fSeekDuration(1.0f), fSmartSeek(false), - fAnimName(nil), fNoSeek(false) { // this constructor is called from the loader. } // CTOR(char *) -plOneShotMod::plOneShotMod(const char *animName, +plOneShotMod::plOneShotMod(const plString &animName, bool drivable, bool reversable, float seekDuration, bool smartSeek, bool noSeek) -: fDrivable(drivable), +: fAnimName(animName), + fDrivable(drivable), fReversable(reversable), fSeekDuration(seekDuration), fSmartSeek((float)smartSeek), fNoSeek(noSeek) { - fAnimName = hsStrcpy(animName); } // INIT -void plOneShotMod::Init(const char *animName, +void plOneShotMod::Init(const plString &animName, bool drivable, bool reversable, float seekDuration, bool smartSeek, bool noSeek) { - fAnimName = hsStrcpy(animName); + fAnimName = animName; fDrivable = drivable; fReversable = reversable; fSeekDuration = seekDuration; @@ -99,15 +98,6 @@ void plOneShotMod::Init(const char *animName, fNoSeek = noSeek; } -// DTOR() -plOneShotMod::~plOneShotMod() -{ - if(fAnimName) { - delete[] fAnimName; - fAnimName = nil; - } -} - // MSGRECEIVE bool plOneShotMod::MsgReceive(plMessage* msg) @@ -164,7 +154,7 @@ void plOneShotMod::Read(hsStream *stream, hsResMgr *mgr) plMultiModifier::Read(stream, mgr); // read in the name of the animation itself - fAnimName = stream->ReadSafeString(); + fAnimName = stream->ReadSafeString_TEMP(); fSeekDuration = stream->ReadLEScalar(); fDrivable = stream->ReadBool(); fReversable = stream->ReadBool(); diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h index f5e5aaae..15c1baf5 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h +++ b/Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.h @@ -56,7 +56,7 @@ class plOneShotMod : public plMultiModifier { protected: virtual bool IEval(double secs, float del, uint32_t dirty) {return true;} - char * fAnimName; // the name of the animation associated with this one-shot + plString fAnimName; // the name of the animation associated with this one-shot bool fDrivable; // whether the user can control the position of the animation bool fReversable; // whether the user can back up the animation (fDrivable must be true as well) float fSeekDuration; // how long to take to get to the seek point (??? should this be speed instead?) @@ -64,10 +64,11 @@ protected: bool fNoSeek; public: plOneShotMod(); - plOneShotMod(const char *animName, bool drivable, bool reversable, float seekDuration, bool smartSeek,bool noSeek = false); - virtual ~plOneShotMod(); - - void Init(const char *animName, bool drivable, bool reversable, float seekDuration, bool smartSeek, bool noSeek = false); + plOneShotMod(const plString &animName, bool drivable, bool reversable, + float seekDuration, bool smartSeek, bool noSeek = false); + + void Init(const plString &animName, bool drivable, bool reversable, + float seekDuration, bool smartSeek, bool noSeek = false); CLASSNAME_REGISTER( plOneShotMod ); GETINTERFACE_ANY( plOneShotMod, plMultiModifier );