diff --git a/apps/openmw-mp/Networking.cpp b/apps/openmw-mp/Networking.cpp index f6b705376..ed5506820 100644 --- a/apps/openmw-mp/Networking.cpp +++ b/apps/openmw-mp/Networking.cpp @@ -69,7 +69,7 @@ void Networking::Update(RakNet::Packet *packet) return; } - BasePacket *myPacket = controller->GetPacket(packet->data[0]); + PlayerPacket *myPacket = controller->GetPacket(packet->data[0]); if (packet->data[0] == ID_HANDSHAKE) { diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index a69c39e2a..d14945545 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -178,7 +178,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet) if (id != myid) pl = Players::GetPlayer(id); - BasePacket *myPacket = controller.GetPacket(packet->data[0]); + PlayerPacket *myPacket = controller.GetPacket(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); } diff --git a/apps/openmw/mwmp/Networking.hpp b/apps/openmw/mwmp/Networking.hpp index 41e6338ae..430a6d849 100644 --- a/apps/openmw/mwmp/Networking.hpp +++ b/apps/openmw/mwmp/Networking.hpp @@ -33,7 +33,7 @@ namespace mwmp void Connect(const std::string& ip, unsigned short port); void Update(); void SendData(RakNet::BitStream *bitStream); - BasePacket *GetPacket(RakNet::MessageID id); + PlayerPacket *GetPacket(RakNet::MessageID id); bool isDedicatedPlayer(const MWWorld::Ptr &ptr); bool Attack(const MWWorld::Ptr &ptr); diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index dee4f4a54..a5574e106 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -148,7 +148,7 @@ add_component_dir (version add_component_dir (openmw-mp Log 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/PacketCharGen Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel Packets/PacketHandshake Packets/PacketGUIBoxes Packets/PacketClass Packets/PacketTime) diff --git a/components/openmw-mp/Packets/PacketAttack.cpp b/components/openmw-mp/Packets/PacketAttack.cpp index 44c1326dd..25108822b 100644 --- a/components/openmw-mp/Packets/PacketAttack.cpp +++ b/components/openmw-mp/Packets/PacketAttack.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketAttack::PacketAttack(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketAttack::PacketAttack(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_ATTACK; } 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()->target, send); diff --git a/components/openmw-mp/Packets/PacketAttack.hpp b/components/openmw-mp/Packets/PacketAttack.hpp index 2b2719024..cbc64bcca 100644 --- a/components/openmw-mp/Packets/PacketAttack.hpp +++ b/components/openmw-mp/Packets/PacketAttack.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKETATTACK_HPP -#include +#include namespace mwmp { - class PacketAttack : public BasePacket + class PacketAttack : public PlayerPacket { public: PacketAttack(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketAttribute.cpp b/components/openmw-mp/Packets/PacketAttribute.cpp index 7a82359da..95e3ee22d 100644 --- a/components/openmw-mp/Packets/PacketAttribute.cpp +++ b/components/openmw-mp/Packets/PacketAttribute.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketAttribute::PacketAttribute(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketAttribute::PacketAttribute(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_ATTRIBUTE; } 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) RW(player->CreatureStats()->mAttributes[i], send); diff --git a/components/openmw-mp/Packets/PacketAttribute.hpp b/components/openmw-mp/Packets/PacketAttribute.hpp index b50f49588..461587f23 100644 --- a/components/openmw-mp/Packets/PacketAttribute.hpp +++ b/components/openmw-mp/Packets/PacketAttribute.hpp @@ -5,11 +5,11 @@ #ifndef OPENMW_PACKETATTRIBUTE_HPP #define OPENMW_PACKETATTRIBUTE_HPP -#include +#include namespace mwmp { - class PacketAttribute : public BasePacket + class PacketAttribute : public PlayerPacket { public: const static int AttributeCount = 8; diff --git a/components/openmw-mp/Packets/PacketBaseInfo.cpp b/components/openmw-mp/Packets/PacketBaseInfo.cpp index bdae0b2f3..0ef792c9f 100644 --- a/components/openmw-mp/Packets/PacketBaseInfo.cpp +++ b/components/openmw-mp/Packets/PacketBaseInfo.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketBaseInfo::PacketBaseInfo(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketBaseInfo::PacketBaseInfo(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_BASE_INFO; } 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()->mModel, send); diff --git a/components/openmw-mp/Packets/PacketBaseInfo.hpp b/components/openmw-mp/Packets/PacketBaseInfo.hpp index cdddbebd6..4b7e33896 100644 --- a/components/openmw-mp/Packets/PacketBaseInfo.hpp +++ b/components/openmw-mp/Packets/PacketBaseInfo.hpp @@ -5,11 +5,11 @@ #ifndef OPENMW_PACKETBASEINFO_HPP #define OPENMW_PACKETBASEINFO_HPP -#include +#include namespace mwmp { - class PacketBaseInfo : public BasePacket + class PacketBaseInfo : public PlayerPacket { public: PacketBaseInfo(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketCell.cpp b/components/openmw-mp/Packets/PacketCell.cpp index ce23c033e..991774382 100644 --- a/components/openmw-mp/Packets/PacketCell.cpp +++ b/components/openmw-mp/Packets/PacketCell.cpp @@ -6,7 +6,7 @@ #include "PacketCell.hpp" -mwmp::PacketCell::PacketCell(RakNet::RakPeerInterface *peer) : BasePacket(peer) +mwmp::PacketCell::PacketCell(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_CELL; 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) { - BasePacket::Packet(bs, player, send); + PlayerPacket::Packet(bs, player, send); RW(player->GetCell()->mData.mFlags, send); diff --git a/components/openmw-mp/Packets/PacketCell.hpp b/components/openmw-mp/Packets/PacketCell.hpp index 73ab333ea..74ca1faab 100644 --- a/components/openmw-mp/Packets/PacketCell.hpp +++ b/components/openmw-mp/Packets/PacketCell.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKETCELL_HPP -#include +#include namespace mwmp { - class PacketCell : public BasePacket + class PacketCell : public PlayerPacket { public: PacketCell(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketCharGen.cpp b/components/openmw-mp/Packets/PacketCharGen.cpp index 09ab231b2..5637eb5be 100644 --- a/components/openmw-mp/Packets/PacketCharGen.cpp +++ b/components/openmw-mp/Packets/PacketCharGen.cpp @@ -5,14 +5,14 @@ #include #include "PacketCharGen.hpp" -mwmp::PacketCharGen::PacketCharGen(RakNet::RakPeerInterface *peer) : BasePacket(peer) +mwmp::PacketCharGen::PacketCharGen(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_CHARGEN; } 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); diff --git a/components/openmw-mp/Packets/PacketCharGen.hpp b/components/openmw-mp/Packets/PacketCharGen.hpp index 899380224..c9d51f9e1 100644 --- a/components/openmw-mp/Packets/PacketCharGen.hpp +++ b/components/openmw-mp/Packets/PacketCharGen.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKETCHARGEN_HPP -#include +#include namespace mwmp { - class PacketCharGen : public BasePacket + class PacketCharGen : public PlayerPacket { public: PacketCharGen(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketChatMessage.cpp b/components/openmw-mp/Packets/PacketChatMessage.cpp index 94e494cf0..297cc7cce 100644 --- a/components/openmw-mp/Packets/PacketChatMessage.cpp +++ b/components/openmw-mp/Packets/PacketChatMessage.cpp @@ -5,14 +5,14 @@ #include #include "PacketChatMessage.hpp" -mwmp::PacketChatMessage::PacketChatMessage(RakNet::RakPeerInterface *peer) : BasePacket(peer) +mwmp::PacketChatMessage::PacketChatMessage(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_CHAT_MESSAGE; } 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); } diff --git a/components/openmw-mp/Packets/PacketChatMessage.hpp b/components/openmw-mp/Packets/PacketChatMessage.hpp index a4b67c624..0decedd65 100644 --- a/components/openmw-mp/Packets/PacketChatMessage.hpp +++ b/components/openmw-mp/Packets/PacketChatMessage.hpp @@ -5,11 +5,11 @@ #ifndef OPENMW_PACKETCHATMESSAGE_HPP #define OPENMW_PACKETCHATMESSAGE_HPP -#include +#include namespace mwmp { - class PacketChatMessage : public BasePacket + class PacketChatMessage : public PlayerPacket { public: PacketChatMessage(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketClass.cpp b/components/openmw-mp/Packets/PacketClass.cpp index d9c7225f6..c1be651c1 100644 --- a/components/openmw-mp/Packets/PacketClass.cpp +++ b/components/openmw-mp/Packets/PacketClass.cpp @@ -5,14 +5,14 @@ #include #include "PacketClass.hpp" -mwmp::PacketClass::PacketClass(RakNet::RakPeerInterface *peer) : BasePacket(peer) +mwmp::PacketClass::PacketClass(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_CHARCLASS; } 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); if (player->charClass.mId.empty()) // custom class diff --git a/components/openmw-mp/Packets/PacketClass.hpp b/components/openmw-mp/Packets/PacketClass.hpp index 27db8529b..6ae1dea8e 100644 --- a/components/openmw-mp/Packets/PacketClass.hpp +++ b/components/openmw-mp/Packets/PacketClass.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKETCLASS_HPP -#include +#include namespace mwmp { - class PacketClass : public BasePacket + class PacketClass : public PlayerPacket { public: PacketClass(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketDie.hpp b/components/openmw-mp/Packets/PacketDie.hpp index d48729203..15622465c 100644 --- a/components/openmw-mp/Packets/PacketDie.hpp +++ b/components/openmw-mp/Packets/PacketDie.hpp @@ -6,21 +6,21 @@ #define OPENMW_PACKETDIE_HPP -#include +#include #include namespace mwmp { - class PacketDie: public BasePacket + class PacketDie: public PlayerPacket { public: - PacketDie(RakNet::RakPeerInterface *peer) : BasePacket(peer) + PacketDie(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_DIE; } void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { - BasePacket::Packet(bs, player, send); + PlayerPacket::Packet(bs, player, send); RW(player->CreatureStats()->mDead, send); } }; diff --git a/components/openmw-mp/Packets/PacketDisconnect.hpp b/components/openmw-mp/Packets/PacketDisconnect.hpp index 28140176f..154a31f32 100644 --- a/components/openmw-mp/Packets/PacketDisconnect.hpp +++ b/components/openmw-mp/Packets/PacketDisconnect.hpp @@ -5,15 +5,15 @@ #ifndef OPENMW_PACKETDISCONNECT_HPP #define OPENMW_PACKETDISCONNECT_HPP -#include +#include #include namespace mwmp { - class PacketDisconnect : public BasePacket + class PacketDisconnect : public PlayerPacket { public: - PacketDisconnect(RakNet::RakPeerInterface *peer) : BasePacket(peer) + PacketDisconnect(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_USER_DISCONNECTED; } diff --git a/components/openmw-mp/Packets/PacketDrawState.cpp b/components/openmw-mp/Packets/PacketDrawState.cpp index 4ea9403b0..6eea9f939 100644 --- a/components/openmw-mp/Packets/PacketDrawState.cpp +++ b/components/openmw-mp/Packets/PacketDrawState.cpp @@ -5,14 +5,14 @@ #include #include "PacketDrawState.hpp" -mwmp::PacketDrawState::PacketDrawState(RakNet::RakPeerInterface *peer) : BasePacket(peer) +mwmp::PacketDrawState::PacketDrawState(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_DRAWSTATE; } 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); diff --git a/components/openmw-mp/Packets/PacketDrawState.hpp b/components/openmw-mp/Packets/PacketDrawState.hpp index 569a4a399..c1fb4b991 100644 --- a/components/openmw-mp/Packets/PacketDrawState.hpp +++ b/components/openmw-mp/Packets/PacketDrawState.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKETDRAWSTATE_HPP -#include +#include namespace mwmp { - class PacketDrawState : public BasePacket + class PacketDrawState : public PlayerPacket { public: PacketDrawState(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketDynamicStats.cpp b/components/openmw-mp/Packets/PacketDynamicStats.cpp index 1811ead9d..aecd78b6e 100644 --- a/components/openmw-mp/Packets/PacketDynamicStats.cpp +++ b/components/openmw-mp/Packets/PacketDynamicStats.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketDynamicStats::PacketDynamicStats(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketDynamicStats::PacketDynamicStats(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_DYNAMICSTATS; } 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[1], send); // magic RW(player->CreatureStats()->mDynamic[2], send); // fatigue diff --git a/components/openmw-mp/Packets/PacketDynamicStats.hpp b/components/openmw-mp/Packets/PacketDynamicStats.hpp index e6be46c34..c4c8e8ff2 100644 --- a/components/openmw-mp/Packets/PacketDynamicStats.hpp +++ b/components/openmw-mp/Packets/PacketDynamicStats.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKAGEDYNAMICSTATS_HPP -#include +#include namespace mwmp { - class PacketDynamicStats : public BasePacket + class PacketDynamicStats : public PlayerPacket { public: PacketDynamicStats(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketEquipment.cpp b/components/openmw-mp/Packets/PacketEquipment.cpp index 8d3afdb38..48a93103b 100644 --- a/components/openmw-mp/Packets/PacketEquipment.cpp +++ b/components/openmw-mp/Packets/PacketEquipment.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketEquipment::PacketEquipment(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketEquipment::PacketEquipment(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_EQUIPMENT; } 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++) { diff --git a/components/openmw-mp/Packets/PacketEquipment.hpp b/components/openmw-mp/Packets/PacketEquipment.hpp index 6ad05e4da..5b677f555 100644 --- a/components/openmw-mp/Packets/PacketEquipment.hpp +++ b/components/openmw-mp/Packets/PacketEquipment.hpp @@ -5,11 +5,11 @@ #ifndef OPENMW_PACKETEQUIPMENT_HPP #define OPENMW_PACKETEQUIPMENT_HPP -#include +#include namespace mwmp { - class PacketEquipment : public BasePacket + class PacketEquipment : public PlayerPacket { public: PacketEquipment(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketGUIBoxes.cpp b/components/openmw-mp/Packets/PacketGUIBoxes.cpp index 4bd014edd..18c4764c7 100644 --- a/components/openmw-mp/Packets/PacketGUIBoxes.cpp +++ b/components/openmw-mp/Packets/PacketGUIBoxes.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketGUIBoxes::PacketGUIBoxes(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketGUIBoxes::PacketGUIBoxes(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GUI_MESSAGEBOX; } 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.type, send); diff --git a/components/openmw-mp/Packets/PacketGUIBoxes.hpp b/components/openmw-mp/Packets/PacketGUIBoxes.hpp index 06a353a04..ace0bf771 100644 --- a/components/openmw-mp/Packets/PacketGUIBoxes.hpp +++ b/components/openmw-mp/Packets/PacketGUIBoxes.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKETGUIBOXES_HPP -#include +#include namespace mwmp { - class PacketGUIBoxes : public BasePacket + class PacketGUIBoxes : public PlayerPacket { public: PacketGUIBoxes(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketHandshake.cpp b/components/openmw-mp/Packets/PacketHandshake.cpp index ba30278ae..7d40c6f17 100644 --- a/components/openmw-mp/Packets/PacketHandshake.cpp +++ b/components/openmw-mp/Packets/PacketHandshake.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketHandshake::PacketHandshake(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketHandshake::PacketHandshake(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_HANDSHAKE; } 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->GetPassw(), send); } diff --git a/components/openmw-mp/Packets/PacketHandshake.hpp b/components/openmw-mp/Packets/PacketHandshake.hpp index 195b714ff..b5846d433 100644 --- a/components/openmw-mp/Packets/PacketHandshake.hpp +++ b/components/openmw-mp/Packets/PacketHandshake.hpp @@ -5,11 +5,11 @@ #ifndef OPENMW_PACKETHANDSHAKE_HPP #define OPENMW_PACKETHANDSHAKE_HPP -#include +#include namespace mwmp { - class PacketHandshake : public BasePacket + class PacketHandshake : public PlayerPacket { public: PacketHandshake(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketLevel.cpp b/components/openmw-mp/Packets/PacketLevel.cpp index 9a614039e..de78cd6f1 100644 --- a/components/openmw-mp/Packets/PacketLevel.cpp +++ b/components/openmw-mp/Packets/PacketLevel.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketLevel::PacketLevel(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketLevel::PacketLevel(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_LEVEL; } 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); } diff --git a/components/openmw-mp/Packets/PacketLevel.hpp b/components/openmw-mp/Packets/PacketLevel.hpp index e424bd61e..aa61dcc10 100644 --- a/components/openmw-mp/Packets/PacketLevel.hpp +++ b/components/openmw-mp/Packets/PacketLevel.hpp @@ -5,11 +5,11 @@ #ifndef OPENMW_PACKETLEVEL_HPP #define OPENMW_PACKETLEVEL_HPP -#include +#include namespace mwmp { - class PacketLevel : public BasePacket + class PacketLevel : public PlayerPacket { public: PacketLevel(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketLoaded.hpp b/components/openmw-mp/Packets/PacketLoaded.hpp index 6e8d317c6..35565150d 100644 --- a/components/openmw-mp/Packets/PacketLoaded.hpp +++ b/components/openmw-mp/Packets/PacketLoaded.hpp @@ -5,14 +5,14 @@ #ifndef OPENMW_PACKETLOADED_HPP #define OPENMW_PACKETLOADED_HPP -#include +#include namespace mwmp { - class PacketLoaded : public BasePacket + class PacketLoaded : public PlayerPacket { public: - PacketLoaded(RakNet::RakPeerInterface *peer) : BasePacket(peer) + PacketLoaded(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_LOADED; } diff --git a/components/openmw-mp/Packets/PacketPosition.cpp b/components/openmw-mp/Packets/PacketPosition.cpp index c1ded2814..09c328e49 100644 --- a/components/openmw-mp/Packets/PacketPosition.cpp +++ b/components/openmw-mp/Packets/PacketPosition.cpp @@ -8,7 +8,7 @@ using namespace std; using namespace mwmp; -PacketPosition::PacketPosition(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketPosition::PacketPosition(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_POS; priority = MEDIUM_PRIORITY; @@ -17,7 +17,7 @@ PacketPosition::PacketPosition(RakNet::RakPeerInterface *peer) : BasePacket(peer 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->Dir(), send); diff --git a/components/openmw-mp/Packets/PacketPosition.hpp b/components/openmw-mp/Packets/PacketPosition.hpp index 4eeeeea76..d15baa946 100644 --- a/components/openmw-mp/Packets/PacketPosition.hpp +++ b/components/openmw-mp/Packets/PacketPosition.hpp @@ -5,11 +5,11 @@ #ifndef OPENMW_PACKETPOSITION_HPP #define OPENMW_PACKETPOSITION_HPP -#include +#include namespace mwmp { - class PacketPosition : public BasePacket + class PacketPosition : public PlayerPacket { public: PacketPosition(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/PacketResurrect.hpp b/components/openmw-mp/Packets/PacketResurrect.hpp index cd68ad3a3..4588fbbfd 100644 --- a/components/openmw-mp/Packets/PacketResurrect.hpp +++ b/components/openmw-mp/Packets/PacketResurrect.hpp @@ -6,21 +6,21 @@ #define OPENMW_PACKETRESURRECT_HPP -#include +#include #include namespace mwmp { - class PacketResurrect: public BasePacket + class PacketResurrect: public PlayerPacket { public: - PacketResurrect(RakNet::RakPeerInterface *peer) : BasePacket(peer) + PacketResurrect(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_RESURRECT; } void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) { - BasePacket::Packet(bs, player, send); + PlayerPacket::Packet(bs, player, send); RW(player->CreatureStats()->mDead, send); } }; diff --git a/components/openmw-mp/Packets/PacketSendMyID.hpp b/components/openmw-mp/Packets/PacketSendMyID.hpp index 7ce4253fd..32ddbe8c9 100644 --- a/components/openmw-mp/Packets/PacketSendMyID.hpp +++ b/components/openmw-mp/Packets/PacketSendMyID.hpp @@ -5,15 +5,15 @@ #ifndef OPENMW_PACKETSENDMYID_HPP #define OPENMW_PACKETSENDMYID_HPP -#include +#include #include namespace mwmp { - class PacketSendMyID : public BasePacket + class PacketSendMyID : public PlayerPacket { public: - PacketSendMyID(RakNet::RakPeerInterface *peer) : BasePacket(peer) + PacketSendMyID(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_USER_MYID; } diff --git a/components/openmw-mp/Packets/PacketSkill.cpp b/components/openmw-mp/Packets/PacketSkill.cpp index f4ff175de..c1d1bca5a 100644 --- a/components/openmw-mp/Packets/PacketSkill.cpp +++ b/components/openmw-mp/Packets/PacketSkill.cpp @@ -9,14 +9,14 @@ using namespace mwmp; -PacketSkill::PacketSkill(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketSkill::PacketSkill(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_SKILL; } 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) RW(player->NpcStats()->mSkills[i], send); diff --git a/components/openmw-mp/Packets/PacketSkill.hpp b/components/openmw-mp/Packets/PacketSkill.hpp index ebf684104..3f58db341 100644 --- a/components/openmw-mp/Packets/PacketSkill.hpp +++ b/components/openmw-mp/Packets/PacketSkill.hpp @@ -6,11 +6,11 @@ #define OPENMW_PACKETSKILL_HPP -#include +#include namespace mwmp { - class PacketSkill : public BasePacket + class PacketSkill : public PlayerPacket { public: const static int SkillCount = 27; diff --git a/components/openmw-mp/Packets/PacketTime.cpp b/components/openmw-mp/Packets/PacketTime.cpp index d6e79f214..3ded3e7ee 100644 --- a/components/openmw-mp/Packets/PacketTime.cpp +++ b/components/openmw-mp/Packets/PacketTime.cpp @@ -7,14 +7,14 @@ using namespace mwmp; -PacketTime::PacketTime(RakNet::RakPeerInterface *peer) : BasePacket(peer) +PacketTime::PacketTime(RakNet::RakPeerInterface *peer) : PlayerPacket(peer) { packetID = ID_GAME_TIME; } 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->day, send); diff --git a/components/openmw-mp/Packets/PacketTime.hpp b/components/openmw-mp/Packets/PacketTime.hpp index 3835e17dd..bb7521ff8 100644 --- a/components/openmw-mp/Packets/PacketTime.hpp +++ b/components/openmw-mp/Packets/PacketTime.hpp @@ -6,11 +6,11 @@ #define OPENMW_TIMEPACKET_HPP -#include +#include namespace mwmp { - class PacketTime : public BasePacket + class PacketTime : public PlayerPacket { public: PacketTime(RakNet::RakPeerInterface *peer); diff --git a/components/openmw-mp/Packets/BasePacket.cpp b/components/openmw-mp/Packets/PlayerPacket.cpp similarity index 60% rename from components/openmw-mp/Packets/BasePacket.cpp rename to components/openmw-mp/Packets/PlayerPacket.cpp index 5fedca21e..08ef332af 100644 --- a/components/openmw-mp/Packets/BasePacket.cpp +++ b/components/openmw-mp/Packets/PlayerPacket.cpp @@ -1,15 +1,11 @@ -// -// Created by koncord on 05.01.16. -// - #include #include #include -#include "BasePacket.hpp" +#include "PlayerPacket.hpp" 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->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; priority = HIGH_PRIORITY; @@ -29,41 +25,41 @@ BasePacket::BasePacket(RakNet::RakPeerInterface *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(); Packet(bsSend, player, true); peer->Send(bsSend, priority, reliability, 0, destination, false); } -void BasePacket::Send(BasePlayer *player, bool toOther) +void PlayerPacket::Send(BasePlayer *player, bool toOther) { bsSend->ResetWritePointer(); Packet(bsSend, player, true); peer->Send(bsSend, priority, reliability, 0, player->guid, toOther); } -void BasePacket::Read(BasePlayer *player) +void PlayerPacket::Read(BasePlayer *player) { Packet(bsRead, player, false); } -void BasePacket::SetReadStream(RakNet::BitStream *bitStream) +void PlayerPacket::SetReadStream(RakNet::BitStream *bitStream) { bsRead = bitStream; } -void BasePacket::SetSendStream(RakNet::BitStream *bitStream) +void PlayerPacket::SetSendStream(RakNet::BitStream *bitStream) { bsSend = bitStream; } -void BasePacket::RequestData(RakNet::RakNetGUID player) +void PlayerPacket::RequestData(RakNet::RakNetGUID player) { bsSend->ResetWritePointer(); bsSend->Write(packetID); @@ -71,7 +67,7 @@ void BasePacket::RequestData(RakNet::RakNetGUID player) 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) bsRead = inStream; diff --git a/components/openmw-mp/Packets/BasePacket.hpp b/components/openmw-mp/Packets/PlayerPacket.hpp similarity index 91% rename from components/openmw-mp/Packets/BasePacket.hpp rename to components/openmw-mp/Packets/PlayerPacket.hpp index a0410e027..fe45f1e23 100644 --- a/components/openmw-mp/Packets/BasePacket.hpp +++ b/components/openmw-mp/Packets/PlayerPacket.hpp @@ -1,9 +1,5 @@ -// -// Created by koncord on 05.01.16. -// - -#ifndef OPENMW_BASEPACKET_HPP -#define OPENMW_BASEPACKET_HPP +#ifndef OPENMW_PLAYERPACKET_HPP +#define OPENMW_PLAYERPACKET_HPP #include #include @@ -14,12 +10,12 @@ namespace mwmp { - class BasePacket + class PlayerPacket { public: - BasePacket(RakNet::RakPeerInterface *peer); + PlayerPacket(RakNet::RakPeerInterface *peer); - ~BasePacket(); + ~PlayerPacket(); virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send); @@ -106,4 +102,4 @@ namespace mwmp }; } -#endif //OPENMW_BASEPACKET_HPP +#endif //OPENMW_PLAYERPACKET_HPP diff --git a/components/openmw-mp/PacketsController.cpp b/components/openmw-mp/PacketsController.cpp index c53ba388b..e27f33c4d 100644 --- a/components/openmw-mp/PacketsController.cpp +++ b/components/openmw-mp/PacketsController.cpp @@ -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(); } diff --git a/components/openmw-mp/PacketsController.hpp b/components/openmw-mp/PacketsController.hpp index 822b2def0..f112743cf 100644 --- a/components/openmw-mp/PacketsController.hpp +++ b/components/openmw-mp/PacketsController.hpp @@ -7,7 +7,7 @@ #include -#include "Packets/BasePacket.hpp" +#include "Packets/PlayerPacket.hpp" #include #include @@ -17,10 +17,10 @@ namespace mwmp { public: PacketsController(RakNet::RakPeerInterface *peer); - BasePacket *GetPacket(RakNet::MessageID id); + PlayerPacket *GetPacket(RakNet::MessageID id); void SetStream(RakNet::BitStream *inStream, RakNet::BitStream *outStream); - typedef std::map > packets_t; + typedef std::map > packets_t; private: packets_t packets; };