Rename ID_GAME_DYNAMICSTATS_CURRENT into ID_GAME_DYNAMICSTATS

This commit is contained in:
David Cernat 2016-09-28 14:13:24 +03:00
parent 9cbda73586
commit b6086ab015
16 changed files with 50 additions and 111 deletions

View File

@ -259,14 +259,14 @@ void Networking::Update(RakNet::Packet *packet)
#endif #endif
myPacket->Send(player, true); myPacket->Send(player, true);
controller->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->RequestData(player->GetAttack()->target); controller->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(player->GetAttack()->target);
} }
break; break;
} }
case ID_GAME_DYNAMICSTATS_CURRENT: case ID_GAME_DYNAMICSTATS:
{ {
DEBUG_PRINTF("ID_GAME_DYNAMICSTATS_CURRENT\n"); DEBUG_PRINTF("ID_GAME_DYNAMICSTATS\n");
myPacket->Read(player); myPacket->Read(player);
myPacket->Send(player, true); myPacket->Send(player, true);
break; break;
@ -362,7 +362,7 @@ void Networking::Update(RakNet::Packet *packet)
void Networking::NewPlayer(RakNet::RakNetGUID guid) void Networking::NewPlayer(RakNet::RakNetGUID guid)
{ {
controller->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid); controller->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid);
controller->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->RequestData(guid); controller->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(guid);
controller->GetPacket(ID_GAME_POS)->RequestData(guid); controller->GetPacket(ID_GAME_POS)->RequestData(guid);
controller->GetPacket(ID_GAME_CELL)->RequestData(guid); controller->GetPacket(ID_GAME_CELL)->RequestData(guid);
controller->GetPacket(ID_GAME_EQUIPMENT)->RequestData(guid); controller->GetPacket(ID_GAME_EQUIPMENT)->RequestData(guid);
@ -372,7 +372,7 @@ void Networking::NewPlayer(RakNet::RakNetGUID guid)
if (pl->first == guid) continue; if (pl->first == guid) continue;
controller->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid); controller->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(pl->second, guid); controller->GetPacket(ID_GAME_DYNAMICSTATS)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_ATTRIBUTE)->Send(pl->second, guid); controller->GetPacket(ID_GAME_ATTRIBUTE)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_SKILL)->Send(pl->second, guid); controller->GetPacket(ID_GAME_SKILL)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_POS)->Send(pl->second, guid); controller->GetPacket(ID_GAME_POS)->Send(pl->second, guid);

View File

@ -11,13 +11,9 @@
void ItemFunctions::AddItem(unsigned short pid, const char* itemName, unsigned short count) noexcept void ItemFunctions::AddItem(unsigned short pid, const char* itemName, unsigned short count) noexcept
{ {
/*Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, true);*/
LOG_MESSAGE(Log::LOG_WARN, "%s", "stub"); LOG_MESSAGE(Log::LOG_WARN, "%s", "stub");
} }

View File

@ -437,20 +437,12 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true);
} }
void StatsFunctions::SendDynamicStatsBase(unsigned short pid) noexcept void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_BASE)->Send(player, false); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_BASE)->Send(player, true); mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, true);
}
void StatsFunctions::SendDynamicStatsCurrent(unsigned short pid) noexcept
{
Player *player;
GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(player, true);
} }
void StatsFunctions::SendAttributes(unsigned short pid) noexcept void StatsFunctions::SendAttributes(unsigned short pid) noexcept

View File

@ -65,8 +65,7 @@
{"Resurrect", StatsFunctions::Resurrect},\ {"Resurrect", StatsFunctions::Resurrect},\
{"SendBaseInfo", StatsFunctions::SendBaseInfo},\ {"SendBaseInfo", StatsFunctions::SendBaseInfo},\
\ \
{"SendDynamicStatsBase", StatsFunctions::SendDynamicStatsBase}, \ {"SendDynamicStats", StatsFunctions::SendDynamicStats}, \
{"SendDynamicStatsCurrent", StatsFunctions::SendDynamicStatsCurrent}, \
{"SendAttributes", StatsFunctions::SendAttributes},\ {"SendAttributes", StatsFunctions::SendAttributes},\
{"SendSkills", StatsFunctions::SendSkills},\ {"SendSkills", StatsFunctions::SendSkills},\
{"SendLevel", StatsFunctions::SendLevel} {"SendLevel", StatsFunctions::SendLevel}
@ -134,8 +133,7 @@ public:
static void SetCharGenStage(unsigned short pid, int start, int end) noexcept; static void SetCharGenStage(unsigned short pid, int start, int end) noexcept;
static void SendBaseInfo(unsigned short pid) noexcept; static void SendBaseInfo(unsigned short pid) noexcept;
static void SendDynamicStatsBase(unsigned short pid) noexcept; static void SendDynamicStats(unsigned short pid) noexcept;
static void SendDynamicStatsCurrent(unsigned short pid) noexcept;
static void SendAttributes(unsigned short pid) noexcept; static void SendAttributes(unsigned short pid) noexcept;
static void SendSkills(unsigned short pid) noexcept; static void SendSkills(unsigned short pid) noexcept;
static void SendLevel(unsigned short pid) noexcept; static void SendLevel(unsigned short pid) noexcept;

View File

@ -85,7 +85,7 @@ void LocalPlayer::updateDynamicStats(bool forceUpdate)
timer = 0; timer = 0;
GetNetworking()->GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(this); GetNetworking()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(this);
} }
} }

View File

@ -335,7 +335,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
} }
break; break;
} }
case ID_GAME_DYNAMICSTATS_CURRENT: case ID_GAME_DYNAMICSTATS:
{ {
if (id == myid) if (id == myid)
{ {
@ -393,7 +393,7 @@ void Networking::ReceiveMessage(RakNet::Packet *packet)
myPacket->Send(getLocalPlayer(), serverAddr); myPacket->Send(getLocalPlayer(), serverAddr);
getLocalPlayer()->updateDynamicStats(true); getLocalPlayer()->updateDynamicStats(true);
controller.GetPacket(ID_GAME_DYNAMICSTATS_CURRENT)->Send(getLocalPlayer(), serverAddr); controller.GetPacket(ID_GAME_DYNAMICSTATS)->Send(getLocalPlayer(), serverAddr);
} }
else if (pl != 0) else if (pl != 0)
{ {

View File

@ -14,8 +14,7 @@
#include <components/openmw-mp/Packets/PacketBaseInfo.hpp> #include <components/openmw-mp/Packets/PacketBaseInfo.hpp>
#include <components/openmw-mp/Packets/PacketEquipment.hpp> #include <components/openmw-mp/Packets/PacketEquipment.hpp>
#include <components/openmw-mp/Packets/PacketAttack.hpp> #include <components/openmw-mp/Packets/PacketAttack.hpp>
#include <components/openmw-mp/Packets/PacketDynamicStatsBase.hpp> #include <components/openmw-mp/Packets/PacketDynamicStats.hpp>
#include <components/openmw-mp/Packets/PacketDynamicStatsCurrent.hpp>
#include <components/openmw-mp/Packets/PacketResurrect.hpp> #include <components/openmw-mp/Packets/PacketResurrect.hpp>
#include <components/openmw-mp/Packets/PacketDie.hpp> #include <components/openmw-mp/Packets/PacketDie.hpp>
#include <components/openmw-mp/Packets/PacketCell.hpp> #include <components/openmw-mp/Packets/PacketCell.hpp>

View File

@ -149,9 +149,9 @@ add_component_dir (openmw-mp
Log Log
PacketsController PacketsController
Packets/BasePacket Packets/PacketBaseInfo Packets/PacketPosition Packets/PacketEquipment Packets/PacketAttack Packets/BasePacket Packets/PacketBaseInfo Packets/PacketPosition Packets/PacketEquipment Packets/PacketAttack
Packets/PacketDynamicStatsBase Packets/PacketDynamicStatsCurrent Packets/PacketCell Packets/PacketDrawState Packets/PacketDynamicStats Packets/PacketCell Packets/PacketDrawState Packets/PacketChatMessage
Packets/PacketChatMessage Packets/PacketCharGen Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel Packets/PacketCharGen Packets/PacketAttribute Packets/PacketSkill Packets/PacketLevel Packets/PacketHandshake
Packets/PacketHandshake Packets/PacketGUIBoxes Packets/PacketClass Packets/PacketTime) Packets/PacketGUIBoxes Packets/PacketClass Packets/PacketTime)
add_component_dir (fallback add_component_dir (fallback
fallback validate fallback validate

View File

@ -12,8 +12,7 @@ enum GameMessages
ID_GAME_BASE_INFO = ID_USER_PACKET_ENUM+1, ID_GAME_BASE_INFO = ID_USER_PACKET_ENUM+1,
ID_GAME_CHARGEN, ID_GAME_CHARGEN,
ID_GAME_POS, ID_GAME_POS,
ID_GAME_DYNAMICSTATS_BASE, ID_GAME_DYNAMICSTATS,
ID_GAME_DYNAMICSTATS_CURRENT,
ID_GAME_ATTACK, ID_GAME_ATTACK,
ID_USER_MYID, ID_USER_MYID,
ID_GAME_EQUIPMENT, ID_GAME_EQUIPMENT,

View File

@ -2,17 +2,17 @@
// Created by David Cernat on 28.09.16. // Created by David Cernat on 28.09.16.
// //
#include "PacketDynamicStatsBase.hpp" #include "PacketDynamicStats.hpp"
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
using namespace mwmp; using namespace mwmp;
PacketDynamicStatsBase::PacketDynamicStatsBase(RakNet::RakPeerInterface *peer) : BasePacket(peer) PacketDynamicStats::PacketDynamicStats(RakNet::RakPeerInterface *peer) : BasePacket(peer)
{ {
packetID = ID_GAME_DYNAMICSTATS_BASE; packetID = ID_GAME_DYNAMICSTATS;
} }
void PacketDynamicStatsBase::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send) void PacketDynamicStats::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
{ {
BasePacket::Packet(bs, player, send); BasePacket::Packet(bs, player, send);
RW(player->CreatureStats()->mDynamic[0], send); // health RW(player->CreatureStats()->mDynamic[0], send); // health

View File

@ -0,0 +1,22 @@
//
// Created by David Cernat on 28.09.16.
//
#ifndef OPENMW_PACKAGEDYNAMICSTATS_HPP
#define OPENMW_PACKAGEDYNAMICSTATS_HPP
#include <components/openmw-mp/Packets/BasePacket.hpp>
namespace mwmp
{
class PacketDynamicStats : public BasePacket
{
public:
PacketDynamicStats(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKAGEDYNAMICSTATS_HPP

View File

@ -1,22 +0,0 @@
//
// Created by David Cernat on 28.09.16.
//
#ifndef OPENMW_PACKAGEDYNAMICSTATSBASE_HPP
#define OPENMW_PACKAGEDYNAMICSTATSBASE_HPP
#include <components/openmw-mp/Packets/BasePacket.hpp>
namespace mwmp
{
class PacketDynamicStatsBase : public BasePacket
{
public:
PacketDynamicStatsBase(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKAGEDYNAMICSTATSBASE_HPP

View File

@ -1,21 +0,0 @@
//
// Created by David Cernat on 28.09.16.
//
#include "PacketDynamicStatsCurrent.hpp"
#include <components/openmw-mp/NetworkMessages.hpp>
using namespace mwmp;
PacketDynamicStatsCurrent::PacketDynamicStatsCurrent(RakNet::RakPeerInterface *peer) : BasePacket(peer)
{
packetID = ID_GAME_DYNAMICSTATS_CURRENT;
}
void PacketDynamicStatsCurrent::Packet(RakNet::BitStream *bs, BasePlayer *player, bool send)
{
BasePacket::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
}

View File

@ -1,22 +0,0 @@
//
// Created by David Cernat on 28.09.16.
//
#ifndef OPENMW_PACKAGEDYNAMICSTATSCURRENT_HPP
#define OPENMW_PACKAGEDYNAMICSTATSCURRENT_HPP
#include <components/openmw-mp/Packets/BasePacket.hpp>
namespace mwmp
{
class PacketDynamicStatsCurrent : public BasePacket
{
public:
PacketDynamicStatsCurrent(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKAGEDYNAMICSTATSCURRENT_HPP

View File

@ -2,8 +2,8 @@
// Created by koncord on 07.01.16. // Created by koncord on 07.01.16.
// //
#ifndef OPENMW_PACKETCONTAINER_HPP #ifndef OPENMW_PACKETEQUIPMENT_HPP
#define OPENMW_PACKETCONTAINER_HPP #define OPENMW_PACKETEQUIPMENT_HPP
#include <components/openmw-mp/Packets/BasePacket.hpp> #include <components/openmw-mp/Packets/BasePacket.hpp>
@ -18,4 +18,4 @@ namespace mwmp
}; };
} }
#endif //OPENMW_PACKETCONTAINER_HPP #endif //OPENMW_PACKETEQUIPMENT_HPP

View File

@ -11,8 +11,7 @@
#include "Packets/PacketBaseInfo.hpp" #include "Packets/PacketBaseInfo.hpp"
#include "components/openmw-mp/Packets/PacketEquipment.hpp" #include "components/openmw-mp/Packets/PacketEquipment.hpp"
#include "Packets/PacketAttack.hpp" #include "Packets/PacketAttack.hpp"
#include "Packets/PacketDynamicStatsBase.hpp" #include "Packets/PacketDynamicStats.hpp"
#include "Packets/PacketDynamicStatsCurrent.hpp"
#include "Packets/PacketResurrect.hpp" #include "Packets/PacketResurrect.hpp"
#include "Packets/PacketDie.hpp" #include "Packets/PacketDie.hpp"
#include "Packets/PacketCell.hpp" #include "Packets/PacketCell.hpp"
@ -47,8 +46,7 @@ mwmp::PacketsController::PacketsController(RakNet::RakPeerInterface *peer)
AddPacket<PacketEquipment>(&packets, peer); AddPacket<PacketEquipment>(&packets, peer);
AddPacket<PacketAttack>(&packets, peer); AddPacket<PacketAttack>(&packets, peer);
AddPacket<PacketDynamicStatsBase>(&packets, peer); AddPacket<PacketDynamicStats>(&packets, peer);
AddPacket<PacketDynamicStatsCurrent>(&packets, peer);
AddPacket<PacketResurrect>(&packets, peer); AddPacket<PacketResurrect>(&packets, peer);
AddPacket<PacketDie>(&packets, peer); AddPacket<PacketDie>(&packets, peer);