Browse Source

plNPCSpawnMod => plString

Michael Hansen 11 years ago
parent
commit
b16274a8cc
  1. 26
      Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp
  2. 6
      Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h

26
Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.cpp

@ -59,34 +59,22 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// plNPCSpawnMod ctor
plNPCSpawnMod::plNPCSpawnMod()
: fModelName(nil),
fAccountName(nil),
fAutoSpawn(false),
: fAutoSpawn(false),
fNotify(nil)
{
}
// plNPCSpawnMod ctor modelName accountName
plNPCSpawnMod::plNPCSpawnMod(const char * modelName, const char * accountName, bool autoSpawn)
plNPCSpawnMod::plNPCSpawnMod(const plString &modelName, const plString &accountName, bool autoSpawn)
: fAutoSpawn(autoSpawn), fNotify(nil)
{
fModelName = hsStrcpy(modelName);
fAccountName = hsStrcpy(accountName);
fModelName = modelName;
fAccountName = accountName;
}
// plNPCSpawnMod dtor
plNPCSpawnMod::~plNPCSpawnMod()
{
if(fModelName)
{
delete[] fModelName;
fModelName = nil;
}
if(fAccountName)
{
delete[] fAccountName;
fAccountName = nil;
}
if (fNotify)
fNotify->UnRef();
}
@ -108,7 +96,7 @@ bool plNPCSpawnMod::Trigger()
// will netpropagate
if(this->IsLocallyOwned())
{
if(fModelName)
if (!fModelName.IsEmpty())
{
// spawn the NPC
plKey spawnPoint = GetTarget(0)->GetKey();
@ -140,8 +128,8 @@ void plNPCSpawnMod::Read(hsStream *stream, hsResMgr *mgr)
{
plSingleModifier::Read(stream, mgr);
fModelName = stream->ReadSafeString();
fAccountName = stream->ReadSafeString();
fModelName = stream->ReadSafeString_TEMP();
fAccountName = stream->ReadSafeString_TEMP();
fAutoSpawn = stream->ReadBool();
if(stream->ReadBool())
fNotify = plNotifyMsg::ConvertNoRef(mgr->ReadCreatable(stream));

6
Sources/Plasma/PubUtilLib/plAvatar/plNPCSpawnMod.h

@ -47,7 +47,7 @@ class plNPCSpawnMod : public plSingleModifier
{
public:
plNPCSpawnMod();
plNPCSpawnMod(const char * modelName, const char *accountName, bool autoSpawn);
plNPCSpawnMod(const plString &modelName, const plString &accountName, bool autoSpawn);
~plNPCSpawnMod();
bool Trigger();
@ -68,8 +68,8 @@ protected:
void ISendNotify(plKey &avatarKey); // send our notification message
private:
char *fModelName;
char *fAccountName;
plString fModelName;
plString fAccountName;
bool fAutoSpawn; // spawn immediately on loading
plKey fSpawnedKey; // if we want to be able to spawn many things, we should make this a vector
plNotifyMsg *fNotify; // notify message that we send when we spawn.

Loading…
Cancel
Save