[General] Turn ID_PLAYER_CELL_LOAD into ID_PLAYER_CELL_STATE for clarity

coverity_scan^2
David Cernat 8 years ago
parent 055376c8ee
commit 244da19a51

@ -171,9 +171,9 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
break;
}
case ID_PLAYER_CELL_LOAD:
case ID_PLAYER_CELL_STATE:
{
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_CELL_LOAD from %s",
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_CELL_STATE from %s",
player->npc.mName.c_str());
Script::Call<Script::CallbackIdentity("OnPlayerCellLoad")>(player->getId());

@ -1070,22 +1070,22 @@ void LocalPlayer::sendJournalIndex(const std::string& quest, int index)
void LocalPlayer::sendCellLoad(ESM::Cell cellLoaded)
{
cellLoadChanges.cells.clear();
cellStateChanges.cells.clear();
cellLoadChanges.cells.push_back(cellLoaded);
cellStateChanges.cells.push_back(cellLoaded);
cellLoadChanges.action = CellLoadChanges::LOAD;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_CELL_LOAD)->Send(this);
cellStateChanges.action = CellStateChanges::LOAD;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_CELL_STATE)->Send(this);
}
void LocalPlayer::sendCellUnload(ESM::Cell cellUnloaded)
{
cellLoadChanges.cells.clear();
cellStateChanges.cells.clear();
cellLoadChanges.cells.push_back(cellUnloaded);
cellStateChanges.cells.push_back(cellUnloaded);
cellLoadChanges.action = CellLoadChanges::UNLOAD;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_CELL_LOAD)->Send(this);
cellStateChanges.action = CellStateChanges::UNLOAD;
Main::get().getNetworking()->getPlayerPacket(ID_PLAYER_CELL_STATE)->Send(this);
}
void LocalPlayer::sendAttack(Attack::TYPE type)

@ -532,7 +532,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
}
break;
}
case ID_PLAYER_CELL_LOAD:
case ID_PLAYER_CELL_STATE:
{
break;
}

@ -159,7 +159,7 @@ add_component_dir (openmw-mp
Packets/Player/PacketGUIBoxes Packets/Player/PacketClass Packets/Player/PacketTime
Packets/Player/PacketInventory Packets/Player/PacketSpellbook Packets/Player/PacketJournal
Packets/Player/PacketActiveSkills Packets/Player/PacketPlayerCellChange
Packets/Player/PacketPlayerCellLoad
Packets/Player/PacketPlayerCellState
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectLock
Packets/World/PacketObjectUnlock Packets/World/PacketObjectScale Packets/World/PacketObjectMove

@ -94,7 +94,7 @@ namespace mwmp
int action; //0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
};
struct CellLoadChanges
struct CellStateChanges
{
std::vector<ESM::Cell> cells;
unsigned int count;
@ -157,7 +157,7 @@ namespace mwmp
InventoryChanges inventoryChanges;
SpellbookChanges spellbookChanges;
JournalChanges journalChanges;
CellLoadChanges cellLoadChanges;
CellStateChanges cellStateChanges;
bool consoleAllowed;
bool ignorePosPacket;
ESM::ActiveSpells activeSpells;

@ -5,7 +5,7 @@
#include "../Packets/Player/PacketClass.hpp"
#include "../Packets/Player/PacketPosition.hpp"
#include "../Packets/Player/PacketPlayerCellChange.hpp"
#include "../Packets/Player/PacketPlayerCellLoad.hpp"
#include "../Packets/Player/PacketPlayerCellState.hpp"
#include "../Packets/Player/PacketBaseInfo.hpp"
#include "../Packets/Player/PacketEquipment.hpp"
#include "../Packets/Player/PacketAttack.hpp"
@ -44,7 +44,7 @@ mwmp::PlayerPacketController::PlayerPacketController(RakNet::RakPeerInterface *p
{
AddPacket<PacketPosition>(&packets, peer);
AddPacket<PacketPlayerCellChange>(&packets, peer);
AddPacket<PacketPlayerCellLoad>(&packets, peer);
AddPacket<PacketPlayerCellState>(&packets, peer);
AddPacket<PacketBaseInfo>(&packets, peer);
AddPacket<PacketEquipment>(&packets, peer);

@ -37,7 +37,7 @@ enum GameMessages
ID_GAME_ACTIVESKILLS,
ID_PLAYER_CELL_CHANGE,
ID_PLAYER_CELL_LOAD,
ID_PLAYER_CELL_STATE,
ID_OBJECT_PLACE,
ID_OBJECT_DELETE,

@ -1,44 +0,0 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerCellLoad.hpp"
mwmp::PacketPlayerCellLoad::PacketPlayerCellLoad(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_CELL_LOAD;
priority = IMMEDIATE_PRIORITY;
reliability = RELIABLE_ORDERED;
}
void mwmp::PacketPlayerCellLoad::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
{
PlayerPacket::Packet(bs, player, send);
RW(player->cellLoadChanges.action, send);
if (!send)
player->cellLoadChanges.cells.clear();
else
player->cellLoadChanges.count = (unsigned int)(player->cellLoadChanges.cells.size());
RW(player->cellLoadChanges.count, send);
for (unsigned int i = 0; i < player->cellLoadChanges.count; i++)
{
ESM::Cell cellLoaded;
if (send)
{
cellLoaded = player->cellLoadChanges.cells[i];
}
RW(cellLoaded.mData.mFlags, send);
RW(cellLoaded.mData.mX, send);
RW(cellLoaded.mData.mY, send);
RW(cellLoaded.mName, send);
if (!send)
{
player->cellLoadChanges.cells.push_back(cellLoaded);
}
}
}

@ -1,20 +0,0 @@
#ifndef OPENMW_PACKETPLAYERCELLLOAD_HPP
#define OPENMW_PACKETPLAYERCELLLOAD_HPP
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
namespace mwmp
{
class PacketPlayerCellLoad : public PlayerPacket
{
public:
PacketPlayerCellLoad(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKETPLAYERCELLLOAD_HPP

@ -0,0 +1,44 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketPlayerCellState.hpp"
mwmp::PacketPlayerCellState::PacketPlayerCellState(RakNet::RakPeerInterface *peer) : PlayerPacket(peer)
{
packetID = ID_PLAYER_CELL_STATE;
priority = IMMEDIATE_PRIORITY;
reliability = RELIABLE_ORDERED;
}
void mwmp::PacketPlayerCellState::Packet(RakNet::BitStream *bs, mwmp::BasePlayer *player, bool send)
{
PlayerPacket::Packet(bs, player, send);
RW(player->cellStateChanges.action, send);
if (!send)
player->cellStateChanges.cells.clear();
else
player->cellStateChanges.count = (unsigned int)(player->cellStateChanges.cells.size());
RW(player->cellStateChanges.count, send);
for (unsigned int i = 0; i < player->cellStateChanges.count; i++)
{
ESM::Cell cell;
if (send)
{
cell = player->cellStateChanges.cells[i];
}
RW(cell.mData.mFlags, send);
RW(cell.mData.mX, send);
RW(cell.mData.mY, send);
RW(cell.mName, send);
if (!send)
{
player->cellStateChanges.cells.push_back(cell);
}
}
}

@ -0,0 +1,20 @@
#ifndef OPENMW_PACKETPLAYERCELLSTATE_HPP
#define OPENMW_PACKETPLAYERCELLSTATE_HPP
#include <components/openmw-mp/Packets/Player/PlayerPacket.hpp>
namespace mwmp
{
class PacketPlayerCellState : public PlayerPacket
{
public:
PacketPlayerCellState(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
};
}
#endif //OPENMW_PACKETPLAYERCELLSTATE_HPP
Loading…
Cancel
Save