forked from mirror/openmw-tes3mp
Implement ID_WORLD_OBJECT_PLACE
This commit is contained in:
parent
d0027ae3e7
commit
17f66e4e90
4 changed files with 29 additions and 11 deletions
|
@ -1,5 +1,9 @@
|
|||
#include "hud.hpp"
|
||||
|
||||
#include <components/openmw-mp/Base/WorldEvent.hpp>
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include <MyGUI_RenderManager.h>
|
||||
#include <MyGUI_ProgressBar.h>
|
||||
#include <MyGUI_Button.h>
|
||||
|
@ -51,6 +55,18 @@ namespace MWGui
|
|||
if (setNewOwner)
|
||||
dropped.getCellRef().setOwner("");
|
||||
|
||||
// Added by tes3mp
|
||||
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
|
||||
event->cell = *dropped.getCell()->getCell();
|
||||
event->cellRef.mRefID = dropped.getCellRef().getRefId();
|
||||
event->cellRef.mRefNum = dropped.getCellRef().getRefNum();
|
||||
event->cellRef.mPos = dropped.getCellRef().getPosition();
|
||||
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_PLACE)->Send(event);
|
||||
|
||||
printf("Sending ID_WORLD_OBJECT_PLACE about %s\n%i\n",
|
||||
event->cellRef.mRefID.c_str(),
|
||||
event->cellRef.mRefNum);
|
||||
|
||||
return dropped;
|
||||
}
|
||||
|
||||
|
|
|
@ -632,9 +632,15 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
|||
|
||||
WorldPacket *myPacket = worldController.GetPacket(packet->data[0]);
|
||||
WorldEvent *event = new WorldEvent(id);
|
||||
myPacket->Packet(&bsIn, event, false);
|
||||
|
||||
MWWorld::CellStore *ptrCellStore;
|
||||
|
||||
if (event->cell.isExterior())
|
||||
ptrCellStore = MWBase::Environment::get().getWorld()->getExterior(event->cell.mData.mX, event->cell.mData.mY);
|
||||
else
|
||||
ptrCellStore = MWBase::Environment::get().getWorld()->getInterior(event->cell.mName);
|
||||
|
||||
switch (packet->data[0])
|
||||
{
|
||||
case ID_WORLD_OBJECT_PLACE:
|
||||
|
@ -647,13 +653,6 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
|||
}
|
||||
case ID_WORLD_OBJECT_DELETE:
|
||||
{
|
||||
myPacket->Packet(&bsIn, event, false);
|
||||
|
||||
if (event->cell.isExterior())
|
||||
ptrCellStore = MWBase::Environment::get().getWorld()->getExterior(event->cell.mData.mX, event->cell.mData.mY);
|
||||
else
|
||||
ptrCellStore = MWBase::Environment::get().getWorld()->getInterior(event->cell.mName);
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_OBJECT_DELETE");
|
||||
LOG_APPEND(Log::LOG_WARN, "- cellRefId: %s, %i",
|
||||
event->cellRef.mRefID.c_str(),
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
|
||||
#include <components/openmw-mp/Base/WorldEvent.hpp>
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
||||
#include "class.hpp"
|
||||
#include "containerstore.hpp"
|
||||
|
||||
|
@ -25,9 +24,7 @@ namespace MWWorld
|
|||
|
||||
// Added by tes3mp
|
||||
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
|
||||
|
||||
event->cell = *getTarget().getCell()->getCell();
|
||||
|
||||
event->cellRef.mRefID = getTarget().getCellRef().getRefId();
|
||||
event->cellRef.mRefNum = getTarget().getCellRef().getRefNum();
|
||||
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_DELETE)->Send(event);
|
||||
|
|
|
@ -14,4 +14,10 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
|
|||
|
||||
RW(event->cellRef.mRefID, send);
|
||||
RW(event->cellRef.mRefNum, send);
|
||||
RW(event->cellRef.mPos, send);
|
||||
|
||||
RW(event->cell.mData.mFlags, send);
|
||||
RW(event->cell.mCellId.mIndex.mX, send);
|
||||
RW(event->cell.mCellId.mIndex.mY, send);
|
||||
RW(event->cell.mName, send);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue