mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 18:39:39 +00:00
[General] Rename PlayerTeam into PlayerAlly
Considering that you can be allies with someone without being allied to their allies, changing the name makes the system more intuitive.
This commit is contained in:
parent
a383b7b612
commit
980edac942
16 changed files with 110 additions and 113 deletions
|
@ -11,12 +11,12 @@ using namespace std;
|
|||
|
||||
static std::string tempCellDescription;
|
||||
|
||||
void MechanicsFunctions::ClearTeamMembersForPlayer(unsigned short pid) noexcept
|
||||
void MechanicsFunctions::ClearAlliedPlayersForPlayer(unsigned short pid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
player->teamMembers.clear();
|
||||
player->alliedPlayers.clear();
|
||||
}
|
||||
|
||||
unsigned char MechanicsFunctions::GetMiscellaneousChangeType(unsigned short pid) noexcept
|
||||
|
@ -189,15 +189,15 @@ void MechanicsFunctions::SetSelectedSpellId(unsigned short pid, const char *spel
|
|||
player->selectedSpellId = spellId;
|
||||
}
|
||||
|
||||
void MechanicsFunctions::AddTeamMemberForPlayer(unsigned short pid, unsigned short teamMemberPid) noexcept
|
||||
void MechanicsFunctions::AddAlliedPlayerForPlayer(unsigned short pid, unsigned short alliedPlayerPid) noexcept
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
Player *teamMember;
|
||||
GET_PLAYER(teamMemberPid, teamMember, );
|
||||
Player *alliedPlayer;
|
||||
GET_PLAYER(alliedPlayerPid, alliedPlayer, );
|
||||
|
||||
player->teamMembers.push_back(teamMember->guid);
|
||||
player->alliedPlayers.push_back(alliedPlayer->guid);
|
||||
}
|
||||
|
||||
void MechanicsFunctions::SendMarkLocation(unsigned short pid)
|
||||
|
@ -226,12 +226,12 @@ void MechanicsFunctions::SendSelectedSpell(unsigned short pid)
|
|||
packet->Send(false);
|
||||
}
|
||||
|
||||
void MechanicsFunctions::SendTeam(unsigned short pid, bool sendToOtherPlayers)
|
||||
void MechanicsFunctions::SendAlliedPlayers(unsigned short pid, bool sendToOtherPlayers)
|
||||
{
|
||||
Player *player;
|
||||
GET_PLAYER(pid, player, );
|
||||
|
||||
mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_TEAM);
|
||||
mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_ALLY);
|
||||
packet->setPlayer(player);
|
||||
|
||||
packet->Send(false);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../Types.hpp"
|
||||
|
||||
#define MECHANICSAPI \
|
||||
{"ClearTeamMembersForPlayer", MechanicsFunctions::ClearTeamMembersForPlayer},\
|
||||
{"ClearAlliedPlayersForPlayer", MechanicsFunctions::ClearAlliedPlayersForPlayer},\
|
||||
\
|
||||
{"GetMiscellaneousChangeType", MechanicsFunctions::GetMiscellaneousChangeType},\
|
||||
\
|
||||
|
@ -31,11 +31,11 @@
|
|||
{"SetMarkRot", MechanicsFunctions::SetMarkRot},\
|
||||
{"SetSelectedSpellId", MechanicsFunctions::SetSelectedSpellId},\
|
||||
\
|
||||
{"AddTeamMemberForPlayer", MechanicsFunctions::AddTeamMemberForPlayer},\
|
||||
{"AddAlliedPlayerForPlayer", MechanicsFunctions::AddAlliedPlayerForPlayer},\
|
||||
\
|
||||
{"SendMarkLocation", MechanicsFunctions::SendMarkLocation},\
|
||||
{"SendSelectedSpell", MechanicsFunctions::SendSelectedSpell},\
|
||||
{"SendTeam", MechanicsFunctions::SendTeam},\
|
||||
{"SendAlliedPlayers", MechanicsFunctions::SendAlliedPlayers},\
|
||||
\
|
||||
{"Jail", MechanicsFunctions::Jail},\
|
||||
{"Resurrect", MechanicsFunctions::Resurrect},\
|
||||
|
@ -48,13 +48,12 @@ class MechanicsFunctions
|
|||
public:
|
||||
|
||||
/**
|
||||
* \brief Clear the list of players who will be regarded as being on this player's
|
||||
* team.
|
||||
* \brief Clear the list of players who will be regarded as being player's allies.
|
||||
*
|
||||
* \param pid The player ID.
|
||||
* \return void
|
||||
*/
|
||||
static void ClearTeamMembersForPlayer(unsigned short pid) noexcept;
|
||||
static void ClearAlliedPlayersForPlayer(unsigned short pid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Get the type of a PlayerMiscellaneous packet.
|
||||
|
@ -240,13 +239,13 @@ public:
|
|||
static void SetSelectedSpellId(unsigned short pid, const char *spellId) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Add a team member to a player's list of team members.
|
||||
* \brief Add an ally to a player's list of allied players.
|
||||
*
|
||||
* \param pid The player ID.
|
||||
* \param teamMemberPid The team member's player ID.
|
||||
* \param alliedPlayerPid The ally's player ID.
|
||||
* \return void
|
||||
*/
|
||||
static void AddTeamMemberForPlayer(unsigned short pid, unsigned short teamMemberPid) noexcept;
|
||||
static void AddAlliedPlayerForPlayer(unsigned short pid, unsigned short alliedPlayerPid) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Send a PlayerMiscellaneous packet with a Mark location to a player.
|
||||
|
@ -265,14 +264,14 @@ public:
|
|||
static void SendSelectedSpell(unsigned short pid);
|
||||
|
||||
/**
|
||||
* \brief Send a PlayerTeam packet with a list of team member IDs to a player.
|
||||
* \brief Send a PlayerAlly packet with a list of team member IDs to a player.
|
||||
*
|
||||
* \param pid The player ID.
|
||||
* \param sendToOtherPlayers Whether this packet should be sent to players other than the
|
||||
* player attached to the packet (false by default).
|
||||
* \return void
|
||||
*/
|
||||
static void SendTeam(unsigned short pid, bool sendToOtherPlayers);
|
||||
static void SendAlliedPlayers(unsigned short pid, bool sendToOtherPlayers);
|
||||
|
||||
/**
|
||||
* \brief Send a PlayerJail packet about a player.
|
||||
|
|
|
@ -115,14 +115,14 @@ add_openmw_dir (mwmp/processors/actor ProcessorActorAI ProcessorActorAnimFlags P
|
|||
)
|
||||
|
||||
add_openmw_dir (mwmp/processors/player ProcessorChatMessage ProcessorGUIMessageBox ProcessorUserDisconnected
|
||||
ProcessorUserMyID ProcessorGameSettings ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay ProcessorPlayerAttack
|
||||
ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook ProcessorPlayerBounty
|
||||
ProcessorPlayerCast ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass ProcessorPlayerCharGen
|
||||
ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction ProcessorPlayerInput
|
||||
ProcessorPlayerInventory ProcessorPlayerItemUse ProcessorPlayerJail ProcessorPlayerJournal ProcessorPlayerLevel
|
||||
ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys ProcessorPlayerReputation
|
||||
ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech ProcessorPlayerSpellbook
|
||||
ProcessorPlayerStatsDynamic ProcessorPlayerTopic ProcessorPlayerTeam
|
||||
ProcessorUserMyID ProcessorGameSettings ProcessorPlayerAlly ProcessorPlayerAnimFlags ProcessorPlayerAnimPlay
|
||||
ProcessorPlayerAttack ProcessorPlayerAttribute ProcessorPlayerBaseInfo ProcessorPlayerBehavior ProcessorPlayerBook
|
||||
ProcessorPlayerBounty ProcessorPlayerCast ProcessorPlayerCellChange ProcessorPlayerCellState ProcessorPlayerCharClass
|
||||
ProcessorPlayerCharGen ProcessorPlayerDeath ProcessorPlayerDisposition ProcessorPlayerEquipment ProcessorPlayerFaction
|
||||
ProcessorPlayerInput ProcessorPlayerInventory ProcessorPlayerItemUse ProcessorPlayerJail ProcessorPlayerJournal
|
||||
ProcessorPlayerLevel ProcessorPlayerMiscellaneous ProcessorPlayerMomentum ProcessorPlayerPosition ProcessorPlayerQuickKeys
|
||||
ProcessorPlayerReputation ProcessorPlayerResurrect ProcessorPlayerShapeshift ProcessorPlayerSkill ProcessorPlayerSpeech
|
||||
ProcessorPlayerSpellbook ProcessorPlayerStatsDynamic ProcessorPlayerTopic
|
||||
)
|
||||
|
||||
add_openmw_dir (mwmp/processors/object BaseObjectProcessor
|
||||
|
|
|
@ -2363,15 +2363,15 @@ namespace MWMechanics
|
|||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
If we're checking the LocalPlayer and the iteratedActor is a DedicatedPlayer belonging to this one's teamMembers,
|
||||
If we're checking the LocalPlayer and the iteratedActor is a DedicatedPlayer belonging to this one's alliedPlayers,
|
||||
include the iteratedActor in the actors siding with the player
|
||||
|
||||
Alternatively, if we're checking a DedicatedPlayer and the iteratedActor is a LocalPlayer or DedicatedPlayer
|
||||
belonging to their team members, include the iteratedActor in the actors siding with them
|
||||
belonging to their alliedPlayers, include the iteratedActor in the actors siding with them
|
||||
*/
|
||||
if (actor == getPlayer() && mwmp::PlayerList::isDedicatedPlayer(iteratedActor))
|
||||
{
|
||||
if (Utils::vectorContains(mwmp::Main::get().getLocalPlayer()->teamMembers, mwmp::PlayerList::getPlayer(iteratedActor)->guid))
|
||||
if (Utils::vectorContains(mwmp::Main::get().getLocalPlayer()->alliedPlayers, mwmp::PlayerList::getPlayer(iteratedActor)->guid))
|
||||
{
|
||||
list.push_back(iteratedActor);
|
||||
}
|
||||
|
@ -2379,12 +2379,12 @@ namespace MWMechanics
|
|||
else if (mwmp::PlayerList::isDedicatedPlayer(actor))
|
||||
{
|
||||
if (iteratedActor == getPlayer() &&
|
||||
Utils::vectorContains(mwmp::PlayerList::getPlayer(actor)->teamMembers, mwmp::Main::get().getLocalPlayer()->guid))
|
||||
Utils::vectorContains(mwmp::PlayerList::getPlayer(actor)->alliedPlayers, mwmp::Main::get().getLocalPlayer()->guid))
|
||||
{
|
||||
list.push_back(iteratedActor);
|
||||
}
|
||||
else if (mwmp::PlayerList::isDedicatedPlayer(iteratedActor) &&
|
||||
Utils::vectorContains(mwmp::PlayerList::getPlayer(actor)->teamMembers, mwmp::PlayerList::getPlayer(iteratedActor)->guid))
|
||||
Utils::vectorContains(mwmp::PlayerList::getPlayer(actor)->alliedPlayers, mwmp::PlayerList::getPlayer(iteratedActor)->guid))
|
||||
{
|
||||
list.push_back(iteratedActor);
|
||||
}
|
||||
|
|
|
@ -290,9 +290,9 @@ bool MechanicsHelper::isTeamMember(const MWWorld::Ptr& playerChecked, const MWWo
|
|||
playerCheckedGuid = PlayerList::getPlayer(playerChecked)->guid;
|
||||
|
||||
if (playerWithTeamIsLocal)
|
||||
isTeamMember = Utils::vectorContains(mwmp::Main::get().getLocalPlayer()->teamMembers, playerCheckedGuid);
|
||||
isTeamMember = Utils::vectorContains(mwmp::Main::get().getLocalPlayer()->alliedPlayers, playerCheckedGuid);
|
||||
else
|
||||
isTeamMember = Utils::vectorContains(PlayerList::getPlayer(playerWithTeam)->teamMembers, playerCheckedGuid);
|
||||
isTeamMember = Utils::vectorContains(PlayerList::getPlayer(playerWithTeam)->alliedPlayers, playerCheckedGuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "player/ProcessorGUIMessageBox.hpp"
|
||||
#include "player/ProcessorUserDisconnected.hpp"
|
||||
#include "player/ProcessorGameSettings.hpp"
|
||||
#include "player/ProcessorPlayerAlly.hpp"
|
||||
#include "player/ProcessorPlayerAnimFlags.hpp"
|
||||
#include "player/ProcessorPlayerAnimPlay.hpp"
|
||||
#include "player/ProcessorPlayerAttack.hpp"
|
||||
|
@ -43,7 +44,6 @@
|
|||
#include "player/ProcessorPlayerSpeech.hpp"
|
||||
#include "player/ProcessorPlayerSpellbook.hpp"
|
||||
#include "player/ProcessorPlayerStatsDynamic.hpp"
|
||||
#include "player/ProcessorPlayerTeam.hpp"
|
||||
#include "player/ProcessorPlayerTopic.hpp"
|
||||
|
||||
#include "ObjectProcessor.hpp"
|
||||
|
@ -112,6 +112,7 @@ void ProcessorInitializer()
|
|||
PlayerProcessor::AddProcessor(new ProcessorGUIMessageBox());
|
||||
PlayerProcessor::AddProcessor(new ProcessorUserDisconnected());
|
||||
PlayerProcessor::AddProcessor(new ProcessorGameSettings());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerAlly());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerAnimFlags());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerAnimPlay());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerAttack());
|
||||
|
@ -147,7 +148,6 @@ void ProcessorInitializer()
|
|||
PlayerProcessor::AddProcessor(new ProcessorPlayerSpeech());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerSpellbook());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerStatsDynamic());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerTeam());
|
||||
PlayerProcessor::AddProcessor(new ProcessorPlayerTopic());
|
||||
|
||||
ObjectProcessor::AddProcessor(new ProcessorConsoleCommand());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef OPENMW_PROCESSORPLAYERTEAM_HPP
|
||||
#define OPENMW_PROCESSORPLAYERTEAM_HPP
|
||||
#ifndef OPENMW_PROCESSORPLAYERALLY_HPP
|
||||
#define OPENMW_PROCESSORPLAYERALLY_HPP
|
||||
|
||||
#include "../PlayerProcessor.hpp"
|
||||
#include "apps/openmw/mwmp/Main.hpp"
|
||||
|
@ -7,12 +7,12 @@
|
|||
|
||||
namespace mwmp
|
||||
{
|
||||
class ProcessorPlayerTeam final: public PlayerProcessor
|
||||
class ProcessorPlayerAlly final: public PlayerProcessor
|
||||
{
|
||||
public:
|
||||
ProcessorPlayerTeam()
|
||||
ProcessorPlayerAlly()
|
||||
{
|
||||
BPP_INIT(ID_PLAYER_TEAM)
|
||||
BPP_INIT(ID_PLAYER_ALLY)
|
||||
}
|
||||
|
||||
virtual void Do(PlayerPacket &packet, BasePlayer *player)
|
||||
|
@ -21,15 +21,15 @@ namespace mwmp
|
|||
|
||||
if (isLocal())
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received ID_PLAYER_TEAM about LocalPlayer %s from server", localPlayer->npc.mName.c_str());
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received ID_PLAYER_ALLY about LocalPlayer %s from server", localPlayer->npc.mName.c_str());
|
||||
|
||||
for (std::vector<RakNet::RakNetGUID>::iterator iter = localPlayer->teamMembers.begin(); iter != localPlayer->teamMembers.end(); )
|
||||
for (std::vector<RakNet::RakNetGUID>::iterator iter = localPlayer->alliedPlayers.begin(); iter != localPlayer->alliedPlayers.end(); )
|
||||
{
|
||||
DedicatedPlayer *dedicatedPlayer = PlayerList::getPlayer(*iter);
|
||||
|
||||
if (dedicatedPlayer)
|
||||
{
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Adding DedicatedPlayer %s to our team members", dedicatedPlayer->npc.mName.c_str());
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Adding DedicatedPlayer %s to our allied players", dedicatedPlayer->npc.mName.c_str());
|
||||
}
|
||||
|
||||
++iter;
|
||||
|
@ -37,13 +37,13 @@ namespace mwmp
|
|||
}
|
||||
else if (player != 0)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received ID_PLAYER_TEAM about DedicatedPlayer %s from server", player->npc.mName.c_str());
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_INFO, "Received ID_PLAYER_ALLY about DedicatedPlayer %s from server", player->npc.mName.c_str());
|
||||
|
||||
for (std::vector<RakNet::RakNetGUID>::iterator iter = player->teamMembers.begin(); iter != player->teamMembers.end(); )
|
||||
for (std::vector<RakNet::RakNetGUID>::iterator iter = player->alliedPlayers.begin(); iter != player->alliedPlayers.end(); )
|
||||
{
|
||||
if (*iter == localPlayer->guid)
|
||||
{
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Adding LocalPlayer %s to their team members", localPlayer->npc.mName.c_str());
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Adding LocalPlayer %s to their allied players", localPlayer->npc.mName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ namespace mwmp
|
|||
|
||||
if (otherDedicatedPlayer)
|
||||
{
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Adding DedicatedPlayer %s to their team members", otherDedicatedPlayer->npc.mName.c_str());
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Adding DedicatedPlayer %s to their allied players", otherDedicatedPlayer->npc.mName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,4 +62,4 @@ namespace mwmp
|
|||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PROCESSORPLAYERTEAM_HPP
|
||||
#endif //OPENMW_PROCESSORPLAYERALLY_HPP
|
|
@ -26,13 +26,13 @@ namespace mwmp
|
|||
{
|
||||
mwmp::LocalPlayer *localPlayer = mwmp::Main::get().getLocalPlayer();
|
||||
|
||||
for (std::vector<RakNet::RakNetGUID>::iterator iter = localPlayer->teamMembers.begin(); iter != localPlayer->teamMembers.end(); )
|
||||
for (std::vector<RakNet::RakNetGUID>::iterator iter = localPlayer->alliedPlayers.begin(); iter != localPlayer->alliedPlayers.end(); )
|
||||
{
|
||||
if (*iter == guid)
|
||||
{
|
||||
DedicatedPlayer *dedicatedPlayer = PlayerList::getPlayer(guid);
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Deleting %s from our team members", dedicatedPlayer->npc.mName.c_str());
|
||||
iter = localPlayer->teamMembers.erase(iter);
|
||||
LOG_APPEND(TimedLog::LOG_INFO, "- Deleting %s from our allied players", dedicatedPlayer->npc.mName.c_str());
|
||||
iter = localPlayer->alliedPlayers.erase(iter);
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
|
|
|
@ -189,16 +189,14 @@ add_component_dir (openmw-mp/Packets/Player
|
|||
|
||||
PacketChatMessage PacketGUIBoxes PacketGameSettings
|
||||
|
||||
PacketPlayerBaseInfo PacketPlayerCharGen PacketPlayerActiveSkills PacketPlayerAnimFlags PacketPlayerAnimPlay
|
||||
PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook PacketPlayerBounty
|
||||
PacketPlayerCast PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass PacketPlayerDeath
|
||||
PacketPlayerEquipment PacketPlayerFaction PacketPlayerInput PacketPlayerInventory PacketPlayerItemUse
|
||||
PacketPlayerJail PacketPlayerJournal PacketPlayerLevel PacketPlayerMiscellaneous PacketPlayerMomentum
|
||||
PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerReputation PacketPlayerRest PacketPlayerResurrect
|
||||
PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook PacketPlayerStatsDynamic
|
||||
PacketPlayerTopic
|
||||
|
||||
PacketPlayerTeam
|
||||
PacketPlayerBaseInfo PacketPlayerCharGen PacketPlayerActiveSkills PacketPlayerAlly PacketPlayerAnimFlags
|
||||
PacketPlayerAnimPlay PacketPlayerAttack PacketPlayerAttribute PacketPlayerBehavior PacketPlayerBook
|
||||
PacketPlayerBounty PacketPlayerCast PacketPlayerCellChange PacketPlayerCellState PacketPlayerClass
|
||||
PacketPlayerDeath PacketPlayerEquipment PacketPlayerFaction PacketPlayerInput PacketPlayerInventory
|
||||
PacketPlayerItemUse PacketPlayerJail PacketPlayerJournal PacketPlayerLevel PacketPlayerMiscellaneous
|
||||
PacketPlayerMomentum PacketPlayerPosition PacketPlayerQuickKeys PacketPlayerReputation PacketPlayerRest
|
||||
PacketPlayerResurrect PacketPlayerShapeshift PacketPlayerSkill PacketPlayerSpeech PacketPlayerSpellbook
|
||||
PacketPlayerStatsDynamic PacketPlayerTopic
|
||||
)
|
||||
|
||||
add_component_dir (openmw-mp/Packets/Object
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace mwmp
|
|||
std::vector<CellState> cellStateChanges;
|
||||
|
||||
ESM::ActiveSpells activeSpells;
|
||||
std::vector<RakNet::RakNetGUID> teamMembers;
|
||||
std::vector<RakNet::RakNetGUID> alliedPlayers;
|
||||
CurrentContainer currentContainer;
|
||||
|
||||
int difficulty = 0;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../Packets/Player/PacketLoaded.hpp"
|
||||
#include "../Packets/Player/PacketGameSettings.hpp"
|
||||
#include "../Packets/Player/PacketPlayerActiveSkills.hpp"
|
||||
#include "../Packets/Player/PacketPlayerAlly.hpp"
|
||||
#include "../Packets/Player/PacketPlayerAnimFlags.hpp"
|
||||
#include "../Packets/Player/PacketPlayerAnimPlay.hpp"
|
||||
#include "../Packets/Player/PacketPlayerAttack.hpp"
|
||||
|
@ -25,7 +26,6 @@
|
|||
#include "../Packets/Player/PacketPlayerItemUse.hpp"
|
||||
#include "../Packets/Player/PacketPlayerJail.hpp"
|
||||
#include "../Packets/Player/PacketPlayerJournal.hpp"
|
||||
#include "../Packets/Player/PacketPlayerTeam.hpp"
|
||||
#include "../Packets/Player/PacketPlayerLevel.hpp"
|
||||
#include "../Packets/Player/PacketPlayerMiscellaneous.hpp"
|
||||
#include "../Packets/Player/PacketPlayerMomentum.hpp"
|
||||
|
@ -60,6 +60,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p
|
|||
AddPacket<PacketGameSettings>(&packets, peer);
|
||||
AddPacket<PacketPlayerActiveSkills>(&packets, peer);
|
||||
|
||||
AddPacket<PacketPlayerAlly>(&packets, peer);
|
||||
AddPacket<PacketPlayerAnimFlags>(&packets, peer);
|
||||
AddPacket<PacketPlayerAnimPlay>(&packets, peer);
|
||||
AddPacket<PacketPlayerAttack>(&packets, peer);
|
||||
|
@ -81,7 +82,6 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p
|
|||
AddPacket<PacketPlayerItemUse>(&packets, peer);
|
||||
AddPacket<PacketPlayerJail>(&packets, peer);
|
||||
AddPacket<PacketPlayerJournal>(&packets, peer);
|
||||
AddPacket<PacketPlayerTeam>(&packets, peer);
|
||||
AddPacket<PacketPlayerLevel>(&packets, peer);
|
||||
AddPacket<PacketPlayerMiscellaneous>(&packets, peer);
|
||||
AddPacket<PacketPlayerMomentum>(&packets, peer);
|
||||
|
|
|
@ -109,7 +109,7 @@ enum GameMessages
|
|||
|
||||
ID_PLAYER_ITEM_USE,
|
||||
ID_PLAYER_CAST,
|
||||
ID_PLAYER_TEAM,
|
||||
ID_PLAYER_ALLY,
|
||||
ID_WORLD_DESTINATION_OVERRIDE,
|
||||
ID_PLACEHOLDER
|
||||
};
|
||||
|
|
30
components/openmw-mp/Packets/Player/PacketPlayerAlly.cpp
Normal file
30
components/openmw-mp/Packets/Player/PacketPlayerAlly.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketPlayerAlly.hpp"
|
||||
|
||||
mwmp::PacketPlayerAlly::PacketPlayerAlly(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_PLAYER_ALLY;
|
||||
}
|
||||
|
||||
void mwmp::PacketPlayerAlly::Packet(RakNet::BitStream *newBitstream, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(newBitstream, send);
|
||||
|
||||
uint32_t count;
|
||||
|
||||
if (send)
|
||||
count = static_cast<uint32_t>(player->alliedPlayers.size());
|
||||
|
||||
RW(count, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
player->alliedPlayers.clear();
|
||||
player->alliedPlayers.resize(count);
|
||||
}
|
||||
|
||||
for (auto &&teamPlayerGuid : player->alliedPlayers)
|
||||
{
|
||||
RW(teamPlayerGuid, send, true);
|
||||
}
|
||||
}
|
17
components/openmw-mp/Packets/Player/PacketPlayerAlly.hpp
Normal file
17
components/openmw-mp/Packets/Player/PacketPlayerAlly.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef OPENMW_PACKETALLY_HPP
|
||||
#define OPENMW_PACKETALLY_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketPlayerAlly : public PlayerPacket
|
||||
{
|
||||
public:
|
||||
PacketPlayerAlly(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *newBitstream, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETALLY_HPP
|
|
@ -1,30 +0,0 @@
|
|||
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||
#include "PacketPlayerTeam.hpp"
|
||||
|
||||
mwmp::PacketPlayerTeam::PacketPlayerTeam(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||
{
|
||||
packetID = ID_PLAYER_TEAM;
|
||||
}
|
||||
|
||||
void mwmp::PacketPlayerTeam::Packet(RakNet::BitStream *newBitstream, bool send)
|
||||
{
|
||||
PlayerPacket::Packet(newBitstream, send);
|
||||
|
||||
uint32_t count;
|
||||
|
||||
if (send)
|
||||
count = static_cast<uint32_t>(player->teamMembers.size());
|
||||
|
||||
RW(count, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
player->teamMembers.clear();
|
||||
player->teamMembers.resize(count);
|
||||
}
|
||||
|
||||
for (auto &&teamPlayerGuid : player->teamMembers)
|
||||
{
|
||||
RW(teamPlayerGuid, send, true);
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef OPENMW_PACKETTEAM_HPP
|
||||
#define OPENMW_PACKETTEAM_HPP
|
||||
|
||||
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class PacketPlayerTeam : public PlayerPacket
|
||||
{
|
||||
public:
|
||||
PacketPlayerTeam(RakNet::RakPeerInterface *peer);
|
||||
|
||||
virtual void Packet(RakNet::BitStream *newBitstream, bool send);
|
||||
};
|
||||
}
|
||||
|
||||
#endif //OPENMW_PACKETTEAM_HPP
|
Loading…
Reference in a new issue