[General] Rename all instances of refNumIndex into refNum

This creates symmetry with mpNum and should cause less confusion in the future.
fix/skillcap
David Cernat 7 years ago
parent 20296859ee
commit 09da24f1ea

@ -84,9 +84,9 @@ void Cell::readActorList(unsigned char packetID, const mwmp::BaseActorList *newA
mwmp::BaseActor newActor = newActorList->baseActors.at(i); mwmp::BaseActor newActor = newActorList->baseActors.at(i);
mwmp::BaseActor *cellActor; mwmp::BaseActor *cellActor;
if (containsActor(newActor.refNumIndex, newActor.mpNum)) if (containsActor(newActor.refNum, newActor.mpNum))
{ {
cellActor = getActor(newActor.refNumIndex, newActor.mpNum); cellActor = getActor(newActor.refNum, newActor.mpNum);
switch (packetID) switch (packetID)
{ {
@ -112,25 +112,25 @@ void Cell::readActorList(unsigned char packetID, const mwmp::BaseActorList *newA
cellActorList.count = cellActorList.baseActors.size(); cellActorList.count = cellActorList.baseActors.size();
} }
bool Cell::containsActor(int refNumIndex, int mpNum) bool Cell::containsActor(int refNum, int mpNum)
{ {
for (unsigned int i = 0; i < cellActorList.baseActors.size(); i++) for (unsigned int i = 0; i < cellActorList.baseActors.size(); i++)
{ {
mwmp::BaseActor actor = cellActorList.baseActors.at(i); mwmp::BaseActor actor = cellActorList.baseActors.at(i);
if (actor.refNumIndex == refNumIndex && actor.mpNum == mpNum) if (actor.refNum == refNum && actor.mpNum == mpNum)
return true; return true;
} }
return false; return false;
} }
mwmp::BaseActor *Cell::getActor(int refNumIndex, int mpNum) mwmp::BaseActor *Cell::getActor(int refNum, int mpNum)
{ {
for (unsigned int i = 0; i < cellActorList.baseActors.size(); i++) for (unsigned int i = 0; i < cellActorList.baseActors.size(); i++)
{ {
mwmp::BaseActor *actor = &cellActorList.baseActors.at(i); mwmp::BaseActor *actor = &cellActorList.baseActors.at(i);
if (actor->refNumIndex == refNumIndex && actor->mpNum == mpNum) if (actor->refNum == refNum && actor->mpNum == mpNum)
return actor; return actor;
} }
return 0; return 0;
@ -140,7 +140,7 @@ void Cell::removeActors(const mwmp::BaseActorList *newActorList)
{ {
for (std::vector<mwmp::BaseActor>::iterator it = cellActorList.baseActors.begin(); it != cellActorList.baseActors.end();) for (std::vector<mwmp::BaseActor>::iterator it = cellActorList.baseActors.begin(); it != cellActorList.baseActors.end();)
{ {
int refNumIndex = (*it).refNumIndex; int refNum = (*it).refNum;
int mpNum = (*it).mpNum; int mpNum = (*it).mpNum;
bool foundActor = false; bool foundActor = false;
@ -149,7 +149,7 @@ void Cell::removeActors(const mwmp::BaseActorList *newActorList)
{ {
mwmp::BaseActor newActor = newActorList->baseActors.at(i); mwmp::BaseActor newActor = newActorList->baseActors.at(i);
if (newActor.refNumIndex == refNumIndex && newActor.mpNum == mpNum) if (newActor.refNum == refNum && newActor.mpNum == mpNum)
{ {
it = cellActorList.baseActors.erase(it); it = cellActorList.baseActors.erase(it);
foundActor = true; foundActor = true;

@ -31,8 +31,8 @@ public:
void removePlayer(Player *player); void removePlayer(Player *player);
void readActorList(unsigned char packetID, const mwmp::BaseActorList *newActorList); void readActorList(unsigned char packetID, const mwmp::BaseActorList *newActorList);
bool containsActor(int refNumIndex, int mpNum); bool containsActor(int refNum, int mpNum);
mwmp::BaseActor *getActor(int refNumIndex, int mpNum); mwmp::BaseActor *getActor(int refNum, int mpNum);
void removeActors(const mwmp::BaseActorList *newActorList); void removeActors(const mwmp::BaseActorList *newActorList);
RakNet::RakNetGUID *getAuthority(); RakNet::RakNetGUID *getAuthority();

@ -72,9 +72,9 @@ const char *ActorFunctions::GetActorRefId(unsigned int i) noexcept
return readActorList->baseActors.at(i).refId.c_str(); return readActorList->baseActors.at(i).refId.c_str();
} }
unsigned int ActorFunctions::GetActorRefNumIndex(unsigned int i) noexcept unsigned int ActorFunctions::GetActorRefNum(unsigned int i) noexcept
{ {
return readActorList->baseActors.at(i).refNumIndex; return readActorList->baseActors.at(i).refNum;
} }
unsigned int ActorFunctions::GetActorMpNum(unsigned int i) noexcept unsigned int ActorFunctions::GetActorMpNum(unsigned int i) noexcept
@ -197,9 +197,9 @@ const char *ActorFunctions::GetActorKillerRefId(unsigned int i) noexcept
return readActorList->baseActors.at(i).killer.refId.c_str(); return readActorList->baseActors.at(i).killer.refId.c_str();
} }
unsigned int ActorFunctions::GetActorKillerRefNumIndex(unsigned int i) noexcept unsigned int ActorFunctions::GetActorKillerRefNum(unsigned int i) noexcept
{ {
return readActorList->baseActors.at(i).killer.refNumIndex; return readActorList->baseActors.at(i).killer.refNum;
} }
unsigned int ActorFunctions::GetActorKillerMpNum(unsigned int i) noexcept unsigned int ActorFunctions::GetActorKillerMpNum(unsigned int i) noexcept
@ -242,9 +242,9 @@ void ActorFunctions::SetActorRefId(const char* refId) noexcept
tempActor.refId = refId; tempActor.refId = refId;
} }
void ActorFunctions::SetActorRefNumIndex(int refNumIndex) noexcept void ActorFunctions::SetActorRefNum(int refNum) noexcept
{ {
tempActor.refNumIndex = refNumIndex; tempActor.refNum = refNum;
} }
void ActorFunctions::SetActorMpNum(int mpNum) noexcept void ActorFunctions::SetActorMpNum(int mpNum) noexcept
@ -327,12 +327,12 @@ void ActorFunctions::SetActorAITargetToPlayer(unsigned short pid) noexcept
tempActor.aiTarget.guid = player->guid; tempActor.aiTarget.guid = player->guid;
} }
void ActorFunctions::SetActorAITargetToObject(int refNumIndex, int mpNum) noexcept void ActorFunctions::SetActorAITargetToObject(int refNum, int mpNum) noexcept
{ {
tempActor.hasAiTarget = true; tempActor.hasAiTarget = true;
tempActor.aiTarget.isPlayer = false; tempActor.aiTarget.isPlayer = false;
tempActor.aiTarget.refNumIndex = refNumIndex; tempActor.aiTarget.refNum = refNum;
tempActor.aiTarget.mpNum = mpNum; tempActor.aiTarget.mpNum = mpNum;
} }
@ -515,3 +515,18 @@ void ActorFunctions::CopyLastActorListToStore() noexcept
{ {
CopyLastActorListToStore(); CopyLastActorListToStore();
} }
unsigned int ActorFunctions::GetActorRefNumIndex(unsigned int i) noexcept
{
return GetActorRefNum(i);
}
unsigned int ActorFunctions::GetActorKillerRefNumIndex(unsigned int i) noexcept
{
return GetActorKillerRefNum(i);
}
void ActorFunctions::SetActorRefNumIndex(int refNum) noexcept
{
tempActor.refNum = refNum;
}

@ -15,7 +15,7 @@
\ \
{"GetActorCell", ActorFunctions::GetActorCell},\ {"GetActorCell", ActorFunctions::GetActorCell},\
{"GetActorRefId", ActorFunctions::GetActorRefId},\ {"GetActorRefId", ActorFunctions::GetActorRefId},\
{"GetActorRefNumIndex", ActorFunctions::GetActorRefNumIndex},\ {"GetActorRefNum", ActorFunctions::GetActorRefNum},\
{"GetActorMpNum", ActorFunctions::GetActorMpNum},\ {"GetActorMpNum", ActorFunctions::GetActorMpNum},\
\ \
{"GetActorPosX", ActorFunctions::GetActorPosX},\ {"GetActorPosX", ActorFunctions::GetActorPosX},\
@ -43,7 +43,7 @@
{"DoesActorHavePlayerKiller", ActorFunctions::DoesActorHavePlayerKiller},\ {"DoesActorHavePlayerKiller", ActorFunctions::DoesActorHavePlayerKiller},\
{"GetActorKillerPid", ActorFunctions::GetActorKillerPid},\ {"GetActorKillerPid", ActorFunctions::GetActorKillerPid},\
{"GetActorKillerRefId", ActorFunctions::GetActorKillerRefId},\ {"GetActorKillerRefId", ActorFunctions::GetActorKillerRefId},\
{"GetActorKillerRefNumIndex", ActorFunctions::GetActorKillerRefNumIndex},\ {"GetActorKillerRefNum", ActorFunctions::GetActorKillerRefNum},\
{"GetActorKillerMpNum", ActorFunctions::GetActorKillerMpNum},\ {"GetActorKillerMpNum", ActorFunctions::GetActorKillerMpNum},\
{"GetActorKillerName", ActorFunctions::GetActorKillerName},\ {"GetActorKillerName", ActorFunctions::GetActorKillerName},\
\ \
@ -55,7 +55,7 @@
\ \
{"SetActorCell", ActorFunctions::SetActorCell},\ {"SetActorCell", ActorFunctions::SetActorCell},\
{"SetActorRefId", ActorFunctions::SetActorRefId},\ {"SetActorRefId", ActorFunctions::SetActorRefId},\
{"SetActorRefNumIndex", ActorFunctions::SetActorRefNumIndex},\ {"SetActorRefNum", ActorFunctions::SetActorRefNum},\
{"SetActorMpNum", ActorFunctions::SetActorMpNum},\ {"SetActorMpNum", ActorFunctions::SetActorMpNum},\
\ \
{"SetActorPosition", ActorFunctions::SetActorPosition},\ {"SetActorPosition", ActorFunctions::SetActorPosition},\
@ -94,7 +94,10 @@
\ \
{"ReadLastActorList", ActorFunctions::ReadLastActorList},\ {"ReadLastActorList", ActorFunctions::ReadLastActorList},\
{"InitializeActorList", ActorFunctions::InitializeActorList},\ {"InitializeActorList", ActorFunctions::InitializeActorList},\
{"CopyLastActorListToStore", ActorFunctions::CopyLastActorListToStore} {"CopyLastActorListToStore", ActorFunctions::CopyLastActorListToStore},\
{"GetActorRefNumIndex", ActorFunctions::GetActorRefNumIndex},\
{"GetActorKillerRefNumIndex", ActorFunctions::GetActorKillerRefNumIndex},\
{"SetActorRefNumIndex", ActorFunctions::SetActorRefNumIndex}
class ActorFunctions class ActorFunctions
{ {
@ -173,12 +176,12 @@ public:
static const char *GetActorRefId(unsigned int i) noexcept; static const char *GetActorRefId(unsigned int i) noexcept;
/** /**
* \brief Get the refNumIndex of the actor at a certain index in the read actor list. * \brief Get the refNum of the actor at a certain index in the read actor list.
* *
* \param i The index of the actor. * \param i The index of the actor.
* \return The refNumIndex. * \return The refNum.
*/ */
static unsigned int GetActorRefNumIndex(unsigned int i) noexcept; static unsigned int GetActorRefNum(unsigned int i) noexcept;
/** /**
* \brief Get the mpNum of the actor at a certain index in the read actor list. * \brief Get the mpNum of the actor at a certain index in the read actor list.
@ -373,12 +376,12 @@ public:
static const char *GetActorKillerRefId(unsigned int i) noexcept; static const char *GetActorKillerRefId(unsigned int i) noexcept;
/** /**
* \brief Get the refNumIndex of the actor killer of the actor at a certain index in the read actor list. * \brief Get the refNum of the actor killer of the actor at a certain index in the read actor list.
* *
* \param i The index of the actor. * \param i The index of the actor.
* \return The refNumIndex of the killer. * \return The refNum of the killer.
*/ */
static unsigned int GetActorKillerRefNumIndex(unsigned int i) noexcept; static unsigned int GetActorKillerRefNum(unsigned int i) noexcept;
/** /**
* \brief Get the mpNum of the actor killer of the actor at a certain index in the read actor list. * \brief Get the mpNum of the actor killer of the actor at a certain index in the read actor list.
@ -460,12 +463,12 @@ public:
static void SetActorRefId(const char* refId) noexcept; static void SetActorRefId(const char* refId) noexcept;
/** /**
* \brief Set the refNumIndex of the temporary actor stored on the server. * \brief Set the refNum of the temporary actor stored on the server.
* *
* \param refNumIndex The refNumIndex. * \param refNum The refNum.
* \return void * \return void
*/ */
static void SetActorRefNumIndex(int refNumIndex) noexcept; static void SetActorRefNum(int refNum) noexcept;
/** /**
* \brief Set the mpNum of the temporary actor stored on the server. * \brief Set the mpNum of the temporary actor stored on the server.
@ -586,11 +589,11 @@ public:
/** /**
* \brief Set another object as the AI target of the temporary actor stored on the server. * \brief Set another object as the AI target of the temporary actor stored on the server.
* *
* \param refNumIndex The refNumIndex of the target object. * \param refNum The refNum of the target object.
* \param mpNum The mpNum of the target object. * \param mpNum The mpNum of the target object.
* \return void * \return void
*/ */
static void SetActorAITargetToObject(int refNumIndex, int mpNum) noexcept; static void SetActorAITargetToObject(int refNum, int mpNum) noexcept;
/** /**
* \brief Set the coordinates for the AI package associated with the current AI action. * \brief Set the coordinates for the AI package associated with the current AI action.
@ -746,6 +749,9 @@ public:
static void ReadLastActorList() noexcept; static void ReadLastActorList() noexcept;
static void InitializeActorList(unsigned short pid) noexcept; static void InitializeActorList(unsigned short pid) noexcept;
static void CopyLastActorListToStore() noexcept; static void CopyLastActorListToStore() noexcept;
static unsigned int GetActorRefNumIndex(unsigned int i) noexcept;
static unsigned int GetActorKillerRefNumIndex(unsigned int i) noexcept;
static void SetActorRefNumIndex(int refNum) noexcept;
}; };

@ -97,12 +97,12 @@ const char *MechanicsFunctions::GetPlayerKillerRefId(unsigned short pid) noexcep
return player->killer.refId.c_str(); return player->killer.refId.c_str();
} }
unsigned int MechanicsFunctions::GetPlayerKillerRefNumIndex(unsigned short pid) noexcept unsigned int MechanicsFunctions::GetPlayerKillerRefNum(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, 0); GET_PLAYER(pid, player, 0);
return player->killer.refNumIndex; return player->killer.refNum;
} }
unsigned int MechanicsFunctions::GetPlayerKillerMpNum(unsigned short pid) noexcept unsigned int MechanicsFunctions::GetPlayerKillerMpNum(unsigned short pid) noexcept
@ -241,3 +241,8 @@ const char *MechanicsFunctions::GetDeathReason(unsigned short pid) noexcept
return "suicide"; return "suicide";
} }
unsigned int MechanicsFunctions::GetPlayerKillerRefNumIndex(unsigned short pid) noexcept
{
return GetPlayerKillerRefNum(pid);
}

@ -17,7 +17,7 @@
{"DoesPlayerHavePlayerKiller", MechanicsFunctions::DoesPlayerHavePlayerKiller},\ {"DoesPlayerHavePlayerKiller", MechanicsFunctions::DoesPlayerHavePlayerKiller},\
{"GetPlayerKillerPid", MechanicsFunctions::GetPlayerKillerPid},\ {"GetPlayerKillerPid", MechanicsFunctions::GetPlayerKillerPid},\
{"GetPlayerKillerRefId", MechanicsFunctions::GetPlayerKillerRefId},\ {"GetPlayerKillerRefId", MechanicsFunctions::GetPlayerKillerRefId},\
{"GetPlayerKillerRefNumIndex", MechanicsFunctions::GetPlayerKillerRefNumIndex},\ {"GetPlayerKillerRefNum", MechanicsFunctions::GetPlayerKillerRefNum},\
{"GetPlayerKillerMpNum", MechanicsFunctions::GetPlayerKillerMpNum},\ {"GetPlayerKillerMpNum", MechanicsFunctions::GetPlayerKillerMpNum},\
{"GetPlayerKillerName", MechanicsFunctions::GetPlayerKillerName},\ {"GetPlayerKillerName", MechanicsFunctions::GetPlayerKillerName},\
\ \
@ -32,7 +32,8 @@
{"Jail", MechanicsFunctions::Jail},\ {"Jail", MechanicsFunctions::Jail},\
{"Resurrect", MechanicsFunctions::Resurrect},\ {"Resurrect", MechanicsFunctions::Resurrect},\
\ \
{"GetDeathReason", MechanicsFunctions::GetDeathReason} {"GetDeathReason", MechanicsFunctions::GetDeathReason},\
{"GetPlayerKillerRefNumIndex", MechanicsFunctions::GetPlayerKillerRefNumIndex}
class MechanicsFunctions class MechanicsFunctions
{ {
@ -127,12 +128,12 @@ public:
static const char *GetPlayerKillerRefId(unsigned short pid) noexcept; static const char *GetPlayerKillerRefId(unsigned short pid) noexcept;
/** /**
* \brief Get the refNumIndex of the actor killer of a certain player. * \brief Get the refNum of the actor killer of a certain player.
* *
* \param pid The player ID of the killed player. * \param pid The player ID of the killed player.
* \return The refNumIndex of the killer. * \return The refNum of the killer.
*/ */
static unsigned int GetPlayerKillerRefNumIndex(unsigned short pid) noexcept; static unsigned int GetPlayerKillerRefNum(unsigned short pid) noexcept;
/** /**
* \brief Get the mpNum of the actor killer of a certain player. * \brief Get the mpNum of the actor killer of a certain player.
@ -258,6 +259,8 @@ public:
// All methods below are deprecated versions of methods from above // All methods below are deprecated versions of methods from above
static const char *GetDeathReason(unsigned short pid) noexcept; static const char *GetDeathReason(unsigned short pid) noexcept;
static unsigned int GetPlayerKillerRefNumIndex(unsigned short pid) noexcept;
}; };
#endif //OPENMW_MECHANICSAPI_HPP #endif //OPENMW_MECHANICSAPI_HPP

@ -63,9 +63,9 @@ const char *ObjectFunctions::GetObjectRefId(unsigned int i) noexcept
return readObjectList->baseObjects.at(i).refId.c_str(); return readObjectList->baseObjects.at(i).refId.c_str();
} }
unsigned int ObjectFunctions::GetObjectRefNumIndex(unsigned int i) noexcept unsigned int ObjectFunctions::GetObjectRefNum(unsigned int i) noexcept
{ {
return readObjectList->baseObjects.at(i).refNumIndex; return readObjectList->baseObjects.at(i).refNum;
} }
unsigned int ObjectFunctions::GetObjectMpNum(unsigned int i) noexcept unsigned int ObjectFunctions::GetObjectMpNum(unsigned int i) noexcept
@ -143,9 +143,9 @@ const char *ObjectFunctions::GetObjectSummonerRefId(unsigned int i) noexcept
return readObjectList->baseObjects.at(i).master.refId.c_str(); return readObjectList->baseObjects.at(i).master.refId.c_str();
} }
unsigned int ObjectFunctions::GetObjectSummonerRefNumIndex(unsigned int i) noexcept unsigned int ObjectFunctions::GetObjectSummonerRefNum(unsigned int i) noexcept
{ {
return readObjectList->baseObjects.at(i).master.refNumIndex; return readObjectList->baseObjects.at(i).master.refNum;
} }
unsigned int ObjectFunctions::GetObjectSummonerMpNum(unsigned int i) noexcept unsigned int ObjectFunctions::GetObjectSummonerMpNum(unsigned int i) noexcept
@ -248,9 +248,9 @@ void ObjectFunctions::SetObjectRefId(const char* refId) noexcept
tempObject.refId = refId; tempObject.refId = refId;
} }
void ObjectFunctions::SetObjectRefNumIndex(int refNumIndex) noexcept void ObjectFunctions::SetObjectRefNum(int refNum) noexcept
{ {
tempObject.refNumIndex = refNumIndex; tempObject.refNum = refNum;
} }
void ObjectFunctions::SetObjectMpNum(int mpNum) noexcept void ObjectFunctions::SetObjectMpNum(int mpNum) noexcept
@ -575,6 +575,16 @@ unsigned char ObjectFunctions::GetEventContainerSubAction() noexcept
return GetObjectListContainerSubAction(); return GetObjectListContainerSubAction();
} }
unsigned int ObjectFunctions::GetObjectRefNumIndex(unsigned int i) noexcept
{
return GetObjectRefNum(i);
}
unsigned int ObjectFunctions::GetObjectSummonerRefNumIndex(unsigned int i) noexcept
{
return GetObjectSummonerRefNum(i);
}
void ObjectFunctions::SetEventCell(const char* cellDescription) noexcept void ObjectFunctions::SetEventCell(const char* cellDescription) noexcept
{ {
SetObjectListCell(cellDescription); SetObjectListCell(cellDescription);
@ -590,6 +600,11 @@ void ObjectFunctions::SetEventConsoleCommand(const char* consoleCommand) noexcep
SetObjectListConsoleCommand(consoleCommand); SetObjectListConsoleCommand(consoleCommand);
} }
void ObjectFunctions::SetObjectRefNumIndex(int refNum) noexcept
{
SetObjectRefNum(refNum);
}
void ObjectFunctions::AddWorldObject() noexcept void ObjectFunctions::AddWorldObject() noexcept
{ {
AddObject(); AddObject();

@ -14,7 +14,7 @@
{"GetObjectListContainerSubAction", ObjectFunctions::GetObjectListContainerSubAction},\ {"GetObjectListContainerSubAction", ObjectFunctions::GetObjectListContainerSubAction},\
\ \
{"GetObjectRefId", ObjectFunctions::GetObjectRefId},\ {"GetObjectRefId", ObjectFunctions::GetObjectRefId},\
{"GetObjectRefNumIndex", ObjectFunctions::GetObjectRefNumIndex},\ {"GetObjectRefNum", ObjectFunctions::GetObjectRefNum},\
{"GetObjectMpNum", ObjectFunctions::GetObjectMpNum},\ {"GetObjectMpNum", ObjectFunctions::GetObjectMpNum},\
{"GetObjectCount", ObjectFunctions::GetObjectCount},\ {"GetObjectCount", ObjectFunctions::GetObjectCount},\
{"GetObjectCharge", ObjectFunctions::GetObjectCharge},\ {"GetObjectCharge", ObjectFunctions::GetObjectCharge},\
@ -30,7 +30,7 @@
{"DoesObjectHavePlayerSummoner", ObjectFunctions::DoesObjectHavePlayerSummoner},\ {"DoesObjectHavePlayerSummoner", ObjectFunctions::DoesObjectHavePlayerSummoner},\
{"GetObjectSummonerPid", ObjectFunctions::GetObjectSummonerPid},\ {"GetObjectSummonerPid", ObjectFunctions::GetObjectSummonerPid},\
{"GetObjectSummonerRefId", ObjectFunctions::GetObjectSummonerRefId},\ {"GetObjectSummonerRefId", ObjectFunctions::GetObjectSummonerRefId},\
{"GetObjectSummonerRefNumIndex", ObjectFunctions::GetObjectSummonerRefNumIndex},\ {"GetObjectSummonerRefNum", ObjectFunctions::GetObjectSummonerRefNum},\
{"GetObjectSummonerMpNum", ObjectFunctions::GetObjectSummonerMpNum},\ {"GetObjectSummonerMpNum", ObjectFunctions::GetObjectSummonerMpNum},\
\ \
{"GetObjectPosX", ObjectFunctions::GetObjectPosX},\ {"GetObjectPosX", ObjectFunctions::GetObjectPosX},\
@ -56,7 +56,7 @@
{"SetObjectListConsoleCommand", ObjectFunctions::SetObjectListConsoleCommand},\ {"SetObjectListConsoleCommand", ObjectFunctions::SetObjectListConsoleCommand},\
\ \
{"SetObjectRefId", ObjectFunctions::SetObjectRefId},\ {"SetObjectRefId", ObjectFunctions::SetObjectRefId},\
{"SetObjectRefNumIndex", ObjectFunctions::SetObjectRefNumIndex},\ {"SetObjectRefNum", ObjectFunctions::SetObjectRefNum},\
{"SetObjectMpNum", ObjectFunctions::SetObjectMpNum},\ {"SetObjectMpNum", ObjectFunctions::SetObjectMpNum},\
{"SetObjectCount", ObjectFunctions::SetObjectCount},\ {"SetObjectCount", ObjectFunctions::SetObjectCount},\
{"SetObjectCharge", ObjectFunctions::SetObjectCharge},\ {"SetObjectCharge", ObjectFunctions::SetObjectCharge},\
@ -110,9 +110,12 @@
{"GetObjectChangesSize", ObjectFunctions::GetObjectChangesSize},\ {"GetObjectChangesSize", ObjectFunctions::GetObjectChangesSize},\
{"GetEventAction", ObjectFunctions::GetEventAction},\ {"GetEventAction", ObjectFunctions::GetEventAction},\
{"GetEventContainerSubAction", ObjectFunctions::GetEventContainerSubAction},\ {"GetEventContainerSubAction", ObjectFunctions::GetEventContainerSubAction},\
{"GetObjectRefNumIndex", ObjectFunctions::GetObjectRefNumIndex},\
{"GetObjectSummonerRefNumIndex", ObjectFunctions::GetObjectSummonerRefNumIndex},\
{"SetEventCell", ObjectFunctions::SetEventCell},\ {"SetEventCell", ObjectFunctions::SetEventCell},\
{"SetEventAction", ObjectFunctions::SetEventAction},\ {"SetEventAction", ObjectFunctions::SetEventAction},\
{"SetEventConsoleCommand", ObjectFunctions::SetEventConsoleCommand},\ {"SetEventConsoleCommand", ObjectFunctions::SetEventConsoleCommand},\
{"SetObjectRefNumIndex", ObjectFunctions::SetObjectRefNumIndex},\
{"AddWorldObject", ObjectFunctions::AddWorldObject} {"AddWorldObject", ObjectFunctions::AddWorldObject}
class ObjectFunctions class ObjectFunctions
@ -179,13 +182,13 @@ public:
static const char *GetObjectRefId(unsigned int i) noexcept; static const char *GetObjectRefId(unsigned int i) noexcept;
/** /**
* \brief Get the refNumIndex of the object at a certain index in the read object list's object * \brief Get the refNum of the object at a certain index in the read object list's object
* changes. * changes.
* *
* \param i The index of the object. * \param i The index of the object.
* \return The refNumIndex. * \return The refNum.
*/ */
static unsigned int GetObjectRefNumIndex(unsigned int i) noexcept; static unsigned int GetObjectRefNum(unsigned int i) noexcept;
/** /**
* \brief Get the mpNum of the object at a certain index in the read object list's object changes. * \brief Get the mpNum of the object at a certain index in the read object list's object changes.
@ -317,13 +320,13 @@ public:
static const char *GetObjectSummonerRefId(unsigned int i) noexcept; static const char *GetObjectSummonerRefId(unsigned int i) noexcept;
/** /**
* \brief Get the refNumIndex of the actor summoner of the object at a certain index in the read object * \brief Get the refNum of the actor summoner of the object at a certain index in the read object
* list's object changes. * list's object changes.
* *
* \param i The index of the object. * \param i The index of the object.
* \return The refNumIndex of the summoner. * \return The refNum of the summoner.
*/ */
static unsigned int GetObjectSummonerRefNumIndex(unsigned int i) noexcept; static unsigned int GetObjectSummonerRefNum(unsigned int i) noexcept;
/** /**
* \brief Get the mpNum of the actor summoner of the object at a certain index in the read object list's * \brief Get the mpNum of the actor summoner of the object at a certain index in the read object list's
@ -505,18 +508,18 @@ public:
static void SetObjectRefId(const char* refId) noexcept; static void SetObjectRefId(const char* refId) noexcept;
/** /**
* \brief Set the refNumIndex of the temporary object stored on the server. * \brief Set the refNum of the temporary object stored on the server.
* *
* Every object loaded from .ESM and .ESP data files has a unique refNumIndex which needs to be * Every object loaded from .ESM and .ESP data files has a unique refNum which needs to be
* retained to refer to it in packets. * retained to refer to it in packets.
* *
* On the other hand, objects placed or spawned via the server should always have a refNumIndex * On the other hand, objects placed or spawned via the server should always have a refNum
* of 0. * of 0.
* *
* \param refNumIndex The refNumIndex. * \param refNum The refNum.
* \return void * \return void
*/ */
static void SetObjectRefNumIndex(int refNumIndex) noexcept; static void SetObjectRefNum(int refNum) noexcept;
/** /**
* \brief Set the mpNum of the temporary object stored on the server. * \brief Set the mpNum of the temporary object stored on the server.
@ -526,7 +529,7 @@ public:
* for these objects. * for these objects.
* *
* Objects loaded from .ESM and .ESP data files should always have an mpNum of 0, because they * Objects loaded from .ESM and .ESP data files should always have an mpNum of 0, because they
* have unique refNumIndexes instead. * have unique refNumes instead.
* *
* \param mpNum The mpNum. * \param mpNum The mpNum.
* \return void * \return void
@ -920,9 +923,12 @@ public:
static unsigned int GetObjectChangesSize() noexcept; static unsigned int GetObjectChangesSize() noexcept;
static unsigned char GetEventAction() noexcept; static unsigned char GetEventAction() noexcept;
static unsigned char GetEventContainerSubAction() noexcept; static unsigned char GetEventContainerSubAction() noexcept;
static unsigned int GetObjectRefNumIndex(unsigned int i) noexcept;
static unsigned int GetObjectSummonerRefNumIndex(unsigned int i) noexcept;
static void SetEventCell(const char* cellDescription) noexcept; static void SetEventCell(const char* cellDescription) noexcept;
static void SetEventAction(unsigned char action) noexcept; static void SetEventAction(unsigned char action) noexcept;
static void SetEventConsoleCommand(const char* consoleCommand) noexcept; static void SetEventConsoleCommand(const char* consoleCommand) noexcept;
static void SetObjectRefNumIndex(int refNum) noexcept;
static void AddWorldObject() noexcept; static void AddWorldObject() noexcept;
}; };

@ -187,9 +187,9 @@ namespace MWBase
/* /*
Start of tes3mp addition Start of tes3mp addition
Make it possible to find a Ptr in any active cell based on its refNumIndex and mpNum Make it possible to find a Ptr in any active cell based on its refNum and mpNum
*/ */
virtual MWWorld::Ptr searchPtrViaRefIndex(int refNumIndex, int mpNum) = 0; virtual MWWorld::Ptr searchPtrViaRefIndex(int refNum, int mpNum) = 0;
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -429,7 +429,7 @@ namespace MWGui
/* /*
Start of tes3mp change (major) Start of tes3mp change (major)
Display the selected object's refNumIndex and mpNum alongside its refId in the Display the selected object's refNum and mpNum alongside its refId in the
title of the console window, for easier debugging of almost everything title of the console window, for easier debugging of almost everything
*/ */
setTitle("#{sConsoleTitle} (" + object.getCellRef().getRefId() + ", " + setTitle("#{sConsoleTitle} (" + object.getCellRef().getRefId() + ", " +

@ -127,7 +127,7 @@ namespace MWGui
mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send(); mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s, %i\n- cell: %s\n- item: %s, %i",
baseObject.refId.c_str(), baseObject.refNumIndex, objectList->cell.getDescription().c_str(), baseObject.refId.c_str(), baseObject.refNum, objectList->cell.getDescription().c_str(),
itemPtr.getCellRef().getRefId().c_str(), itemPtr.getRefData().getCount()); itemPtr.getCellRef().getRefId().c_str(), itemPtr.getRefData().getCount());
/* /*
End of tes3mp addition End of tes3mp addition
@ -182,7 +182,7 @@ namespace MWGui
mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send(); mwmp::Main::get().getNetworking()->getObjectPacket(ID_CONTAINER)->Send();
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s %i-%i\n- cell: %s\n- item: %s %i, %i", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_CONTAINER about\n- Ptr cellRef: %s %i-%i\n- cell: %s\n- item: %s %i, %i",
baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum, objectList->cell.getDescription().c_str(), baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum, objectList->cell.getDescription().c_str(),
containerItem.refId.c_str(), containerItem.count, containerItem.charge); containerItem.refId.c_str(), containerItem.count, containerItem.charge);
} }
/* /*

@ -209,7 +209,7 @@ void ActorList::sendActorsInCell(MWWorld::CellStore* cellStore)
BaseActor actor; BaseActor actor;
actor.refId = ptr.getCellRef().getRefId(); actor.refId = ptr.getCellRef().getRefId();
actor.refNumIndex = ptr.getCellRef().getRefNum().mIndex; actor.refNum = ptr.getCellRef().getRefNum().mIndex;
actor.mpNum = ptr.getCellRef().getMpNum(); actor.mpNum = ptr.getCellRef().getMpNum();
addActor(actor); addActor(actor);
@ -224,7 +224,7 @@ void ActorList::sendActorsInCell(MWWorld::CellStore* cellStore)
BaseActor actor; BaseActor actor;
actor.refId = ptr.getCellRef().getRefId(); actor.refId = ptr.getCellRef().getRefId();
actor.refNumIndex = ptr.getCellRef().getRefNum().mIndex; actor.refNum = ptr.getCellRef().getRefNum().mIndex;
actor.mpNum = ptr.getCellRef().getMpNum(); actor.mpNum = ptr.getCellRef().getMpNum();
addActor(actor); addActor(actor);

@ -432,7 +432,7 @@ void Cell::initializeDedicatedActors(ActorList& actorList)
// If this key doesn't exist, create it // If this key doesn't exist, create it
if (dedicatedActors.count(mapIndex) == 0) if (dedicatedActors.count(mapIndex) == 0)
{ {
MWWorld::Ptr ptrFound = store->searchExact(baseActor.refNumIndex, baseActor.mpNum); MWWorld::Ptr ptrFound = store->searchExact(baseActor.refNum, baseActor.mpNum);
if (!ptrFound) return; if (!ptrFound) return;

@ -207,9 +207,9 @@ bool CellController::isLocalActor(MWWorld::Ptr ptr)
return localActorsToCells.count(actorIndex) > 0; return localActorsToCells.count(actorIndex) > 0;
} }
bool CellController::isLocalActor(int refNumIndex, int mpNum) bool CellController::isLocalActor(int refNum, int mpNum)
{ {
std::string actorIndex = generateMapIndex(refNumIndex, mpNum); std::string actorIndex = generateMapIndex(refNum, mpNum);
return localActorsToCells.count(actorIndex) > 0; return localActorsToCells.count(actorIndex) > 0;
} }
@ -222,9 +222,9 @@ LocalActor *CellController::getLocalActor(MWWorld::Ptr ptr)
return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex); return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex);
} }
LocalActor *CellController::getLocalActor(int refNumIndex, int mpNum) LocalActor *CellController::getLocalActor(int refNum, int mpNum)
{ {
std::string actorIndex = generateMapIndex(refNumIndex, mpNum); std::string actorIndex = generateMapIndex(refNum, mpNum);
std::string cellIndex = localActorsToCells.at(actorIndex); std::string cellIndex = localActorsToCells.at(actorIndex);
return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex); return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex);
@ -250,9 +250,9 @@ bool CellController::isDedicatedActor(MWWorld::Ptr ptr)
return dedicatedActorsToCells.count(actorIndex) > 0; return dedicatedActorsToCells.count(actorIndex) > 0;
} }
bool CellController::isDedicatedActor(int refNumIndex, int mpNum) bool CellController::isDedicatedActor(int refNum, int mpNum)
{ {
std::string actorIndex = generateMapIndex(refNumIndex, mpNum); std::string actorIndex = generateMapIndex(refNum, mpNum);
return dedicatedActorsToCells.count(actorIndex) > 0; return dedicatedActorsToCells.count(actorIndex) > 0;
} }
@ -265,18 +265,18 @@ DedicatedActor *CellController::getDedicatedActor(MWWorld::Ptr ptr)
return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex); return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex);
} }
DedicatedActor *CellController::getDedicatedActor(int refNumIndex, int mpNum) DedicatedActor *CellController::getDedicatedActor(int refNum, int mpNum)
{ {
std::string actorIndex = generateMapIndex(refNumIndex, mpNum); std::string actorIndex = generateMapIndex(refNum, mpNum);
std::string cellIndex = dedicatedActorsToCells.at(actorIndex); std::string cellIndex = dedicatedActorsToCells.at(actorIndex);
return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex); return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex);
} }
std::string CellController::generateMapIndex(int refNumIndex, int mpNum) std::string CellController::generateMapIndex(int refNum, int mpNum)
{ {
std::string mapIndex = ""; std::string mapIndex = "";
mapIndex = Utils::toString(refNumIndex) + "-" + Utils::toString(mpNum); mapIndex = Utils::toString(refNum) + "-" + Utils::toString(mpNum);
return mapIndex; return mapIndex;
} }
@ -287,7 +287,7 @@ std::string CellController::generateMapIndex(MWWorld::Ptr ptr)
std::string CellController::generateMapIndex(BaseActor baseActor) std::string CellController::generateMapIndex(BaseActor baseActor)
{ {
return generateMapIndex(baseActor.refNumIndex, baseActor.mpNum); return generateMapIndex(baseActor.refNum, baseActor.mpNum);
} }
bool CellController::hasLocalAuthority(const ESM::Cell& cell) bool CellController::hasLocalAuthority(const ESM::Cell& cell)

@ -35,17 +35,17 @@ namespace mwmp
void removeLocalActorRecord(std::string actorIndex); void removeLocalActorRecord(std::string actorIndex);
bool isLocalActor(MWWorld::Ptr ptr); bool isLocalActor(MWWorld::Ptr ptr);
bool isLocalActor(int refNumIndex, int mpNum); bool isLocalActor(int refNum, int mpNum);
virtual LocalActor *getLocalActor(MWWorld::Ptr ptr); virtual LocalActor *getLocalActor(MWWorld::Ptr ptr);
virtual LocalActor *getLocalActor(int refNumIndex, int mpNum); virtual LocalActor *getLocalActor(int refNum, int mpNum);
void setDedicatedActorRecord(std::string actorIndex, std::string cellIndex); void setDedicatedActorRecord(std::string actorIndex, std::string cellIndex);
void removeDedicatedActorRecord(std::string actorIndex); void removeDedicatedActorRecord(std::string actorIndex);
bool isDedicatedActor(MWWorld::Ptr ptr); bool isDedicatedActor(MWWorld::Ptr ptr);
bool isDedicatedActor(int refNumIndex, int mpNum); bool isDedicatedActor(int refNum, int mpNum);
virtual DedicatedActor *getDedicatedActor(MWWorld::Ptr ptr); virtual DedicatedActor *getDedicatedActor(MWWorld::Ptr ptr);
virtual DedicatedActor *getDedicatedActor(int refNumIndex, int mpNum); virtual DedicatedActor *getDedicatedActor(int refNum, int mpNum);
std::string generateMapIndex(int refNumindex, int mpNum); std::string generateMapIndex(int refNumindex, int mpNum);
std::string generateMapIndex(MWWorld::Ptr ptr); std::string generateMapIndex(MWWorld::Ptr ptr);

@ -256,22 +256,22 @@ void DedicatedActor::setAi()
} }
else else
{ {
if (mwmp::Main::get().getCellController()->isLocalActor(aiTarget.refNumIndex, aiTarget.mpNum)) if (mwmp::Main::get().getCellController()->isLocalActor(aiTarget.refNum, aiTarget.mpNum))
targetPtr = mwmp::Main::get().getCellController()->getLocalActor(aiTarget.refNumIndex, aiTarget.mpNum)->getPtr(); targetPtr = mwmp::Main::get().getCellController()->getLocalActor(aiTarget.refNum, aiTarget.mpNum)->getPtr();
else if (mwmp::Main::get().getCellController()->isDedicatedActor(aiTarget.refNumIndex, aiTarget.mpNum)) else if (mwmp::Main::get().getCellController()->isDedicatedActor(aiTarget.refNum, aiTarget.mpNum))
targetPtr = mwmp::Main::get().getCellController()->getDedicatedActor(aiTarget.refNumIndex, aiTarget.mpNum)->getPtr(); targetPtr = mwmp::Main::get().getCellController()->getDedicatedActor(aiTarget.refNum, aiTarget.mpNum)->getPtr();
else if (aiAction == mwmp::BaseActorList::ACTIVATE) else if (aiAction == mwmp::BaseActorList::ACTIVATE)
targetPtr = MWBase::Environment::get().getWorld()->searchPtrViaRefIndex(aiTarget.refNumIndex, aiTarget.mpNum); targetPtr = MWBase::Environment::get().getWorld()->searchPtrViaRefIndex(aiTarget.refNum, aiTarget.mpNum);
if (targetPtr) if (targetPtr)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "-- Has AI target %s %i-%i", LOG_APPEND(Log::LOG_VERBOSE, "-- Has AI target %s %i-%i",
targetPtr.getCellRef().getRefId().c_str(), aiTarget.refNumIndex, aiTarget.mpNum); targetPtr.getCellRef().getRefId().c_str(), aiTarget.refNum, aiTarget.mpNum);
} }
else else
{ {
LOG_APPEND(Log::LOG_VERBOSE, "-- Has invalid target AI target %i-%i", LOG_APPEND(Log::LOG_VERBOSE, "-- Has invalid target AI target %i-%i",
aiTarget.refNumIndex, aiTarget.mpNum); aiTarget.refNum, aiTarget.mpNum);
} }
} }
@ -373,7 +373,7 @@ void DedicatedActor::setPtr(const MWWorld::Ptr& newPtr)
ptr = newPtr; ptr = newPtr;
refId = ptr.getCellRef().getRefId(); refId = ptr.getCellRef().getRefId();
refNumIndex = ptr.getCellRef().getRefNum().mIndex; refNum = ptr.getCellRef().getRefNum().mIndex;
mpNum = ptr.getCellRef().getMpNum(); mpNum = ptr.getCellRef().getMpNum();
position = ptr.getRefData().getPosition(); position = ptr.getRefData().getPosition();

@ -66,7 +66,7 @@ void LocalActor::update(bool forceUpdate)
void LocalActor::updateCell() void LocalActor::updateCell()
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_ACTOR_CELL_CHANGE about %s %i-%i to server", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_ACTOR_CELL_CHANGE about %s %i-%i to server",
refId.c_str(), refNumIndex, mpNum); refId.c_str(), refNum, mpNum);
LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s", cell.getDescription().c_str(), ptr.getCell()->getCell()->getDescription().c_str()); LOG_APPEND(Log::LOG_INFO, "- Moved from %s to %s", cell.getDescription().c_str(), ptr.getCell()->getCell()->getDescription().c_str());
@ -191,7 +191,7 @@ void LocalActor::updateStatsDynamic(bool forceUpdate)
killer = MechanicsHelper::getTarget(ptr); killer = MechanicsHelper::getTarget(ptr);
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_ACTOR_DEATH about %s %i-%i to server", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_ACTOR_DEATH about %s %i-%i to server",
refId.c_str(), refNumIndex, mpNum); refId.c_str(), refNum, mpNum);
mwmp::Main::get().getNetworking()->getActorList()->addDeathActor(*this); mwmp::Main::get().getNetworking()->getActorList()->addDeathActor(*this);
@ -274,7 +274,7 @@ void LocalActor::setPtr(const MWWorld::Ptr& newPtr)
ptr = newPtr; ptr = newPtr;
refId = ptr.getCellRef().getRefId(); refId = ptr.getCellRef().getRefId();
refNumIndex = ptr.getCellRef().getRefNum().mIndex; refNum = ptr.getCellRef().getRefNum().mIndex;
mpNum = ptr.getCellRef().getMpNum(); mpNum = ptr.getCellRef().getMpNum();
lastDrawState = ptr.getClass().getCreatureStats(ptr).getDrawState(); lastDrawState = ptr.getClass().getCreatureStats(ptr).getDrawState();

@ -1633,7 +1633,7 @@ void LocalPlayer::clearCellStates()
void LocalPlayer::clearCurrentContainer() void LocalPlayer::clearCurrentContainer()
{ {
currentContainer.refId = ""; currentContainer.refId = "";
currentContainer.refNumIndex = 0; currentContainer.refNum = 0;
currentContainer.mpNum = 0; currentContainer.mpNum = 0;
} }
@ -1661,7 +1661,7 @@ void LocalPlayer::storeCellState(const ESM::Cell& cell, int stateType)
void LocalPlayer::storeCurrentContainer(const MWWorld::Ptr &container) void LocalPlayer::storeCurrentContainer(const MWWorld::Ptr &container)
{ {
currentContainer.refId = container.getCellRef().getRefId(); currentContainer.refId = container.getCellRef().getRefId();
currentContainer.refNumIndex = container.getCellRef().getRefNum().mIndex; currentContainer.refNum = container.getCellRef().getRefNum().mIndex;
currentContainer.mpNum = container.getCellRef().getMpNum(); currentContainer.mpNum = container.getCellRef().getMpNum();
} }

@ -119,7 +119,7 @@ mwmp::Target MechanicsHelper::getTarget(const MWWorld::Ptr& ptr)
{ {
target.isPlayer = false; target.isPlayer = false;
target.refId = ptrRef->getRefId(); target.refId = ptrRef->getRefId();
target.refNumIndex = ptrRef->getRefNum().mIndex; target.refNum = ptrRef->getRefNum().mIndex;
target.mpNum = ptrRef->getMpNum(); target.mpNum = ptrRef->getMpNum();
target.name = ptr.getClass().getName(ptr); target.name = ptr.getClass().getName(ptr);
} }
@ -133,7 +133,7 @@ void MechanicsHelper::clearTarget(mwmp::Target& target)
{ {
target.isPlayer = false; target.isPlayer = false;
target.refId.clear(); target.refId.clear();
target.refNumIndex = -1; target.refNum = -1;
target.mpNum = -1; target.mpNum = -1;
target.name.clear(); target.name.clear();
@ -165,7 +165,7 @@ void MechanicsHelper::assignAttackTarget(Attack* attack, const MWWorld::Ptr& tar
attack->target.isPlayer = false; attack->target.isPlayer = false;
attack->target.refId = targetRef->getRefId(); attack->target.refId = targetRef->getRefId();
attack->target.refNumIndex = targetRef->getRefNum().mIndex; attack->target.refNum = targetRef->getRefNum().mIndex;
attack->target.mpNum = targetRef->getMpNum(); attack->target.mpNum = targetRef->getMpNum();
} }
} }
@ -179,7 +179,7 @@ void MechanicsHelper::resetAttack(Attack* attack)
attack->applyProjectileEnchantment = false; attack->applyProjectileEnchantment = false;
attack->target.guid = RakNet::RakNetGUID(); attack->target.guid = RakNet::RakNetGUID();
attack->target.refId.clear(); attack->target.refId.clear();
attack->target.refNumIndex = 0; attack->target.refNum = 0;
attack->target.mpNum = 0; attack->target.mpNum = 0;
} }
@ -215,10 +215,10 @@ void MechanicsHelper::processAttack(Attack attack, const MWWorld::Ptr& attacker)
else else
{ {
auto controller = mwmp::Main::get().getCellController(); auto controller = mwmp::Main::get().getCellController();
if (controller->isLocalActor(attack.target.refNumIndex, attack.target.mpNum)) if (controller->isLocalActor(attack.target.refNum, attack.target.mpNum))
victim = controller->getLocalActor(attack.target.refNumIndex, attack.target.mpNum)->getPtr(); victim = controller->getLocalActor(attack.target.refNum, attack.target.mpNum)->getPtr();
else if (controller->isDedicatedActor(attack.target.refNumIndex, attack.target.mpNum)) else if (controller->isDedicatedActor(attack.target.refNum, attack.target.mpNum))
victim = controller->getDedicatedActor(attack.target.refNumIndex, attack.target.mpNum)->getPtr(); victim = controller->getDedicatedActor(attack.target.refNum, attack.target.mpNum)->getPtr();
} }
// Get the weapon used (if hand-to-hand, weapon = inv.end()) // Get the weapon used (if hand-to-hand, weapon = inv.end())

@ -66,7 +66,7 @@ BaseObject ObjectList::getBaseObject(const MWWorld::Ptr& ptr)
{ {
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
return baseObject; return baseObject;
} }
@ -114,9 +114,9 @@ void ObjectList::editContainers(MWWorld::CellStore* cellStore)
{ {
baseObject = baseObjects.at(i); baseObject = baseObjects.at(i);
LOG_APPEND(Log::LOG_VERBOSE, "- container cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- container cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -131,7 +131,7 @@ void ObjectList::editContainers(MWWorld::CellStore* cellStore)
{ {
CurrentContainer *currentContainer = &mwmp::Main::get().getLocalPlayer()->currentContainer; CurrentContainer *currentContainer = &mwmp::Main::get().getLocalPlayer()->currentContainer;
if (currentContainer->refNumIndex == ptrFound.getCellRef().getRefNum().mIndex && if (currentContainer->refNum == ptrFound.getCellRef().getRefNum().mIndex &&
currentContainer->mpNum == ptrFound.getCellRef().getMpNum()) currentContainer->mpNum == ptrFound.getCellRef().getMpNum())
{ {
isCurrentContainer = true; isCurrentContainer = true;
@ -269,7 +269,7 @@ void ObjectList::placeObjects(MWWorld::CellStore* cellStore)
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, count: %i, charge: %i, enchantmentCharge: %i", baseObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, count: %i, charge: %i, enchantmentCharge: %i", baseObject.refId.c_str(),
baseObject.refNumIndex, baseObject.mpNum, baseObject.count, baseObject.charge, baseObject.enchantmentCharge); baseObject.refNum, baseObject.mpNum, baseObject.count, baseObject.charge, baseObject.enchantmentCharge);
// Ignore generic dynamic refIds because they could be anything on other clients // Ignore generic dynamic refIds because they could be anything on other clients
if (baseObject.refId.find("$dynamic") != string::npos) if (baseObject.refId.find("$dynamic") != string::npos)
@ -320,7 +320,7 @@ void ObjectList::spawnObjects(MWWorld::CellStore* cellStore)
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(),
baseObject.refNumIndex, baseObject.mpNum); baseObject.refNum, baseObject.mpNum);
// Ignore generic dynamic refIds because they could be anything on other clients // Ignore generic dynamic refIds because they could be anything on other clients
if (baseObject.refId.find("$dynamic") != string::npos) if (baseObject.refId.find("$dynamic") != string::npos)
@ -345,7 +345,7 @@ void ObjectList::spawnObjects(MWWorld::CellStore* cellStore)
if (baseObject.master.isPlayer) if (baseObject.master.isPlayer)
masterPtr = MechanicsHelper::getPlayerPtr(baseObject.master); masterPtr = MechanicsHelper::getPlayerPtr(baseObject.master);
else else
masterPtr = cellStore->searchExact(baseObject.master.refNumIndex, baseObject.master.mpNum); masterPtr = cellStore->searchExact(baseObject.master.refNum, baseObject.master.mpNum);
if (masterPtr) if (masterPtr)
{ {
@ -379,9 +379,9 @@ void ObjectList::deleteObjects(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -393,7 +393,7 @@ void ObjectList::deleteObjects(MWWorld::CellStore* cellStore)
{ {
CurrentContainer *currentContainer = &mwmp::Main::get().getLocalPlayer()->currentContainer; CurrentContainer *currentContainer = &mwmp::Main::get().getLocalPlayer()->currentContainer;
if (currentContainer->refNumIndex == ptrFound.getCellRef().getRefNum().mIndex && if (currentContainer->refNum == ptrFound.getCellRef().getRefNum().mIndex &&
currentContainer->mpNum == ptrFound.getCellRef().getMpNum()) currentContainer->mpNum == ptrFound.getCellRef().getMpNum())
{ {
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container); MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Container);
@ -410,9 +410,9 @@ void ObjectList::lockObjects(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -431,9 +431,9 @@ void ObjectList::triggerTrapObjects(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -456,10 +456,10 @@ void ObjectList::scaleObjects(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, scale: %f", baseObject.refId.c_str(), baseObject.refNumIndex, LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, scale: %f", baseObject.refId.c_str(), baseObject.refNum,
baseObject.mpNum, baseObject.scale); baseObject.mpNum, baseObject.scale);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -475,10 +475,10 @@ void ObjectList::setObjectStates(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, state: %s", baseObject.refId.c_str(), baseObject.refNumIndex, LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, state: %s", baseObject.refId.c_str(), baseObject.refNum,
baseObject.mpNum, baseObject.objectState ? "true" : "false"); baseObject.mpNum, baseObject.objectState ? "true" : "false");
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -497,9 +497,9 @@ void ObjectList::moveObjects(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -516,9 +516,9 @@ void ObjectList::rotateObjects(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -535,9 +535,9 @@ void ObjectList::animateObjects(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -555,9 +555,9 @@ void ObjectList::activateDoors(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -574,9 +574,9 @@ void ObjectList::setDoorDestinations(MWWorld::CellStore* cellStore)
{ {
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -639,9 +639,9 @@ void ObjectList::runConsoleCommands(MWWorld::CellStore* cellStore)
} }
else else
{ {
LOG_APPEND(Log::LOG_VERBOSE, "-- running on cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNumIndex, baseObject.mpNum); LOG_APPEND(Log::LOG_VERBOSE, "-- running on cellRef: %s %i-%i", baseObject.refId.c_str(), baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -663,9 +663,9 @@ void ObjectList::setLocalShorts(MWWorld::CellStore* cellStore)
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, index: %i, shortVal: %i", baseObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, index: %i, shortVal: %i", baseObject.refId.c_str(),
baseObject.refNumIndex, baseObject.mpNum, baseObject.index, baseObject.shortVal); baseObject.refNum, baseObject.mpNum, baseObject.index, baseObject.shortVal);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -682,9 +682,9 @@ void ObjectList::setLocalFloats(MWWorld::CellStore* cellStore)
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, index: %i, floatVal: %f", baseObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i, index: %i, floatVal: %f", baseObject.refId.c_str(),
baseObject.refNumIndex, baseObject.mpNum, baseObject.index, baseObject.floatVal); baseObject.refNum, baseObject.mpNum, baseObject.index, baseObject.floatVal);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -778,9 +778,9 @@ void ObjectList::addRequestedContainers(MWWorld::CellStore* cellStore, const std
for (const auto &baseObject : requestObjects) for (const auto &baseObject : requestObjects)
{ {
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s %i-%i", baseObject.refId.c_str(),
baseObject.refNumIndex, baseObject.mpNum); baseObject.refNum, baseObject.mpNum);
MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNumIndex, baseObject.mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(baseObject.refNum, baseObject.mpNum);
if (ptrFound) if (ptrFound)
{ {
@ -804,7 +804,7 @@ void ObjectList::addObjectPlace(const MWWorld::Ptr& ptr, bool droppedByPlayer)
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = 0; baseObject.mpNum = 0;
baseObject.charge = ptr.getCellRef().getCharge(); baseObject.charge = ptr.getCellRef().getCharge();
baseObject.enchantmentCharge = ptr.getCellRef().getEnchantmentCharge(); baseObject.enchantmentCharge = ptr.getCellRef().getEnchantmentCharge();
@ -837,7 +837,7 @@ void ObjectList::addObjectSpawn(const MWWorld::Ptr& ptr)
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = 0; baseObject.mpNum = 0;
baseObject.isSummon = false; baseObject.isSummon = false;
baseObject.summonDuration = -1; baseObject.summonDuration = -1;
@ -855,7 +855,7 @@ void ObjectList::addObjectSpawn(const MWWorld::Ptr& ptr, const MWWorld::Ptr& mas
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = 0; baseObject.mpNum = 0;
baseObject.isSummon = true; baseObject.isSummon = true;
baseObject.summonDuration = duration; baseObject.summonDuration = duration;
@ -874,7 +874,7 @@ void ObjectList::addObjectDelete(const MWWorld::Ptr& ptr)
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
addObject(baseObject); addObject(baseObject);
} }
@ -885,7 +885,7 @@ void ObjectList::addObjectLock(const MWWorld::Ptr& ptr, int lockLevel)
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.lockLevel = lockLevel; baseObject.lockLevel = lockLevel;
addObject(baseObject); addObject(baseObject);
@ -897,7 +897,7 @@ void ObjectList::addObjectTrap(const MWWorld::Ptr& ptr, const ESM::Position& pos
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.isDisarmed = isDisarmed; baseObject.isDisarmed = isDisarmed;
baseObject.position = pos; baseObject.position = pos;
@ -910,7 +910,7 @@ void ObjectList::addObjectScale(const MWWorld::Ptr& ptr, float scale)
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.scale = scale; baseObject.scale = scale;
addObject(baseObject); addObject(baseObject);
@ -922,7 +922,7 @@ void ObjectList::addObjectState(const MWWorld::Ptr& ptr, bool objectState)
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.objectState = objectState; baseObject.objectState = objectState;
addObject(baseObject); addObject(baseObject);
@ -934,7 +934,7 @@ void ObjectList::addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, i
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.animGroup = group; baseObject.animGroup = group;
baseObject.animMode = mode; baseObject.animMode = mode;
@ -947,7 +947,7 @@ void ObjectList::addDoorState(const MWWorld::Ptr& ptr, int state)
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.doorState = state; baseObject.doorState = state;
addObject(baseObject); addObject(baseObject);
@ -974,7 +974,7 @@ void ObjectList::addScriptLocalShort(const MWWorld::Ptr& ptr, int index, int sho
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.index = index; baseObject.index = index;
baseObject.shortVal = shortVal; baseObject.shortVal = shortVal;
@ -987,7 +987,7 @@ void ObjectList::addScriptLocalFloat(const MWWorld::Ptr& ptr, int index, float f
mwmp::BaseObject baseObject; mwmp::BaseObject baseObject;
baseObject.refId = ptr.getCellRef().getRefId(); baseObject.refId = ptr.getCellRef().getRefId();
baseObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseObject.refNum = ptr.getCellRef().getRefNum().mIndex;
baseObject.mpNum = ptr.getCellRef().getMpNum(); baseObject.mpNum = ptr.getCellRef().getMpNum();
baseObject.index = index; baseObject.index = index;
baseObject.floatVal = floatVal; baseObject.floatVal = floatVal;
@ -1033,7 +1033,7 @@ void ObjectList::sendObjectSpawn()
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_SPAWN about %s", cell.getDescription().c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_SPAWN about %s", cell.getDescription().c_str());
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i", baseObject.refId.c_str(), baseObject.refNumIndex); LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i", baseObject.refId.c_str(), baseObject.refNum);
mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SPAWN)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SPAWN)->setObjectList(this);
mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SPAWN)->Send(); mwmp::Main::get().getNetworking()->getObjectPacket(ID_OBJECT_SPAWN)->Send();
@ -1080,7 +1080,7 @@ void ObjectList::sendDoorState()
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_DOOR_STATE about %s", cell.getDescription().c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_DOOR_STATE about %s", cell.getDescription().c_str());
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, state: %s", baseObject.refId.c_str(), baseObject.refNumIndex, LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, state: %s", baseObject.refId.c_str(), baseObject.refNum,
baseObject.doorState ? "true" : "false"); baseObject.doorState ? "true" : "false");
mwmp::Main::get().getNetworking()->getObjectPacket(ID_DOOR_STATE)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_DOOR_STATE)->setObjectList(this);
@ -1105,7 +1105,7 @@ void ObjectList::sendScriptLocalShort()
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, shortVal: %i", baseObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, shortVal: %i", baseObject.refId.c_str(),
baseObject.refNumIndex, baseObject.index, baseObject.shortVal); baseObject.refNum, baseObject.index, baseObject.shortVal);
mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_SHORT)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_SHORT)->setObjectList(this);
mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_SHORT)->Send(); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_SHORT)->Send();
@ -1117,7 +1117,7 @@ void ObjectList::sendScriptLocalFloat()
for (const auto &baseObject : baseObjects) for (const auto &baseObject : baseObjects)
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, floatVal: %f", baseObject.refId.c_str(), LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, floatVal: %f", baseObject.refId.c_str(),
baseObject.refNumIndex, baseObject.index, baseObject.floatVal); baseObject.refNum, baseObject.index, baseObject.floatVal);
mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_FLOAT)->setObjectList(this); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_FLOAT)->setObjectList(this);
mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_FLOAT)->Send(); mwmp::Main::get().getNetworking()->getObjectPacket(ID_SCRIPT_LOCAL_FLOAT)->Send();

@ -85,7 +85,7 @@ bool PlayerList::isDedicatedPlayer(const MWWorld::Ptr &ptr)
if (ptr.mRef == nullptr) if (ptr.mRef == nullptr)
return false; return false;
// Players always have 0 as their refNumIndex and mpNum // Players always have 0 as their refNum and mpNum
if (ptr.getCellRef().getRefNum().mIndex != 0 || ptr.getCellRef().getMpNum() != 0) if (ptr.getCellRef().getRefNum().mIndex != 0 || ptr.getCellRef().getMpNum() != 0)
return false; return false;

@ -345,13 +345,13 @@ namespace MWScript
if (targetPtr) if (targetPtr)
{ {
mwmp::BaseActor baseActor; mwmp::BaseActor baseActor;
baseActor.refNumIndex = ptr.getCellRef().getRefNum().mIndex; baseActor.refNum = ptr.getCellRef().getRefNum().mIndex;
baseActor.mpNum = ptr.getCellRef().getMpNum(); baseActor.mpNum = ptr.getCellRef().getMpNum();
baseActor.aiAction = mwmp::BaseActorList::FOLLOW; baseActor.aiAction = mwmp::BaseActorList::FOLLOW;
baseActor.aiTarget = MechanicsHelper::getTarget(targetPtr); baseActor.aiTarget = MechanicsHelper::getTarget(targetPtr);
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_ACTOR_AI about %s %i-%i to server", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_ACTOR_AI about %s %i-%i to server",
ptr.getCellRef().getRefId(), baseActor.refNumIndex, baseActor.mpNum); ptr.getCellRef().getRefId(), baseActor.refNum, baseActor.mpNum);
if (baseActor.aiTarget.isPlayer) if (baseActor.aiTarget.isPlayer)
{ {
@ -361,7 +361,7 @@ namespace MWScript
else else
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Following actor %s %i-%i", LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Following actor %s %i-%i",
targetPtr.getCellRef().getRefId(), baseActor.aiTarget.refNumIndex, baseActor.aiTarget.mpNum); targetPtr.getCellRef().getRefId(), baseActor.aiTarget.refNum, baseActor.aiTarget.mpNum);
} }
mwmp::ActorList *actorList = mwmp::Main::get().getNetworking()->getActorList(); mwmp::ActorList *actorList = mwmp::Main::get().getNetworking()->getActorList();

@ -502,12 +502,12 @@ namespace MWWorld
struct SearchExactVisitor struct SearchExactVisitor
{ {
PtrType mFound; PtrType mFound;
unsigned int mRefNumIndexToFind; unsigned int mRefNumToFind;
unsigned int mMpNumToFind; unsigned int mMpNumToFind;
bool operator()(const PtrType& ptr) bool operator()(const PtrType& ptr)
{ {
if (ptr.getCellRef().getRefNum().mIndex == mRefNumIndexToFind && ptr.getCellRef().getMpNum() == mMpNumToFind) if (ptr.getCellRef().getRefNum().mIndex == mRefNumToFind && ptr.getCellRef().getMpNum() == mMpNumToFind)
{ {
mFound = ptr; mFound = ptr;
return false; return false;
@ -524,14 +524,14 @@ namespace MWWorld
Allow the searching of objects by their reference numbers Allow the searching of objects by their reference numbers
*/ */
Ptr CellStore::searchExact (unsigned int refNumIndex, unsigned int mpNum) Ptr CellStore::searchExact (unsigned int refNum, unsigned int mpNum)
{ {
// Ensure that all objects searched for have a valid reference number // Ensure that all objects searched for have a valid reference number
if (refNumIndex == 0 && mpNum == 0) if (refNum == 0 && mpNum == 0)
return 0; return 0;
SearchExactVisitor<MWWorld::Ptr> searchVisitor; SearchExactVisitor<MWWorld::Ptr> searchVisitor;
searchVisitor.mRefNumIndexToFind = refNumIndex; searchVisitor.mRefNumToFind = refNum;
searchVisitor.mMpNumToFind = mpNum; searchVisitor.mMpNumToFind = mpNum;
forEach(searchVisitor); forEach(searchVisitor);
return searchVisitor.mFound; return searchVisitor.mFound;

@ -234,7 +234,7 @@ namespace MWWorld
Allow the searching of objects by their reference numbers Allow the searching of objects by their reference numbers
*/ */
Ptr searchExact (unsigned int refNumIndex, unsigned int mpNum); Ptr searchExact (unsigned int refNum, unsigned int mpNum);
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -732,16 +732,16 @@ namespace MWWorld
/* /*
Start of tes3mp addition Start of tes3mp addition
Make it possible to find a Ptr in any active cell based on its refNumIndex and mpNum Make it possible to find a Ptr in any active cell based on its refNum and mpNum
*/ */
Ptr World::searchPtrViaRefIndex(int refNumIndex, int mpNum) Ptr World::searchPtrViaRefIndex(int refNum, int mpNum)
{ {
for (Scene::CellStoreCollection::const_iterator iter(mWorldScene->getActiveCells().begin()); for (Scene::CellStoreCollection::const_iterator iter(mWorldScene->getActiveCells().begin());
iter != mWorldScene->getActiveCells().end(); ++iter) iter != mWorldScene->getActiveCells().end(); ++iter)
{ {
CellStore* cellStore = *iter; CellStore* cellStore = *iter;
MWWorld::Ptr ptrFound = cellStore->searchExact(refNumIndex, mpNum); MWWorld::Ptr ptrFound = cellStore->searchExact(refNum, mpNum);
if (ptrFound) if (ptrFound)
return ptrFound; return ptrFound;

@ -294,9 +294,9 @@ namespace MWWorld
/* /*
Start of tes3mp addition Start of tes3mp addition
Make it possible to find a Ptr in any active cell based on its refNumIndex and mpNum Make it possible to find a Ptr in any active cell based on its refNum and mpNum
*/ */
Ptr searchPtrViaRefIndex(int refNumIndex, int mpNum) override; Ptr searchPtrViaRefIndex(int refNum, int mpNum) override;
/* /*
End of tes3mp addition End of tes3mp addition
*/ */

@ -20,7 +20,7 @@ namespace mwmp
} }
std::string refId; std::string refId;
int refNumIndex; int refNum;
int mpNum; int mpNum;
ESM::Position position; ESM::Position position;

@ -25,7 +25,7 @@ namespace mwmp
struct BaseObject struct BaseObject
{ {
std::string refId; std::string refId;
int refNumIndex; int refNum;
int mpNum; int mpNum;
int count; int count;
int charge; int charge;

@ -18,7 +18,7 @@ namespace mwmp
struct CurrentContainer struct CurrentContainer
{ {
std::string refId; std::string refId;
unsigned int refNumIndex; unsigned int refNum;
unsigned int mpNum; unsigned int mpNum;
bool loot; bool loot;
}; };

@ -27,7 +27,7 @@ namespace mwmp
bool isPlayer; bool isPlayer;
std::string refId; std::string refId;
int refNumIndex; int refNum;
int mpNum; int mpNum;
std::string name; // Remove this once the server can get names corresponding to different refIds std::string name; // Remove this once the server can get names corresponding to different refIds

@ -37,7 +37,7 @@ void ActorPacket::Packet(RakNet::BitStream *bs, bool send)
if (send) if (send)
actor = actorList->baseActors.at(i); actor = actorList->baseActors.at(i);
RW(actor.refNumIndex, send); RW(actor.refNum, send);
RW(actor.mpNum, send); RW(actor.mpNum, send);
Actor(actor, send); Actor(actor, send);

@ -43,7 +43,7 @@ void PacketActorAI::Actor(BaseActor &actor, bool send)
else else
{ {
RW(actor.aiTarget.refId, send, true); RW(actor.aiTarget.refId, send, true);
RW(actor.aiTarget.refNumIndex, send); RW(actor.aiTarget.refNum, send);
RW(actor.aiTarget.mpNum, send); RW(actor.aiTarget.mpNum, send);
} }
} }

@ -20,7 +20,7 @@ void PacketActorAttack::Actor(BaseActor &actor, bool send)
else else
{ {
RW(actor.attack.target.refId, send, true); RW(actor.attack.target.refId, send, true);
RW(actor.attack.target.refNumIndex, send); RW(actor.attack.target.refNum, send);
RW(actor.attack.target.mpNum, send); RW(actor.attack.target.mpNum, send);
} }

@ -20,7 +20,7 @@ void PacketActorDeath::Actor(BaseActor &actor, bool send)
else else
{ {
RW(actor.killer.refId, send, true); RW(actor.killer.refId, send, true);
RW(actor.killer.refNumIndex, send); RW(actor.killer.refNum, send);
RW(actor.killer.mpNum, send); RW(actor.killer.mpNum, send);
RW(actor.killer.name, send, true); RW(actor.killer.name, send, true);

@ -23,10 +23,10 @@ void PacketActorList::Packet(RakNet::BitStream *bs, bool send)
actor = actorList->baseActors.at(i); actor = actorList->baseActors.at(i);
RW(actor.refId, send); RW(actor.refId, send);
RW(actor.refNumIndex, send); RW(actor.refNum, send);
RW(actor.mpNum, send); RW(actor.mpNum, send);
if (actor.refId.empty() || (actor.refNumIndex != 0 && actor.mpNum != 0)) if (actor.refId.empty() || (actor.refNum != 0 && actor.mpNum != 0))
{ {
actorList->isValid = false; actorList->isValid = false;
return; return;

@ -73,6 +73,6 @@ bool ObjectPacket::PacketHeader(RakNet::BitStream *bs, bool send)
void ObjectPacket::Object(BaseObject &baseObject, bool send) void ObjectPacket::Object(BaseObject &baseObject, bool send)
{ {
RW(baseObject.refId, send); RW(baseObject.refId, send);
RW(baseObject.refNumIndex, send); RW(baseObject.refNum, send);
RW(baseObject.mpNum, send); RW(baseObject.mpNum, send);
} }

@ -33,7 +33,7 @@ void PacketContainer::Packet(RakNet::BitStream *bs, bool send)
RW(baseObject.containerItemCount, send); RW(baseObject.containerItemCount, send);
if (baseObject.containerItemCount > maxObjects || baseObject.refId.empty() || (baseObject.refNumIndex != 0 && baseObject.mpNum != 0)) if (baseObject.containerItemCount > maxObjects || baseObject.refId.empty() || (baseObject.refNum != 0 && baseObject.mpNum != 0))
{ {
objectList->isValid = false; objectList->isValid = false;
return; return;

@ -28,7 +28,7 @@ void PacketObjectSpawn::Object(BaseObject &baseObject, bool send)
else else
{ {
RW(baseObject.master.refId, send, true); RW(baseObject.master.refId, send, true);
RW(baseObject.master.refNumIndex, send); RW(baseObject.master.refNum, send);
RW(baseObject.master.mpNum, send); RW(baseObject.master.mpNum, send);
} }
} }

@ -21,7 +21,7 @@ void PacketPlayerAttack::Packet(RakNet::BitStream *bs, bool send)
else else
{ {
RW(player->attack.target.refId, send, true); RW(player->attack.target.refId, send, true);
RW(player->attack.target.refNumIndex, send); RW(player->attack.target.refNum, send);
RW(player->attack.target.mpNum, send); RW(player->attack.target.mpNum, send);
} }

@ -21,7 +21,7 @@ void PacketPlayerDeath::Packet(RakNet::BitStream *bs, bool send)
else else
{ {
RW(player->killer.refId, send, true); RW(player->killer.refId, send, true);
RW(player->killer.refNumIndex, send); RW(player->killer.refNum, send);
RW(player->killer.mpNum, send); RW(player->killer.mpNum, send);
RW(player->killer.name, send, true); RW(player->killer.name, send, true);

Loading…
Cancel
Save