mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-31 11:06:43 +00:00
[Server] Use consistent order for WorldstateFunctions
This commit is contained in:
parent
60ca72a70a
commit
ffead444db
2 changed files with 67 additions and 70 deletions
|
@ -250,6 +250,12 @@ void WorldstateFunctions::AddEnforcedCollisionRefId(const char *refId) noexcept
|
|||
writeWorldstate.enforcedCollisionRefIds.push_back(refId);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::AddCellToReset(const char *cellDescription) noexcept
|
||||
{
|
||||
ESM::Cell cell = Utils::getCellFromDescription(cellDescription);
|
||||
writeWorldstate.cellsToReset.push_back(cell);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::AddDestinationOverride(const char *oldCellDescription, const char *newCellDescription) noexcept
|
||||
{
|
||||
writeWorldstate.destinationOverrides[oldCellDescription] = newCellDescription;
|
||||
|
@ -265,27 +271,21 @@ void WorldstateFunctions::ClearSynchronizedClientGlobalIds() noexcept
|
|||
writeWorldstate.synchronizedClientGlobalIds.clear();
|
||||
}
|
||||
|
||||
void WorldstateFunctions::AddCellToReset(const char *cellDescription) noexcept
|
||||
{
|
||||
ESM::Cell cell = Utils::getCellFromDescription(cellDescription);
|
||||
writeWorldstate.cellsToReset.push_back(cell);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::ClearEnforcedCollisionRefIds() noexcept
|
||||
{
|
||||
writeWorldstate.enforcedCollisionRefIds.clear();
|
||||
}
|
||||
|
||||
void WorldstateFunctions::ClearDestinationOverrides() noexcept
|
||||
{
|
||||
writeWorldstate.destinationOverrides.clear();
|
||||
}
|
||||
|
||||
void WorldstateFunctions::ClearCellsToReset() noexcept
|
||||
{
|
||||
writeWorldstate.cellsToReset.clear();
|
||||
}
|
||||
|
||||
void WorldstateFunctions::ClearDestinationOverrides() noexcept
|
||||
{
|
||||
writeWorldstate.destinationOverrides.clear();
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SaveMapTileImageFile(unsigned int index, const char *filePath) noexcept
|
||||
{
|
||||
if (index >= readWorldstate->mapTiles.size())
|
||||
|
@ -431,38 +431,6 @@ void WorldstateFunctions::SendWorldCollisionOverride(unsigned short pid, bool se
|
|||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SendWorldDestinationOverride(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
writeWorldstate.guid = player->guid;
|
||||
|
||||
mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_DESTINATION_OVERRIDE);
|
||||
packet->setWorldstate(&writeWorldstate);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
packet->Send(false);
|
||||
if (sendToOtherPlayers)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SendWorldRegionAuthority(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
writeWorldstate.guid = player->guid;
|
||||
|
||||
mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_REGION_AUTHORITY);
|
||||
packet->setWorldstate(&writeWorldstate);
|
||||
|
||||
packet->Send(false);
|
||||
|
||||
// This packet should always be sent to all other players
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SendCellReset(unsigned short pid, bool sendToOtherPlayers) noexcept
|
||||
{
|
||||
mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_CELL_RESET);
|
||||
|
@ -498,6 +466,37 @@ void WorldstateFunctions::SendCellReset(unsigned short pid, bool sendToOtherPlay
|
|||
}
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SendWorldDestinationOverride(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
writeWorldstate.guid = player->guid;
|
||||
|
||||
mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_DESTINATION_OVERRIDE);
|
||||
packet->setWorldstate(&writeWorldstate);
|
||||
|
||||
if (!skipAttachedPlayer)
|
||||
packet->Send(false);
|
||||
if (sendToOtherPlayers)
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
void WorldstateFunctions::SendWorldRegionAuthority(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
writeWorldstate.guid = player->guid;
|
||||
|
||||
mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_REGION_AUTHORITY);
|
||||
packet->setWorldstate(&writeWorldstate);
|
||||
|
||||
packet->Send(false);
|
||||
|
||||
// This packet should always be sent to all other players
|
||||
packet->Send(true);
|
||||
}
|
||||
|
||||
// All methods below are deprecated versions of methods from above
|
||||
|
||||
|
|
|
@ -61,11 +61,13 @@
|
|||
{"AddSynchronizedClientScriptId", WorldstateFunctions::AddSynchronizedClientScriptId},\
|
||||
{"AddSynchronizedClientGlobalId", WorldstateFunctions::AddSynchronizedClientGlobalId},\
|
||||
{"AddEnforcedCollisionRefId", WorldstateFunctions::AddEnforcedCollisionRefId},\
|
||||
{"AddCellToReset", WorldstateFunctions::AddCellToReset},\
|
||||
{"AddDestinationOverride", WorldstateFunctions::AddDestinationOverride},\
|
||||
\
|
||||
{"ClearSynchronizedClientScriptIds", WorldstateFunctions::ClearSynchronizedClientScriptIds},\
|
||||
{"ClearSynchronizedClientGlobalIds", WorldstateFunctions::ClearSynchronizedClientGlobalIds},\
|
||||
{"ClearEnforcedCollisionRefIds", WorldstateFunctions::ClearEnforcedCollisionRefIds},\
|
||||
{"ClearCellsToReset", WorldstateFunctions::ClearCellsToReset},\
|
||||
{"ClearDestinationOverrides", WorldstateFunctions::ClearDestinationOverrides},\
|
||||
\
|
||||
{"SaveMapTileImageFile", WorldstateFunctions::SaveMapTileImageFile},\
|
||||
|
@ -78,13 +80,10 @@
|
|||
{"SendWorldTime", WorldstateFunctions::SendWorldTime},\
|
||||
{"SendWorldWeather", WorldstateFunctions::SendWorldWeather},\
|
||||
{"SendWorldCollisionOverride", WorldstateFunctions::SendWorldCollisionOverride},\
|
||||
{"SendCellReset", WorldstateFunctions::SendCellReset},\
|
||||
{"SendWorldDestinationOverride", WorldstateFunctions::SendWorldDestinationOverride},\
|
||||
{"SendWorldRegionAuthority", WorldstateFunctions::SendWorldRegionAuthority},\
|
||||
\
|
||||
{"AddCellToReset", WorldstateFunctions::AddCellToReset},\
|
||||
{"ClearCellsToReset", WorldstateFunctions::ClearCellsToReset},\
|
||||
{"SendCellReset", WorldstateFunctions::SendCellReset},\
|
||||
\
|
||||
{"ReadLastWorldstate", WorldstateFunctions::ReadLastWorldstate},\
|
||||
{"CopyLastWorldstateToStore", WorldstateFunctions::CopyLastWorldstateToStore}
|
||||
|
||||
|
@ -461,6 +460,13 @@ public:
|
|||
*/
|
||||
static void AddEnforcedCollisionRefId(const char* refId) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Add a cell with given cellDescription to the list of cells that should be reset on the client.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void AddCellToReset(const char * cellDescription) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Add a destination override containing the cell description for the old cell
|
||||
* and the new cell.
|
||||
|
@ -489,27 +495,12 @@ public:
|
|||
|
||||
/**
|
||||
* \brief Clear the list of refIds for which collision should be enforced irrespective
|
||||
* \brief Add a cell with given cellDescription to the list of cells that should be reset on the client.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void AddCellToReset(const char * cellDescription) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Clear the list of refIdsd for which collision should be enforced irrespective
|
||||
* of other settings.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void ClearEnforcedCollisionRefIds() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Clear the list of destination overrides.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void ClearDestinationOverrides() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Clear the list of cells which should be reset on the client.
|
||||
*
|
||||
|
@ -517,6 +508,13 @@ public:
|
|||
*/
|
||||
static void ClearCellsToReset() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Clear the list of destination overrides.
|
||||
*
|
||||
* \return void
|
||||
*/
|
||||
static void ClearDestinationOverrides() noexcept;
|
||||
|
||||
/**
|
||||
* \brief Save the .png image data of the map tile at a certain index in the read worldstate's
|
||||
* map changes.
|
||||
|
@ -588,14 +586,6 @@ public:
|
|||
*/
|
||||
static void SendWorldRegionAuthority(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a CellReset packet with a list of cells,
|
||||
*
|
||||
* \param pid The player ID attached to the packet.
|
||||
* \return void
|
||||
*/
|
||||
static void SendCellReset(unsigned short pid, bool sendToOtherPlayers) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a WorldMap packet with the current set of map changes in the write-only
|
||||
* worldstate.
|
||||
|
@ -645,6 +635,14 @@ public:
|
|||
*/
|
||||
static void SendWorldCollisionOverride(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a CellReset packet with a list of cells,
|
||||
*
|
||||
* \param pid The player ID attached to the packet.
|
||||
* \return void
|
||||
*/
|
||||
static void SendCellReset(unsigned short pid, bool sendToOtherPlayers) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a WorldDestinationOverride packet with the current destination overrides in
|
||||
* the write-only worldstate.
|
||||
|
|
Loading…
Reference in a new issue