mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Rename BasePacket into PlayerPacket
This commit is contained in:
parent
3136a12051
commit
b8f4cb94fb
45 changed files with 107 additions and 115 deletions
|
@ -69,7 +69,7 @@ void Networking::Update(RakNet::Packet *packet)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BasePacket *myPacket = controller->GetPacket(packet->data[0]);
|
PlayerPacket *myPacket = controller->GetPacket(packet->data[0]);
|
||||||
|
|
||||||
if (packet->data[0] == ID_HANDSHAKE)
|
if (packet->data[0] == ID_HANDSHAKE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -178,7 +178,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
|
||||||
if (id != myid)
|
if (id != myid)
|
||||||
pl = Players::GetPlayer(id);
|
pl = Players::GetPlayer(id);
|
||||||
|
|
||||||
BasePacket *myPacket = controller.GetPacket(packet->data[0]);
|
PlayerPacket *myPacket = controller.GetPacket(packet->data[0]);
|
||||||
|
|
||||||
switch (packet->data[0])
|
switch (packet->data[0])
|
||||||
{
|
{
|
||||||
|
@ -618,7 +618,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BasePacket *Networking::GetPacket(RakNet::MessageID id)
|
PlayerPacket *Networking::GetPacket(RakNet::MessageID id)
|
||||||
{
|
{
|
||||||
return controller.GetPacket(id);
|
return controller.GetPacket(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace mwmp
|
||||||
void Connect(const std::string& ip, unsigned short port);
|
void Connect(const std::string& ip, unsigned short port);
|
||||||
void Update();
|
void Update();
|
||||||
void SendData(RakNet::BitStream *bitStream);
|
void SendData(RakNet::BitStream *bitStream);
|
||||||
BasePacket *GetPacket(RakNet::MessageID id);
|
PlayerPacket *GetPacket(RakNet::MessageID id);
|
||||||
|
|
||||||
bool isDedicatedPlayer(const MWWorld::Ptr &ptr);
|
bool isDedicatedPlayer(const MWWorld::Ptr &ptr);
|
||||||
bool Attack(const MWWorld::Ptr &ptr);
|
bool Attack(const MWWorld::Ptr &ptr);
|
||||||
|
|
|
@ -148,7 +148,7 @@ add_component_dir (version
|
||||||
add_component_dir (openmw-mp
|
add_component_dir (openmw-mp
|
||||||
Log
|
Log
|
||||||
PacketsController
|
PacketsController
|
||||||
Packets/BasePacket Packets/PacketBaseInfo Packets/PacketPosition Packets/PacketEquipment Packets/PacketAttack
|
Packets/PlayerPacket Packets/PacketBaseInfo Packets/PacketPosition Packets/PacketEquipment Packets/PacketAttack
|
||||||
Packets/PacketDynamicStats Packets/PacketCell Packets/PacketDrawState Packets/PacketChatMessage
|
Packets/PacketDynamicStats Packets/PacketCell Packets/PacketDrawState Packets/PacketChatMessage
|
||||||
Packets/PacketCharGen Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel Packets/PacketHandshake
|
Packets/PacketCharGen Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel Packets/PacketHandshake
|
||||||
Packets/PacketGUIBoxes Packets/PacketClass Packets/PacketTime)
|
Packets/PacketGUIBoxes Packets/PacketClass Packets/PacketTime)
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketAttack::PacketAttack(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketAttack::PacketAttack(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_ATTACK;
|
packetID = ID_GAME_ATTACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketAttack::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
void PacketAttack::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->GetAttack()->attacker, send);
|
RW(player->GetAttack()->attacker, send);
|
||||||
RW(player->GetAttack()->target, send);
|
RW(player->GetAttack()->target, send);
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKETATTACK_HPP
|
#define OPENMW_PACKETATTACK_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketAttack : public BasePacket
|
class PacketAttack : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketAttack(RakNet::RakPeerInterface *peer);
|
PacketAttack(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketAttribute::PacketAttribute(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketAttribute::PacketAttribute(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_ATTRIBUTE;
|
packetID = ID_GAME_ATTRIBUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketAttribute::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketAttribute::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
for (int i = 0; i < AttributeCount; ++i)
|
for (int i = 0; i < AttributeCount; ++i)
|
||||||
RW(player->CreatureStats()->mAttributes[i], send);
|
RW(player->CreatureStats()->mAttributes[i], send);
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef OPENMW_PACKETATTRIBUTE_HPP
|
#ifndef OPENMW_PACKETATTRIBUTE_HPP
|
||||||
#define OPENMW_PACKETATTRIBUTE_HPP
|
#define OPENMW_PACKETATTRIBUTE_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketAttribute : public BasePacket
|
class PacketAttribute : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const static int AttributeCount = 8;
|
const static int AttributeCount = 8;
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketBaseInfo::PacketBaseInfo(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketBaseInfo::PacketBaseInfo(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_BASE_INFO;
|
packetID = ID_GAME_BASE_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketBaseInfo::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketBaseInfo::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->Npc()->mName, send);
|
RW(player->Npc()->mName, send);
|
||||||
RW(player->Npc()->mModel, send);
|
RW(player->Npc()->mModel, send);
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef OPENMW_PACKETBASEINFO_HPP
|
#ifndef OPENMW_PACKETBASEINFO_HPP
|
||||||
#define OPENMW_PACKETBASEINFO_HPP
|
#define OPENMW_PACKETBASEINFO_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketBaseInfo : public BasePacket
|
class PacketBaseInfo : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketBaseInfo(RakNet::RakPeerInterface *peer);
|
PacketBaseInfo(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "PacketCell.hpp"
|
#include "PacketCell.hpp"
|
||||||
|
|
||||||
|
|
||||||
mwmp::PacketCell::PacketCell(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
mwmp::PacketCell::PacketCell(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_CELL;
|
packetID = ID_GAME_CELL;
|
||||||
priority = IMMEDIATE_PRIORITY;
|
priority = IMMEDIATE_PRIORITY;
|
||||||
|
@ -15,7 +15,7 @@ mwmp::PacketCell::PacketCell(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
||||||
|
|
||||||
void mwmp::PacketCell::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
void mwmp::PacketCell::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->GetCell()->mData.mFlags, send);
|
RW(player->GetCell()->mData.mFlags, send);
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKETCELL_HPP
|
#define OPENMW_PACKETCELL_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketCell : public BasePacket
|
class PacketCell : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketCell(RakNet::RakPeerInterface *peer);
|
PacketCell(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include "PacketCharGen.hpp"
|
#include "PacketCharGen.hpp"
|
||||||
|
|
||||||
mwmp::PacketCharGen::PacketCharGen(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
mwmp::PacketCharGen::PacketCharGen(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_CHARGEN;
|
packetID = ID_GAME_CHARGEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mwmp::PacketCharGen::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
void mwmp::PacketCharGen::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(*player->CharGenStage(), send);
|
RW(*player->CharGenStage(), send);
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKETCHARGEN_HPP
|
#define OPENMW_PACKETCHARGEN_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketCharGen : public BasePacket
|
class PacketCharGen : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketCharGen(RakNet::RakPeerInterface *peer);
|
PacketCharGen(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include "PacketChatMessage.hpp"
|
#include "PacketChatMessage.hpp"
|
||||||
|
|
||||||
mwmp::PacketChatMessage::PacketChatMessage(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
mwmp::PacketChatMessage::PacketChatMessage(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_CHAT_MESSAGE;
|
packetID = ID_CHAT_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mwmp::PacketChatMessage::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
void mwmp::PacketChatMessage::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(*player->ChatMessage(), send);
|
RW(*player->ChatMessage(), send);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef OPENMW_PACKETCHATMESSAGE_HPP
|
#ifndef OPENMW_PACKETCHATMESSAGE_HPP
|
||||||
#define OPENMW_PACKETCHATMESSAGE_HPP
|
#define OPENMW_PACKETCHATMESSAGE_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketChatMessage : public BasePacket
|
class PacketChatMessage : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketChatMessage(RakNet::RakPeerInterface *peer);
|
PacketChatMessage(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include "PacketClass.hpp"
|
#include "PacketClass.hpp"
|
||||||
|
|
||||||
mwmp::PacketClass::PacketClass(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
mwmp::PacketClass::PacketClass(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_CHARCLASS;
|
packetID = ID_GAME_CHARCLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mwmp::PacketClass::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
void mwmp::PacketClass::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->charClass.mId, send);
|
RW(player->charClass.mId, send);
|
||||||
if (player->charClass.mId.empty()) // custom class
|
if (player->charClass.mId.empty()) // custom class
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKETCLASS_HPP
|
#define OPENMW_PACKETCLASS_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketClass : public BasePacket
|
class PacketClass : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketClass(RakNet::RakPeerInterface *peer);
|
PacketClass(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -6,21 +6,21 @@
|
||||||
#define OPENMW_PACKETDIE_HPP
|
#define OPENMW_PACKETDIE_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketDie: public BasePacket
|
class PacketDie: public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketDie(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketDie(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_DIE;
|
packetID = ID_GAME_DIE;
|
||||||
}
|
}
|
||||||
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
RW(player->CreatureStats()->mDead, send);
|
RW(player->CreatureStats()->mDead, send);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
#ifndef OPENMW_PACKETDISCONNECT_HPP
|
#ifndef OPENMW_PACKETDISCONNECT_HPP
|
||||||
#define OPENMW_PACKETDISCONNECT_HPP
|
#define OPENMW_PACKETDISCONNECT_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketDisconnect : public BasePacket
|
class PacketDisconnect : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketDisconnect(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketDisconnect(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_USER_DISCONNECTED;
|
packetID = ID_USER_DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include "PacketDrawState.hpp"
|
#include "PacketDrawState.hpp"
|
||||||
|
|
||||||
mwmp::PacketDrawState::PacketDrawState(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
mwmp::PacketDrawState::PacketDrawState(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_DRAWSTATE;
|
packetID = ID_GAME_DRAWSTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mwmp::PacketDrawState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
void mwmp::PacketDrawState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(*player->MovementFlags(), send);
|
RW(*player->MovementFlags(), send);
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKETDRAWSTATE_HPP
|
#define OPENMW_PACKETDRAWSTATE_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketDrawState : public BasePacket
|
class PacketDrawState : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketDrawState(RakNet::RakPeerInterface *peer);
|
PacketDrawState(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketDynamicStats::PacketDynamicStats(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketDynamicStats::PacketDynamicStats(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_DYNAMICSTATS;
|
packetID = ID_GAME_DYNAMICSTATS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketDynamicStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketDynamicStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
RW(player->CreatureStats()->mDynamic[0], send); // health
|
RW(player->CreatureStats()->mDynamic[0], send); // health
|
||||||
RW(player->CreatureStats()->mDynamic[1], send); // magic
|
RW(player->CreatureStats()->mDynamic[1], send); // magic
|
||||||
RW(player->CreatureStats()->mDynamic[2], send); // fatigue
|
RW(player->CreatureStats()->mDynamic[2], send); // fatigue
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKAGEDYNAMICSTATS_HPP
|
#define OPENMW_PACKAGEDYNAMICSTATS_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketDynamicStats : public BasePacket
|
class PacketDynamicStats : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketDynamicStats(RakNet::RakPeerInterface *peer);
|
PacketDynamicStats(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketEquipment::PacketEquipment(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketEquipment::PacketEquipment(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_EQUIPMENT;
|
packetID = ID_GAME_EQUIPMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketEquipment::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketEquipment::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
for (int i = 0; i < 19; i++)
|
for (int i = 0; i < 19; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef OPENMW_PACKETEQUIPMENT_HPP
|
#ifndef OPENMW_PACKETEQUIPMENT_HPP
|
||||||
#define OPENMW_PACKETEQUIPMENT_HPP
|
#define OPENMW_PACKETEQUIPMENT_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketEquipment : public BasePacket
|
class PacketEquipment : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketEquipment(RakNet::RakPeerInterface *peer);
|
PacketEquipment(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketGUIBoxes::PacketGUIBoxes(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketGUIBoxes::PacketGUIBoxes(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GUI_MESSAGEBOX;
|
packetID = ID_GUI_MESSAGEBOX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketGUIBoxes::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketGUIBoxes::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->guiMessageBox.id, send);
|
RW(player->guiMessageBox.id, send);
|
||||||
RW(player->guiMessageBox.type, send);
|
RW(player->guiMessageBox.type, send);
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKETGUIBOXES_HPP
|
#define OPENMW_PACKETGUIBOXES_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketGUIBoxes : public BasePacket
|
class PacketGUIBoxes : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketGUIBoxes(RakNet::RakPeerInterface *peer);
|
PacketGUIBoxes(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketHandshake::PacketHandshake(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketHandshake::PacketHandshake(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_HANDSHAKE;
|
packetID = ID_HANDSHAKE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketHandshake::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketHandshake::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
RW(player->Npc()->mName, send);
|
RW(player->Npc()->mName, send);
|
||||||
RW(*player->GetPassw(), send);
|
RW(*player->GetPassw(), send);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef OPENMW_PACKETHANDSHAKE_HPP
|
#ifndef OPENMW_PACKETHANDSHAKE_HPP
|
||||||
#define OPENMW_PACKETHANDSHAKE_HPP
|
#define OPENMW_PACKETHANDSHAKE_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketHandshake : public BasePacket
|
class PacketHandshake : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketHandshake(RakNet::RakPeerInterface *peer);
|
PacketHandshake(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketLevel::PacketLevel(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketLevel::PacketLevel(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_LEVEL;
|
packetID = ID_GAME_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketLevel::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketLevel::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->CreatureStats()->mLevel, send);
|
RW(player->CreatureStats()->mLevel, send);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef OPENMW_PACKETLEVEL_HPP
|
#ifndef OPENMW_PACKETLEVEL_HPP
|
||||||
#define OPENMW_PACKETLEVEL_HPP
|
#define OPENMW_PACKETLEVEL_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketLevel : public BasePacket
|
class PacketLevel : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketLevel(RakNet::RakPeerInterface *peer);
|
PacketLevel(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
#ifndef OPENMW_PACKETLOADED_HPP
|
#ifndef OPENMW_PACKETLOADED_HPP
|
||||||
#define OPENMW_PACKETLOADED_HPP
|
#define OPENMW_PACKETLOADED_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketLoaded : public BasePacket
|
class PacketLoaded : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketLoaded(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketLoaded(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_LOADED;
|
packetID = ID_LOADED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketPosition::PacketPosition(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketPosition::PacketPosition(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_POS;
|
packetID = ID_GAME_POS;
|
||||||
priority = MEDIUM_PRIORITY;
|
priority = MEDIUM_PRIORITY;
|
||||||
|
@ -17,7 +17,7 @@ PacketPosition::PacketPosition(RakNet::RakPeerInterface *peer) : BasePacket(peer
|
||||||
|
|
||||||
void PacketPosition::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketPosition::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(*player->Position(), send);
|
RW(*player->Position(), send);
|
||||||
RW(*player->Dir(), send);
|
RW(*player->Dir(), send);
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef OPENMW_PACKETPOSITION_HPP
|
#ifndef OPENMW_PACKETPOSITION_HPP
|
||||||
#define OPENMW_PACKETPOSITION_HPP
|
#define OPENMW_PACKETPOSITION_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketPosition : public BasePacket
|
class PacketPosition : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketPosition(RakNet::RakPeerInterface *peer);
|
PacketPosition(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -6,21 +6,21 @@
|
||||||
#define OPENMW_PACKETRESURRECT_HPP
|
#define OPENMW_PACKETRESURRECT_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketResurrect: public BasePacket
|
class PacketResurrect: public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketResurrect(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketResurrect(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_RESURRECT;
|
packetID = ID_GAME_RESURRECT;
|
||||||
}
|
}
|
||||||
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
RW(player->CreatureStats()->mDead, send);
|
RW(player->CreatureStats()->mDead, send);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,15 +5,15 @@
|
||||||
#ifndef OPENMW_PACKETSENDMYID_HPP
|
#ifndef OPENMW_PACKETSENDMYID_HPP
|
||||||
#define OPENMW_PACKETSENDMYID_HPP
|
#define OPENMW_PACKETSENDMYID_HPP
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketSendMyID : public BasePacket
|
class PacketSendMyID : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketSendMyID(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketSendMyID(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_USER_MYID;
|
packetID = ID_USER_MYID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketSkill::PacketSkill(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketSkill::PacketSkill(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_SKILL;
|
packetID = ID_GAME_SKILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketSkill::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketSkill::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
for (int i = 0; i < SkillCount; ++i)
|
for (int i = 0; i < SkillCount; ++i)
|
||||||
RW(player->NpcStats()->mSkills[i], send);
|
RW(player->NpcStats()->mSkills[i], send);
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_PACKETSKILL_HPP
|
#define OPENMW_PACKETSKILL_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketSkill : public BasePacket
|
class PacketSkill : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const static int SkillCount = 27;
|
const static int SkillCount = 27;
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
PacketTime::PacketTime(RakNet::RakPeerInterface *peer) : BasePacket(peer)
|
PacketTime::PacketTime(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
|
||||||
{
|
{
|
||||||
packetID = ID_GAME_TIME;
|
packetID = ID_GAME_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketTime::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PacketTime::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
BasePacket::Packet(bs, player, send);
|
PlayerPacket::Packet(bs, player, send);
|
||||||
|
|
||||||
RW(player->month, send);
|
RW(player->month, send);
|
||||||
RW(player->day, send);
|
RW(player->day, send);
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define OPENMW_TIMEPACKET_HPP
|
#define OPENMW_TIMEPACKET_HPP
|
||||||
|
|
||||||
|
|
||||||
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
#include <components/openmw-mp/Packets/PlayerPacket.hpp>
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class PacketTime : public BasePacket
|
class PacketTime : public PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketTime(RakNet::RakPeerInterface *peer);
|
PacketTime(RakNet::RakPeerInterface *peer);
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
//
|
|
||||||
// Created by koncord on 05.01.16.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <components/openmw-mp/NetworkMessages.hpp>
|
#include <components/openmw-mp/NetworkMessages.hpp>
|
||||||
#include <PacketPriority.h>
|
#include <PacketPriority.h>
|
||||||
#include <RakPeer.h>
|
#include <RakPeer.h>
|
||||||
#include "BasePacket.hpp"
|
#include "PlayerPacket.hpp"
|
||||||
|
|
||||||
using namespace mwmp;
|
using namespace mwmp;
|
||||||
|
|
||||||
void BasePacket::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
void PlayerPacket::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
{
|
{
|
||||||
this->player = player;
|
this->player = player;
|
||||||
this->bs = bs;
|
this->bs = bs;
|
||||||
|
@ -21,7 +17,7 @@ void BasePacket::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BasePacket::BasePacket(RakNet::RakPeerInterface *peer)
|
PlayerPacket::PlayerPacket(RakNet::RakPeerInterface *peer)
|
||||||
{
|
{
|
||||||
packetID = 0;
|
packetID = 0;
|
||||||
priority = HIGH_PRIORITY;
|
priority = HIGH_PRIORITY;
|
||||||
|
@ -29,41 +25,41 @@ BasePacket::BasePacket(RakNet::RakPeerInterface *peer)
|
||||||
this->peer = peer;
|
this->peer = peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
BasePacket::~BasePacket()
|
PlayerPacket::~PlayerPacket()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePacket::Send(BasePlayer *player, RakNet::AddressOrGUID destination)
|
void PlayerPacket::Send(BasePlayer *player, RakNet::AddressOrGUID destination)
|
||||||
{
|
{
|
||||||
bsSend->ResetWritePointer();
|
bsSend->ResetWritePointer();
|
||||||
Packet(bsSend, player, true);
|
Packet(bsSend, player, true);
|
||||||
peer->Send(bsSend, priority, reliability, 0, destination, false);
|
peer->Send(bsSend, priority, reliability, 0, destination, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePacket::Send(BasePlayer *player, bool toOther)
|
void PlayerPacket::Send(BasePlayer *player, bool toOther)
|
||||||
{
|
{
|
||||||
bsSend->ResetWritePointer();
|
bsSend->ResetWritePointer();
|
||||||
Packet(bsSend, player, true);
|
Packet(bsSend, player, true);
|
||||||
peer->Send(bsSend, priority, reliability, 0, player->guid, toOther);
|
peer->Send(bsSend, priority, reliability, 0, player->guid, toOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePacket::Read(BasePlayer *player)
|
void PlayerPacket::Read(BasePlayer *player)
|
||||||
{
|
{
|
||||||
Packet(bsRead, player, false);
|
Packet(bsRead, player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePacket::SetReadStream(RakNet::BitStream *bitStream)
|
void PlayerPacket::SetReadStream(RakNet::BitStream *bitStream)
|
||||||
{
|
{
|
||||||
bsRead = bitStream;
|
bsRead = bitStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePacket::SetSendStream(RakNet::BitStream *bitStream)
|
void PlayerPacket::SetSendStream(RakNet::BitStream *bitStream)
|
||||||
{
|
{
|
||||||
bsSend = bitStream;
|
bsSend = bitStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePacket::RequestData(RakNet::RakNetGUID player)
|
void PlayerPacket::RequestData(RakNet::RakNetGUID player)
|
||||||
{
|
{
|
||||||
bsSend->ResetWritePointer();
|
bsSend->ResetWritePointer();
|
||||||
bsSend->Write(packetID);
|
bsSend->Write(packetID);
|
||||||
|
@ -71,7 +67,7 @@ void BasePacket::RequestData(RakNet::RakNetGUID player)
|
||||||
peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, player, false);
|
peer->Send(bsSend, HIGH_PRIORITY, RELIABLE_ORDERED, 0, player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasePacket::SetStreams(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
void PlayerPacket::SetStreams(RakNet::BitStream *inStream, RakNet::BitStream *outStream)
|
||||||
{
|
{
|
||||||
if (inStream != 0)
|
if (inStream != 0)
|
||||||
bsRead = inStream;
|
bsRead = inStream;
|
|
@ -1,9 +1,5 @@
|
||||||
//
|
#ifndef OPENMW_PLAYERPACKET_HPP
|
||||||
// Created by koncord on 05.01.16.
|
#define OPENMW_PLAYERPACKET_HPP
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef OPENMW_BASEPACKET_HPP
|
|
||||||
#define OPENMW_BASEPACKET_HPP
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <RakNetTypes.h>
|
#include <RakNetTypes.h>
|
||||||
|
@ -14,12 +10,12 @@
|
||||||
|
|
||||||
namespace mwmp
|
namespace mwmp
|
||||||
{
|
{
|
||||||
class BasePacket
|
class PlayerPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BasePacket(RakNet::RakPeerInterface *peer);
|
PlayerPacket(RakNet::RakPeerInterface *peer);
|
||||||
|
|
||||||
~BasePacket();
|
~PlayerPacket();
|
||||||
|
|
||||||
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
|
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
|
||||||
|
|
||||||
|
@ -106,4 +102,4 @@ namespace mwmp
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //OPENMW_BASEPACKET_HPP
|
#endif //OPENMW_PLAYERPACKET_HPP
|
|
@ -68,7 +68,7 @@ mwmp::PacketsController::PacketsController(RakNet::RakPeerInterface *peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mwmp::BasePacket *mwmp::PacketsController::GetPacket(RakNet::MessageID id)
|
mwmp::PlayerPacket *mwmp::PacketsController::GetPacket(RakNet::MessageID id)
|
||||||
{
|
{
|
||||||
return packets[(unsigned char)id].get();
|
return packets[(unsigned char)id].get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <RakPeerInterface.h>
|
#include <RakPeerInterface.h>
|
||||||
#include "Packets/BasePacket.hpp"
|
#include "Packets/PlayerPacket.hpp"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PacketsController(RakNet::RakPeerInterface *peer);
|
PacketsController(RakNet::RakPeerInterface *peer);
|
||||||
BasePacket *GetPacket(RakNet::MessageID id);
|
PlayerPacket *GetPacket(RakNet::MessageID id);
|
||||||
void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream);
|
void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream);
|
||||||
|
|
||||||
typedef std::map<unsigned char, boost::shared_ptr<BasePacket> > packets_t;
|
typedef std::map<unsigned char, boost::shared_ptr<PlayerPacket> > packets_t;
|
||||||
private:
|
private:
|
||||||
packets_t packets;
|
packets_t packets;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue