mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-27 13:39:42 +00:00
[Server] Bring Actor functions in line with Object functions, part 1
The last received ActorList can now be copied into the write-only ActorList that can be sent in packets. Changing the pid of the write-only ActorList can now be done separately from clearing its contents.
This commit is contained in:
parent
f0d4f1bbe5
commit
8f745df055
2 changed files with 48 additions and 7 deletions
|
@ -32,16 +32,25 @@ void ActorFunctions::ReadCellActorList(const char* cellDescription) noexcept
|
||||||
readActorList = serverCell->getActorList();
|
readActorList = serverCell->getActorList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActorFunctions::InitializeActorList(unsigned short pid) noexcept
|
void ActorFunctions::ClearActorList() noexcept
|
||||||
|
{
|
||||||
|
writeActorList.cell.blank();
|
||||||
|
writeActorList.baseActors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActorFunctions::SetActorListPid(unsigned short pid) noexcept
|
||||||
{
|
{
|
||||||
Player *player;
|
Player *player;
|
||||||
GET_PLAYER(pid, player, );
|
GET_PLAYER(pid, player, );
|
||||||
|
|
||||||
writeActorList.cell.blank();
|
|
||||||
writeActorList.baseActors.clear();
|
|
||||||
writeActorList.guid = player->guid;
|
writeActorList.guid = player->guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActorFunctions::CopyLastActorListToStore() noexcept
|
||||||
|
{
|
||||||
|
writeActorList = *readActorList;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int ActorFunctions::GetActorListSize() noexcept
|
unsigned int ActorFunctions::GetActorListSize() noexcept
|
||||||
{
|
{
|
||||||
return readActorList->count;
|
return readActorList->count;
|
||||||
|
@ -439,3 +448,10 @@ void ActorFunctions::SendActorCellChange() noexcept
|
||||||
actorPacket->Send(writeActorList.guid);
|
actorPacket->Send(writeActorList.guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All methods below are deprecated versions of methods from above
|
||||||
|
|
||||||
|
void ActorFunctions::InitializeActorList(unsigned short pid) noexcept
|
||||||
|
{
|
||||||
|
ClearActorList();
|
||||||
|
SetActorListPid(pid);
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,11 @@
|
||||||
#define ACTORAPI \
|
#define ACTORAPI \
|
||||||
{"ReadLastActorList", ActorFunctions::ReadLastActorList},\
|
{"ReadLastActorList", ActorFunctions::ReadLastActorList},\
|
||||||
{"ReadCellActorList", ActorFunctions::ReadCellActorList},\
|
{"ReadCellActorList", ActorFunctions::ReadCellActorList},\
|
||||||
{"InitializeActorList", ActorFunctions::InitializeActorList},\
|
\
|
||||||
|
{"ClearActorList", ActorFunctions::ClearActorList},\
|
||||||
|
{"SetActorListPid", ActorFunctions::SetActorListPid},\
|
||||||
|
\
|
||||||
|
{"CopyLastActorListToStore", ActorFunctions::CopyLastActorListToStore},\
|
||||||
\
|
\
|
||||||
{"GetActorListSize", ActorFunctions::GetActorListSize},\
|
{"GetActorListSize", ActorFunctions::GetActorListSize},\
|
||||||
{"GetActorListAction", ActorFunctions::GetActorListAction},\
|
{"GetActorListAction", ActorFunctions::GetActorListAction},\
|
||||||
|
@ -86,7 +90,9 @@
|
||||||
{"SendActorStatsDynamic", ActorFunctions::SendActorStatsDynamic},\
|
{"SendActorStatsDynamic", ActorFunctions::SendActorStatsDynamic},\
|
||||||
{"SendActorEquipment", ActorFunctions::SendActorEquipment},\
|
{"SendActorEquipment", ActorFunctions::SendActorEquipment},\
|
||||||
{"SendActorAI", ActorFunctions::SendActorAI},\
|
{"SendActorAI", ActorFunctions::SendActorAI},\
|
||||||
{"SendActorCellChange", ActorFunctions::SendActorCellChange}
|
{"SendActorCellChange", ActorFunctions::SendActorCellChange},\
|
||||||
|
\
|
||||||
|
{"InitializeActorList", ActorFunctions::InitializeActorList}
|
||||||
|
|
||||||
class ActorFunctions
|
class ActorFunctions
|
||||||
{
|
{
|
||||||
|
@ -113,12 +119,26 @@ public:
|
||||||
/**
|
/**
|
||||||
* \brief Clear the data from the last actor list sent by the server.
|
* \brief Clear the data from the last actor list sent by the server.
|
||||||
*
|
*
|
||||||
* This is used to initialize the sending of new Actor packets.
|
* \return void
|
||||||
|
*/
|
||||||
|
static void ClearActorList() noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the pid attached to the ActorList.
|
||||||
*
|
*
|
||||||
* \param pid The player ID to whom the actor list should be attached.
|
* \param pid The player ID to whom the actor list should be attached.
|
||||||
* \return void
|
* \return void
|
||||||
*/
|
*/
|
||||||
static void InitializeActorList(unsigned short pid) noexcept;
|
static void SetActorListPid(unsigned short pid) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Take the contents of the read-only actor list last received by the
|
||||||
|
* server from a player and move its contents to the stored object list
|
||||||
|
* that can be sent by the server.
|
||||||
|
*
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
static void CopyLastActorListToStore() noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the number of indexes in the read actor list.
|
* \brief Get the number of indexes in the read actor list.
|
||||||
|
@ -704,6 +724,11 @@ public:
|
||||||
* \return void
|
* \return void
|
||||||
*/
|
*/
|
||||||
static void SendActorCellChange() noexcept;
|
static void SendActorCellChange() noexcept;
|
||||||
|
|
||||||
|
|
||||||
|
// All methods below are deprecated versions of methods from above
|
||||||
|
|
||||||
|
static void InitializeActorList(unsigned short pid) noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue