Send item count ID_WORLD_OBJECT_PLACE

pull/112/merge
David Cernat 8 years ago
parent 1f982e4dc7
commit 180aa3f2f3

@ -61,11 +61,13 @@ namespace MWGui
event->cellRef.mRefID = dropped.getCellRef().getRefId();
event->cellRef.mRefNum = dropped.getCellRef().getRefNum();
event->cellRef.mPos = dropped.getCellRef().getPosition();
event->count = count;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_PLACE)->Send(event);
printf("Sending ID_OBJECT_PLACE about %s\n%i\n",
printf("Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i\n",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex);
event->cellRef.mRefNum.mIndex,
event->count);
return dropped;
}

@ -705,13 +705,19 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
case ID_OBJECT_PLACE:
{
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_OBJECT_PLACE");
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- count: %i",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex,
event->cell.getDescription().c_str());
event->cell.getDescription().c_str(),
event->count);
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), event->cellRef.mRefID, 1);
MWBase::Environment::get().getWorld()->placeObject(ref.getPtr(), ptrCellStore, event->cellRef.mPos);
MWWorld::Ptr newPtr = ref.getPtr();
if (event->count > 1)
newPtr.getRefData().setCount(event->count);
MWBase::Environment::get().getWorld()->placeObject(newPtr, ptrCellStore, event->cellRef.mPos);
break;
}

@ -542,11 +542,13 @@ namespace MWScript
event->cellRef.mRefID = ptr.getCellRef().getRefId();
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->cellRef.mPos = ptr.getCellRef().getPosition();
event->count = 1;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_PLACE)->Send(event);
printf("Sending ID_OBJECT_PLACE about %s\n%i\n",
printf("Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i\n",
event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex);
event->cellRef.mRefNum.mIndex,
event->count);
}
}
};

@ -25,9 +25,9 @@ namespace mwmp
ESM::Cell cell;
ESM::CellRef cellRef;
ESM::Position pos;
int count;
int state;
int lockLevel;
float scale;

@ -20,4 +20,6 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
RW(event->cell.mData.mX, send);
RW(event->cell.mData.mY, send);
RW(event->cell.mName, send);
RW(event->count, send);
}

Loading…
Cancel
Save