Add and implement ID_WORLD_OBJECT_UNLOCK

pull/112/merge
David Cernat 8 years ago
parent 94c5d6d2f9
commit 08ea5163c4

@ -410,6 +410,23 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
break;
}
case ID_WORLD_OBJECT_UNLOCK:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Received ID_WORLD_OBJECT_UNLOCK from %s",
player->Npc()->mName.c_str());
myPacket->Read(event);
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex,
event->cell.getDescription().c_str());
myPacket->Send(event, true);
break;
}
default:
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled WorldPacket with identifier %i has arrived",
packet->data[0]);

@ -725,6 +725,27 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
break;
}
case ID_WORLD_OBJECT_UNLOCK:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_OBJECT_UNLOCK");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex,
event->cell.getDescription().c_str());
MWWorld::Ptr ptrFound = ptrCellStore->searchByRefNum(event->cellRef.mRefNum);
if (ptrFound)
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Found %s, %i",
ptrFound.getCellRef().getRefId().c_str(),
ptrFound.getCellRef().getRefNum());
ptrFound.getClass().unlock(ptrFound);
}
break;
}
default:
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Unhandled WorldPacket with identifier %i has arrived",
packet->data[0]);

@ -157,7 +157,7 @@ add_component_dir (openmw-mp
Packets/Player/PacketHandshake Packets/Player/PacketGUIBoxes Packets/Player/PacketClass
Packets/Player/PacketTime Packets/Player/PacketInventory
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace)
Packets/World/PacketObjectDelete Packets/World/PacketObjectPlace Packets/World/PacketObjectUnlock)
add_component_dir (fallback
fallback validate

@ -2,8 +2,9 @@
#include <boost/foreach.hpp>
#include <boost/make_shared.hpp>
#include "../Packets/World/PacketObjectPlace.hpp"
#include "../Packets/World/PacketObjectDelete.hpp"
#include "../Packets/World/PacketObjectPlace.hpp"
#include "../Packets/World/PacketObjectUnlock.hpp"
#include "WorldPacketController.hpp"
@ -17,8 +18,9 @@ inline void AddPacket(mwmp::WorldPacketController::packets_t *packets, RakNet::R
mwmp::WorldPacketController::WorldPacketController(RakNet::RakPeerInterface *peer)
{
AddPacket<PacketObjectPlace>(&packets, peer);
AddPacket<PacketObjectDelete>(&packets, peer);
AddPacket<PacketObjectPlace>(&packets, peer);
AddPacket<PacketObjectUnlock>(&packets, peer);
}

@ -34,7 +34,8 @@ enum GameMessages
ID_GAME_INVENTORY,
ID_WORLD_OBJECT_PLACE,
ID_WORLD_OBJECT_DELETE
ID_WORLD_OBJECT_DELETE,
ID_WORLD_OBJECT_UNLOCK
};

@ -0,0 +1,22 @@
#include <components/openmw-mp/NetworkMessages.hpp>
#include "PacketObjectUnlock.hpp"
using namespace mwmp;
PacketObjectUnlock::PacketObjectUnlock(RakNet::RakPeerInterface *peer) : WorldPacket(peer)
{
packetID = ID_WORLD_OBJECT_UNLOCK;
}
void PacketObjectUnlock::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send)
{
WorldPacket::Packet(bs, event, send);
RW(event->cellRef.mRefID, send);
RW(event->cellRef.mRefNum.mIndex, send);
RW(event->cell.mData.mFlags, send);
RW(event->cell.mData.mX, send);
RW(event->cell.mData.mY, send);
RW(event->cell.mName, send);
}

@ -0,0 +1,17 @@
#ifndef OPENMW_PACKETOBJECTUNLOCK_HPP
#define OPENMW_PACKETOBJECTUNLOCK_HPP
#include <components/openmw-mp/Packets/World/WorldPacket.hpp>
namespace mwmp
{
class PacketObjectUnlock : public WorldPacket
{
public:
PacketObjectUnlock(RakNet::RakPeerInterface *peer);
virtual void Packet(RakNet::BitStream *bs, WorldEvent *event, bool send);
};
}
#endif //OPENMW_PACKETOBJECTUNLOCK_HPP
Loading…
Cancel
Save