diff --git a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp index 3a30452e..7872f684 100644 --- a/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp @@ -1383,7 +1383,7 @@ bool plPythonFileMod::MsgReceive(plMessage* msg) // create event list PyObject* event = PyList_New(4); PyList_SetItem(event, 0, PyLong_FromLong((long)proEventData::kVariable)); - PyList_SetItem(event, 1, PyString_FromString(eventData->fName)); + PyList_SetItem(event, 1, PyString_FromPlString(eventData->fName)); PyList_SetItem(event, 2, PyLong_FromLong(eventData->fDataType)); // depending on the data type create the data diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp index 9c829a7d..c3ea0f4a 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.cpp @@ -589,11 +589,11 @@ void plNotifyMsg::AddControlKeyEvent( int32_t key, bool down ) // // PURPOSE : Add a variable event record to this notify message // -void plNotifyMsg::AddVariableEvent( const char* name, float number ) +void plNotifyMsg::AddVariableEvent(const plString& name, float number) { // create the control key event record proVariableEventData* pED = new proVariableEventData; - pED->fName = hsStrcpy(nil,name); + pED->fName = name; pED->fDataType = proEventData::kFloat; pED->fNumber.f = number; fEvents.Append(pED); // then add it to the list of event records @@ -607,11 +607,11 @@ void plNotifyMsg::AddVariableEvent( const char* name, float number ) // // PURPOSE : Add a variable event record to this notify message // -void plNotifyMsg::AddVariableEvent( const char* name, int32_t number ) +void plNotifyMsg::AddVariableEvent(const plString& name, int32_t number) { // create the control key event record proVariableEventData* pED = new proVariableEventData; - pED->fName = hsStrcpy(nil,name); + pED->fName = name; pED->fDataType = proEventData::kInt; pED->fNumber.i = number; fEvents.Append(pED); // then add it to the list of event records @@ -624,11 +624,11 @@ void plNotifyMsg::AddVariableEvent( const char* name, int32_t number ) // // PURPOSE : Add a variable event record to this notify message // -void plNotifyMsg::AddVariableEvent( const char* name) +void plNotifyMsg::AddVariableEvent(const plString& name) { // create the control key event record proVariableEventData* pED = new proVariableEventData; - pED->fName = hsStrcpy(nil,name); + pED->fName = name; pED->fDataType = proEventData::kNull; fEvents.Append(pED); // then add it to the list of event records } @@ -641,12 +641,11 @@ void plNotifyMsg::AddVariableEvent( const char* name) // // PURPOSE : Add a variable event record to this notify message // -void plNotifyMsg::AddVariableEvent( const char* name, const plKey &key ) +void plNotifyMsg::AddVariableEvent(const plString& name, const plKey &key) { // create the control key event record proVariableEventData* pED = new proVariableEventData; - pED->fName = hsStrcpy(nil,name); -// pED->fName = (char*)name; + pED->fName = name; pED->fDataType = proEventData::kKey; pED->fKey = key; fEvents.Append(pED); // then add it to the list of event records @@ -1312,13 +1311,12 @@ void proControlKeyEventData::IWriteVersion(hsStream* s, hsResMgr* mgr) void proVariableEventData::IInit() { - fName = nil; + fName = plString::Null; } + void proVariableEventData::IDestruct() { - if ( fName != nil ) - delete [] fName; - fName = nil; + fName = plString::Null; } void proVariableEventData::IReadNumber(hsStream * stream) { @@ -1353,7 +1351,7 @@ void proVariableEventData::IWriteNumber(hsStream * stream) { void proVariableEventData::IRead(hsStream* stream, hsResMgr* mgr) { - fName = stream->ReadSafeString(); + fName = stream->ReadSafeString_TEMP(); fDataType = stream->ReadLE32(); IReadNumber(stream); fKey = mgr->ReadKey(stream); @@ -1381,7 +1379,7 @@ void proVariableEventData::IReadVersion(hsStream* s, hsResMgr* mgr) contentFlags.Read(s); if (contentFlags.IsBitSet(kProVariableName)) - fName = s->ReadSafeString(); + fName = s->ReadSafeString_TEMP(); if (contentFlags.IsBitSet(kProVariableDataType)) fDataType = s->ReadLE32(); if (contentFlags.IsBitSet(kProVariableNumber)) diff --git a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h index 114d3f76..bf9b3512 100644 --- a/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h +++ b/Sources/Plasma/NucleusLib/pnMessage/plNotifyMsg.h @@ -179,7 +179,7 @@ protected: }; proEventType(Variable) - char* fName; // name of variable + plString fName; // name of variable int32_t fDataType; // type of data // Can't be a union, sadly, but it isn't that much of a waste of space... @@ -375,10 +375,10 @@ public: void AddCollisionEvent( bool enter, const plKey &other, const plKey &self, bool onlyOneCollision=true ); void AddPickEvent( const plKey &other, const plKey& self, bool enabled, hsPoint3 hitPoint ); void AddControlKeyEvent( int32_t key, bool down ); - void AddVariableEvent( const char* name, float number ); - void AddVariableEvent( const char* name, int32_t number ); - void AddVariableEvent( const char* name ); - void AddVariableEvent( const char *name, const plKey &key ); + void AddVariableEvent( const plString& name, float number ); + void AddVariableEvent( const plString& name, int32_t number ); + void AddVariableEvent( const plString& name ); + void AddVariableEvent( const plString& name, const plKey &key ); void AddFacingEvent( const plKey &other, const plKey &self, float dot, bool enabled); void AddContainerEvent( const plKey &container, const plKey &contained, bool entering); void AddActivateEvent( bool activate );