[General] Rename WorldEvent into BaseEvent

coverity_scan^2
David Cernat 8 years ago
parent 27242cdab9
commit 182b238b5f

@ -21,7 +21,7 @@ using namespace std;
Networking *Networking::sThis = 0; Networking *Networking::sThis = 0;
static WorldEvent *worldEvent = nullptr; static BaseEvent *baseEvent = nullptr;
Networking::Networking(RakNet::RakPeerInterface *peer) Networking::Networking(RakNet::RakPeerInterface *peer)
{ {
@ -418,13 +418,13 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
WorldPacket *myPacket = worldController->GetPacket(packet->data[0]); WorldPacket *myPacket = worldController->GetPacket(packet->data[0]);
if (worldEvent) if (baseEvent)
{ {
delete worldEvent; delete baseEvent;
worldEvent = nullptr; baseEvent = nullptr;
} }
worldEvent = new WorldEvent(player->guid); baseEvent = new BaseEvent(player->guid);
switch (packet->data[0]) switch (packet->data[0])
{ {
@ -434,12 +434,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_PLACE from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnObjectPlace")>( Script::Call<Script::CallbackIdentity("OnObjectPlace")>(
player->getId(), player->getId(),
worldEvent->cell.getDescription().c_str()); baseEvent->cell.getDescription().c_str());
break; break;
} }
@ -449,12 +449,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_DELETE from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnObjectDelete")>( Script::Call<Script::CallbackIdentity("OnObjectDelete")>(
player->getId(), player->getId(),
worldEvent->cell.getDescription().c_str()); baseEvent->cell.getDescription().c_str());
break; break;
} }
@ -464,12 +464,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_SCALE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_SCALE from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnObjectScale")>( Script::Call<Script::CallbackIdentity("OnObjectScale")>(
player->getId(), player->getId(),
worldEvent->cell.getDescription().c_str()); baseEvent->cell.getDescription().c_str());
break; break;
} }
@ -479,12 +479,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_LOCK from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnObjectLock")>( Script::Call<Script::CallbackIdentity("OnObjectLock")>(
player->getId(), player->getId(),
worldEvent->cell.getDescription().c_str()); baseEvent->cell.getDescription().c_str());
break; break;
} }
@ -494,12 +494,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_UNLOCK from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnObjectUnlock")>( Script::Call<Script::CallbackIdentity("OnObjectUnlock")>(
player->getId(), player->getId(),
worldEvent->cell.getDescription().c_str()); baseEvent->cell.getDescription().c_str());
break; break;
} }
@ -509,8 +509,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_MOVE from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -520,8 +520,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ROTATE from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -531,8 +531,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_ANIM_PLAY from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -542,8 +542,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_CONTAINER from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -553,8 +553,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_HEALTH from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_OBJECT_HEALTH from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -564,12 +564,12 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_DOOR_STATE from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
Script::Call<Script::CallbackIdentity("OnDoorState")>( Script::Call<Script::CallbackIdentity("OnDoorState")>(
player->getId(), player->getId(),
worldEvent->cell.getDescription().c_str()); baseEvent->cell.getDescription().c_str());
break; break;
} }
@ -579,8 +579,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_SHORT from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -590,8 +590,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_LOCAL_FLOAT from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -601,8 +601,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_MEMBER_SHORT from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -612,8 +612,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_SCRIPT_GLOBAL_SHORT from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -623,8 +623,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_MUSIC_PLAY from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_MUSIC_PLAY from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -634,8 +634,8 @@ void Networking::processWorldPacket(RakNet::Packet *packet)
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY from %s", LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_VIDEO_PLAY from %s",
player->npc.mName.c_str()); player->npc.mName.c_str());
myPacket->Read(worldEvent); myPacket->Read(baseEvent);
myPacket->Send(worldEvent, true); myPacket->Send(baseEvent, true);
break; break;
} }
@ -746,9 +746,9 @@ WorldPacketController *Networking::getWorldController() const
return worldController; return worldController;
} }
WorldEvent *Networking::getLastEvent() BaseEvent *Networking::getLastEvent()
{ {
return worldEvent; return baseEvent;
} }
const Networking &Networking::get() const Networking &Networking::get()

@ -36,7 +36,7 @@ namespace mwmp
PlayerPacketController *getPlayerController() const; PlayerPacketController *getPlayerController() const;
WorldPacketController *getWorldController() const; WorldPacketController *getWorldController() const;
WorldEvent *getLastEvent(); BaseEvent *getLastEvent();
MasterClient *getMasterClient(); MasterClient *getMasterClient();
void InitQuery(std::string queryAddr, unsigned short queryPort, std::string serverAddr, unsigned short serverPort); void InitQuery(std::string queryAddr, unsigned short queryPort, std::string serverAddr, unsigned short serverPort);

@ -4,28 +4,28 @@
#include <apps/openmw-mp/Script/ScriptFunctions.hpp> #include <apps/openmw-mp/Script/ScriptFunctions.hpp>
#include <apps/openmw-mp/Networking.hpp> #include <apps/openmw-mp/Networking.hpp>
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
#include <components/openmw-mp/Base/WorldEvent.hpp> #include <components/openmw-mp/Base/BaseEvent.hpp>
#include "World.hpp" #include "World.hpp"
using namespace mwmp; using namespace mwmp;
static WorldEvent *worldEvent = nullptr; static BaseEvent *baseEvent = nullptr;
static WorldObject tempWorldObject; static WorldObject tempWorldObject;
std::regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$"); std::regex exteriorCellPattern("^(-?\\d+), (-?\\d+)$");
void WorldFunctions::CreateWorldEvent(unsigned short pid) noexcept void WorldFunctions::CreateBaseEvent(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
if (worldEvent) if (baseEvent)
{ {
delete worldEvent; delete baseEvent;
worldEvent = nullptr; baseEvent = nullptr;
} }
worldEvent = new WorldEvent(player->guid); baseEvent = new BaseEvent(player->guid);
} }
void WorldFunctions::AddWorldObject() noexcept void WorldFunctions::AddWorldObject() noexcept
@ -41,29 +41,29 @@ void WorldFunctions::AddWorldObject() noexcept
worldObject.lockLevel = tempWorldObject.lockLevel; worldObject.lockLevel = tempWorldObject.lockLevel;
worldObject.pos = tempWorldObject.pos; worldObject.pos = tempWorldObject.pos;
worldEvent->objectChanges.objects.push_back(worldObject); baseEvent->objectChanges.objects.push_back(worldObject);
} }
void WorldFunctions::SetWorldEventCell(const char* cellDescription) noexcept void WorldFunctions::SetBaseEventCell(const char* cellDescription) noexcept
{ {
std::string description = cellDescription; std::string description = cellDescription;
std::smatch baseMatch; std::smatch baseMatch;
if (std::regex_match(description, baseMatch, exteriorCellPattern)) if (std::regex_match(description, baseMatch, exteriorCellPattern))
{ {
worldEvent->cell.mData.mFlags &= ~ESM::Cell::Interior; baseEvent->cell.mData.mFlags &= ~ESM::Cell::Interior;
// The first sub match is the whole string, so check for a length of 3 // The first sub match is the whole string, so check for a length of 3
if (baseMatch.size() == 3) if (baseMatch.size() == 3)
{ {
worldEvent->cell.mData.mX = stoi(baseMatch[1].str()); baseEvent->cell.mData.mX = stoi(baseMatch[1].str());
worldEvent->cell.mData.mY = stoi(baseMatch[2].str()); baseEvent->cell.mData.mY = stoi(baseMatch[2].str());
} }
} }
else else
{ {
worldEvent->cell.mData.mFlags |= ESM::Cell::Interior; baseEvent->cell.mData.mFlags |= ESM::Cell::Interior;
worldEvent->cell.mName = description; baseEvent->cell.mName = description;
} }
} }
@ -198,32 +198,32 @@ double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept
void WorldFunctions::SendObjectDelete() noexcept void WorldFunctions::SendObjectDelete() noexcept
{ {
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(worldEvent, worldEvent->guid); mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(baseEvent, baseEvent->guid);
} }
void WorldFunctions::SendObjectPlace() noexcept void WorldFunctions::SendObjectPlace() noexcept
{ {
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(worldEvent, worldEvent->guid); mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_PLACE)->Send(baseEvent, baseEvent->guid);
} }
void WorldFunctions::SendObjectScale() noexcept void WorldFunctions::SendObjectScale() noexcept
{ {
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(worldEvent, worldEvent->guid); mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_SCALE)->Send(baseEvent, baseEvent->guid);
} }
void WorldFunctions::SendObjectLock() noexcept void WorldFunctions::SendObjectLock() noexcept
{ {
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(worldEvent, worldEvent->guid); mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_LOCK)->Send(baseEvent, baseEvent->guid);
} }
void WorldFunctions::SendObjectUnlock() noexcept void WorldFunctions::SendObjectUnlock() noexcept
{ {
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(worldEvent, worldEvent->guid); mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_UNLOCK)->Send(baseEvent, baseEvent->guid);
} }
void WorldFunctions::SendDoorState() noexcept void WorldFunctions::SendDoorState() noexcept
{ {
mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(worldEvent, worldEvent->guid); mwmp::Networking::get().getWorldController()->GetPacket(ID_DOOR_STATE)->Send(baseEvent, baseEvent->guid);
} }
void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept

@ -2,10 +2,10 @@
#define OPENMW_WORLD_HPP #define OPENMW_WORLD_HPP
#define WORLDFUNCTIONS \ #define WORLDFUNCTIONS \
{"CreateWorldEvent", WorldFunctions::CreateWorldEvent},\ {"CreateBaseEvent", WorldFunctions::CreateBaseEvent},\
\ \
{"AddWorldObject", WorldFunctions::AddWorldObject},\ {"AddWorldObject", WorldFunctions::AddWorldObject},\
{"SetWorldEventCell", WorldFunctions::SetWorldEventCell},\ {"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\
\ \
{"SetObjectRefId", WorldFunctions::SetObjectRefId},\ {"SetObjectRefId", WorldFunctions::SetObjectRefId},\
{"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\ {"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\
@ -50,10 +50,10 @@ class WorldFunctions
{ {
public: public:
static void CreateWorldEvent(unsigned short pid) noexcept; static void CreateBaseEvent(unsigned short pid) noexcept;
static void AddWorldObject() noexcept; static void AddWorldObject() noexcept;
static void SetWorldEventCell(const char* cellDescription) noexcept; static void SetBaseEventCell(const char* cellDescription) noexcept;
static void SetObjectRefId(const char* refId) noexcept; static void SetObjectRefId(const char* refId) noexcept;
static void SetObjectRefNumIndex(int refNumIndex) noexcept; static void SetObjectRefNumIndex(int refNumIndex) noexcept;

@ -1,14 +1,14 @@
#ifndef OPENMW_LOCALEVENT_HPP #ifndef OPENMW_LOCALEVENT_HPP
#define OPENMW_LOCALEVENT_HPP #define OPENMW_LOCALEVENT_HPP
#include <components/openmw-mp/Base/WorldEvent.hpp> #include <components/openmw-mp/Base/BaseEvent.hpp>
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include <RakNetTypes.h> #include <RakNetTypes.h>
namespace mwmp namespace mwmp
{ {
class Networking; class Networking;
class LocalEvent : public WorldEvent class LocalEvent : public BaseEvent
{ {
public: public:

@ -1,5 +1,5 @@
#ifndef OPENMW_WORLDEVENT_HPP #ifndef OPENMW_BASEEVENT_HPP
#define OPENMW_WORLDEVENT_HPP #define OPENMW_BASEEVENT_HPP
#include <components/esm/loadcell.hpp> #include <components/esm/loadcell.hpp>
#include <components/esm/cellref.hpp> #include <components/esm/cellref.hpp>
@ -65,16 +65,16 @@ namespace mwmp
int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
}; };
class WorldEvent class BaseEvent
{ {
public: public:
WorldEvent(RakNet::RakNetGUID guid) : guid(guid) BaseEvent(RakNet::RakNetGUID guid) : guid(guid)
{ {
} }
WorldEvent() BaseEvent()
{ {
} }
@ -87,4 +87,4 @@ namespace mwmp
}; };
} }
#endif //OPENMW_WORLDEVENT_HPP #endif //OPENMW_BASEEVENT_HPP

@ -8,7 +8,7 @@ PacketContainer::PacketContainer(RakNet::RakPeerInterface *peer) : WorldPacket(p
packetID = ID_CONTAINER; packetID = ID_CONTAINER;
} }
void PacketContainer::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketContainer::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketContainer(RakNet::RakPeerInterface *peer); PacketContainer(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketDoorState::PacketDoorState(RakNet::RakPeerInterface *peer) : WorldPacket(p
packetID = ID_DOOR_STATE; packetID = ID_DOOR_STATE;
} }
void PacketDoorState::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketDoorState::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketDoorState(RakNet::RakPeerInterface *peer); PacketDoorState(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketMusicPlay::PacketMusicPlay(RakNet::RakPeerInterface *peer) : WorldPacket(p
packetID = ID_MUSIC_PLAY; packetID = ID_MUSIC_PLAY;
} }
void PacketMusicPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketMusicPlay::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketMusicPlay(RakNet::RakPeerInterface *peer); PacketMusicPlay(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectAnimPlay::PacketObjectAnimPlay(RakNet::RakPeerInterface *peer) : Wor
packetID = ID_OBJECT_ANIM_PLAY; packetID = ID_OBJECT_ANIM_PLAY;
} }
void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectAnimPlay::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectAnimPlay(RakNet::RakPeerInterface *peer); PacketObjectAnimPlay(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectDelete::PacketObjectDelete(RakNet::RakPeerInterface *peer) : WorldPa
packetID = ID_OBJECT_DELETE; packetID = ID_OBJECT_DELETE;
} }
void PacketObjectDelete::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectDelete::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectDelete(RakNet::RakPeerInterface *peer); PacketObjectDelete(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectHealth::PacketObjectHealth(RakNet::RakPeerInterface *peer) : WorldPa
packetID = ID_OBJECT_HEALTH; packetID = ID_OBJECT_HEALTH;
} }
void PacketObjectHealth::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectHealth::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);
} }

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectHealth(RakNet::RakPeerInterface *peer); PacketObjectHealth(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectLock::PacketObjectLock(RakNet::RakPeerInterface *peer) : WorldPacket
packetID = ID_OBJECT_LOCK; packetID = ID_OBJECT_LOCK;
} }
void PacketObjectLock::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectLock::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectLock(RakNet::RakPeerInterface *peer); PacketObjectLock(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectMove::PacketObjectMove(RakNet::RakPeerInterface *peer) : WorldPacket
packetID = ID_OBJECT_MOVE; packetID = ID_OBJECT_MOVE;
} }
void PacketObjectMove::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectMove::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectMove(RakNet::RakPeerInterface *peer); PacketObjectMove(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectPlace::PacketObjectPlace(RakNet::RakPeerInterface *peer) : WorldPack
packetID = ID_OBJECT_PLACE; packetID = ID_OBJECT_PLACE;
} }
void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectPlace::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectPlace(RakNet::RakPeerInterface *peer); PacketObjectPlace(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectRotate::PacketObjectRotate(RakNet::RakPeerInterface *peer) : WorldPa
packetID = ID_OBJECT_ROTATE; packetID = ID_OBJECT_ROTATE;
} }
void PacketObjectRotate::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectRotate::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectRotate(RakNet::RakPeerInterface *peer); PacketObjectRotate(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectScale::PacketObjectScale(RakNet::RakPeerInterface *peer) : WorldPack
packetID = ID_OBJECT_SCALE; packetID = ID_OBJECT_SCALE;
} }
void PacketObjectScale::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectScale::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectScale(RakNet::RakPeerInterface *peer); PacketObjectScale(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketObjectUnlock::PacketObjectUnlock(RakNet::RakPeerInterface *peer) : WorldPa
packetID = ID_OBJECT_UNLOCK; packetID = ID_OBJECT_UNLOCK;
} }
void PacketObjectUnlock::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketObjectUnlock::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketObjectUnlock(RakNet::RakPeerInterface *peer); PacketObjectUnlock(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketScriptGlobalShort::PacketScriptGlobalShort(RakNet::RakPeerInterface *peer)
packetID = ID_SCRIPT_GLOBAL_SHORT; packetID = ID_SCRIPT_GLOBAL_SHORT;
} }
void PacketScriptGlobalShort::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketScriptGlobalShort::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketScriptGlobalShort(RakNet::RakPeerInterface *peer); PacketScriptGlobalShort(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketScriptLocalFloat::PacketScriptLocalFloat(RakNet::RakPeerInterface *peer) :
packetID = ID_SCRIPT_LOCAL_FLOAT; packetID = ID_SCRIPT_LOCAL_FLOAT;
} }
void PacketScriptLocalFloat::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketScriptLocalFloat::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketScriptLocalFloat(RakNet::RakPeerInterface *peer); PacketScriptLocalFloat(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketScriptLocalShort::PacketScriptLocalShort(RakNet::RakPeerInterface *peer) :
packetID = ID_SCRIPT_LOCAL_SHORT; packetID = ID_SCRIPT_LOCAL_SHORT;
} }
void PacketScriptLocalShort::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketScriptLocalShort::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketScriptLocalShort(RakNet::RakPeerInterface *peer); PacketScriptLocalShort(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketScriptMemberShort::PacketScriptMemberShort(RakNet::RakPeerInterface *peer)
packetID = ID_SCRIPT_MEMBER_SHORT; packetID = ID_SCRIPT_MEMBER_SHORT;
} }
void PacketScriptMemberShort::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketScriptMemberShort::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketScriptMemberShort(RakNet::RakPeerInterface *peer); PacketScriptMemberShort(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -8,7 +8,7 @@ PacketVideoPlay::PacketVideoPlay(RakNet::RakPeerInterface *peer) : WorldPacket(p
packetID = ID_VIDEO_PLAY; packetID = ID_VIDEO_PLAY;
} }
void PacketVideoPlay::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void PacketVideoPlay::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
WorldPacket::Packet(bs, event, send); WorldPacket::Packet(bs, event, send);

@ -10,7 +10,7 @@ namespace mwmp
public: public:
PacketVideoPlay(RakNet::RakPeerInterface *peer); PacketVideoPlay(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
}; };
} }

@ -5,7 +5,7 @@
using namespace mwmp; using namespace mwmp;
void WorldPacket::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send) void WorldPacket::Packet(RakNet::BitStream *bs, BaseEvent *event, bool send)
{ {
this->event = event; this->event = event;
this->bs = bs; this->bs = bs;
@ -30,21 +30,21 @@ WorldPacket::~WorldPacket()
} }
void WorldPacket::Send(WorldEvent *event, RakNet::AddressOrGUID destination) void WorldPacket::Send(BaseEvent *event, RakNet::AddressOrGUID destination)
{ {
bsSend->ResetWritePointer(); bsSend->ResetWritePointer();
Packet(bsSend, event, true); Packet(bsSend, event, true);
peer->Send(bsSend, priority, reliability, 0, destination, false); peer->Send(bsSend, priority, reliability, 0, destination, false);
} }
void WorldPacket::Send(WorldEvent *event, bool toOther) void WorldPacket::Send(BaseEvent *event, bool toOther)
{ {
bsSend->ResetWritePointer(); bsSend->ResetWritePointer();
Packet(bsSend, event, true); Packet(bsSend, event, true);
peer->Send(bsSend, priority, reliability, 0, event->guid, toOther); peer->Send(bsSend, priority, reliability, 0, event->guid, toOther);
} }
void WorldPacket::Read(WorldEvent *event) void WorldPacket::Read(BaseEvent *event)
{ {
Packet(bsRead, event, false); Packet(bsRead, event, false);
} }

@ -5,7 +5,7 @@
#include <RakNetTypes.h> #include <RakNetTypes.h>
#include <BitStream.h> #include <BitStream.h>
#include <PacketPriority.h> #include <PacketPriority.h>
#include <components/openmw-mp/Base/WorldEvent.hpp> #include <components/openmw-mp/Base/BaseEvent.hpp>
#include <components/openmw-mp/Packets/BasePacket.hpp> #include <components/openmw-mp/Packets/BasePacket.hpp>
@ -19,11 +19,11 @@ namespace mwmp
~WorldPacket(); ~WorldPacket();
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send); virtual void Packet(RakNet::BitStream *bs, BaseEvent *event, bool send);
virtual void Send(WorldEvent *event, bool toOtherPlayers = true); virtual void Send(BaseEvent *event, bool toOtherPlayers = true);
virtual void Send(WorldEvent *event, RakNet::AddressOrGUID destination); virtual void Send(BaseEvent *event, RakNet::AddressOrGUID destination);
virtual void Read(WorldEvent *event); virtual void Read(BaseEvent *event);
static size_t headerSize() static size_t headerSize()
{ {
@ -36,7 +36,7 @@ namespace mwmp
} }
protected: protected:
WorldEvent *event; BaseEvent *event;
}; };
} }

Loading…
Cancel
Save