Skip to content

Commit

Permalink
Remove unused callbacks from PtCreatePublicAge/PtRemovePublicAge
Browse files Browse the repository at this point in the history
These callback parameters were ignored and no Python code defined a
publicAgeCreated or publicAgeRemoved method. The public/private change
notification is actually delivered as a plVaultNotifyMsg with type
kPublicAgeCreated or kPublicAgeRemoved sent by VaultSetAgePublic.
  • Loading branch information
dgelessus committed Sep 16, 2023
1 parent a6fa60e commit 9b8523c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Scripts/Python/nxusBookMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,14 @@ def IMakeHoodPublic(self):
hoodInfo = self.IGetHoodInfoNode()
if hoodInfo is not None:
infoStruct = hoodInfo.asAgeInfoStruct()
PtCreatePublicAge(infoStruct, self)
PtCreatePublicAge(infoStruct)


def IMakeHoodPrivate(self):
hoodInfo = self.IGetHoodInfoNode()
if hoodInfo is not None:
guid = hoodInfo.getAgeInstanceGuid()
PtRemovePublicAge(guid, self)
PtRemovePublicAge(guid)

def IPublicAgeCreated(self, ageName):
PtDebugPrint("IPublicAgeCreated: " + ageName)
Expand Down
10 changes: 4 additions & 6 deletions Scripts/Python/plasma/Plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,8 @@ def PtCreatePlayer(playerName, avatarShape, invitation):
"""Creates a new player"""
pass

def PtCreatePublicAge(ageInfo, cbObject=None):
"""Create a public instance of the given age.
cbObject, if supplied should have a member called publicAgeCreated(self,ageInfo)"""
def PtCreatePublicAge(ageInfo):
"""Create a public instance of the given age."""
pass

def PtDebugAssert(cond, msg):
Expand Down Expand Up @@ -686,9 +685,8 @@ def PtRecenterCamera():
"""re-centers the camera"""
pass

def PtRemovePublicAge(ageInstanceGuid, cbObject=None):
"""Remove a public instance of the given age.
cbObject, if supplied should have a member called publicAgeRemoved(self,ageInstanceGuid)"""
def PtRemovePublicAge(ageInstanceGuid):
"""Remove a public instance of the given age."""
pass

def PtRequestLOSScreen(selfKey,ID,xPos,yPos,distance,what,reportType):
Expand Down
10 changes: 4 additions & 6 deletions Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2189,30 +2189,28 @@ void cyMisc::GetPublicAgeList(const ST::string& ageName, PyObject * cbObject)
//////////////////////////////////////////////////////////////////////////////
//
// Function : CreatePublicAge
// PARAMETERS : ageInfo, callback object
// PARAMETERS : ageInfo
//
// PURPOSE : Add a public age to the list of available ones.
//
void cyMisc::CreatePublicAge( pyAgeInfoStruct * ageInfo, PyObject * cbObject )
void cyMisc::CreatePublicAge(pyAgeInfoStruct* ageInfo)
{
VaultSetOwnedAgePublic(ageInfo->GetAgeInfo(), true);
// TODO: make the callback here
}

//////////////////////////////////////////////////////////////////////////////
//
// Function : RemovePublicAge
// PARAMETERS : ageInstanceGuid, callback object
// PARAMETERS : ageInstanceGuid
//
// PURPOSE : Remove a public age from the list of available ones.
//
void cyMisc::RemovePublicAge(const ST::string& ageInstanceGuid, PyObject * cbObject/*=nullptr */)
void cyMisc::RemovePublicAge(const ST::string& ageInstanceGuid)
{
plAgeInfoStruct info;
plUUID uuid(ageInstanceGuid);
info.SetAgeInstanceGuid(&uuid);
VaultSetOwnedAgePublic(&info, false);
// TODO: make the callback here
}

int cyMisc::GetKILevel()
Expand Down
8 changes: 4 additions & 4 deletions Sources/Plasma/FeatureLib/pfPython/cyMisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,20 +753,20 @@ class cyMisc
//////////////////////////////////////////////////////////////////////////////
//
// Function : CreatePublicAge
// PARAMETERS : ageInfo, callback object
// PARAMETERS : ageInfo
//
// PURPOSE : Add a public age to the list of available ones.
//
static void CreatePublicAge(pyAgeInfoStruct * ageInfo, PyObject * cbObject = nullptr);
static void CreatePublicAge(pyAgeInfoStruct* ageInfo);

//////////////////////////////////////////////////////////////////////////////
//
// Function : RemovePublicAge
// PARAMETERS : ageInstanceGuid, callback object
// PARAMETERS : ageInstanceGuid
//
// PURPOSE : Remove a public age from the list of available ones.
//
static void RemovePublicAge(const ST::string& ageInstanceGuid, PyObject * cbObject = nullptr);
static void RemovePublicAge(const ST::string& ageInstanceGuid);

//////////////////////////////////////////////////////////////////////////////
//
Expand Down
22 changes: 9 additions & 13 deletions Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,37 +243,33 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetPublicAgeList, args, "Params: ageName, cbOb
PYTHON_RETURN_NONE;
}

PYTHON_GLOBAL_METHOD_DEFINITION(PtCreatePublicAge, args, "Params: ageInfo, cbObject=None\nCreate a public instance of the given age.\n"
"cbObject, if supplied should have a member called publicAgeCreated(self,ageInfo)")
PYTHON_GLOBAL_METHOD_DEFINITION(PtCreatePublicAge, args, "Params: ageInfo\nCreate a public instance of the given age.")
{
PyObject* ageInfoObj = nullptr;
PyObject* cbObject = nullptr;
if (!PyArg_ParseTuple(args, "O|O", &ageInfoObj, &cbObject))
if (!PyArg_ParseTuple(args, "O", &ageInfoObj))
{
PyErr_SetString(PyExc_TypeError, "PtCreatePublicAge expects a ptAgeInfoStruct object and an optional object with a publicAgeCreated() method");
PyErr_SetString(PyExc_TypeError, "PtCreatePublicAge expects a ptAgeInfoStruct object");
PYTHON_RETURN_ERROR;
}
if (!pyAgeInfoStruct::Check(ageInfoObj))
{
PyErr_SetString(PyExc_TypeError, "PtCreatePublicAge expects a ptAgeInfoStruct object and an optional object with a publicAgeCreated() method");
PyErr_SetString(PyExc_TypeError, "PtCreatePublicAge expects a ptAgeInfoStruct object");
PYTHON_RETURN_ERROR;
}
pyAgeInfoStruct* ageInfo = pyAgeInfoStruct::ConvertFrom(ageInfoObj);
cyMisc::CreatePublicAge(ageInfo, cbObject);
cyMisc::CreatePublicAge(ageInfo);
PYTHON_RETURN_NONE;
}

PYTHON_GLOBAL_METHOD_DEFINITION(PtRemovePublicAge, args, "Params: ageInstanceGuid, cbObject=None\nRemove a public instance of the given age.\n"
"cbObject, if supplied should have a member called publicAgeRemoved(self,ageInstanceGuid)")
PYTHON_GLOBAL_METHOD_DEFINITION(PtRemovePublicAge, args, "Params: ageInstanceGuid\nRemove a public instance of the given age.")
{
ST::string ageInstanceGUID;
PyObject* cbObject = nullptr;
if (!PyArg_ParseTuple(args, "O&|O", PyUnicode_STStringConverter, &ageInstanceGUID, &cbObject))
if (!PyArg_ParseTuple(args, "O&", PyUnicode_STStringConverter, &ageInstanceGUID))
{
PyErr_SetString(PyExc_TypeError, "PtRemovePublicAge expects a string and an optional object with a publicAgeRemoved() method");
PyErr_SetString(PyExc_TypeError, "PtRemovePublicAge expects a string");
PYTHON_RETURN_ERROR;
}
cyMisc::RemovePublicAge(ageInstanceGUID, cbObject);
cyMisc::RemovePublicAge(ageInstanceGUID);
PYTHON_RETURN_NONE;
}

Expand Down

0 comments on commit 9b8523c

Please sign in to comment.