mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:45:32 +00:00
[General] Add action types to WorldEvent's ContainerChanges
This commit is contained in:
parent
a07e616878
commit
9f8bed9be1
3 changed files with 30 additions and 15 deletions
|
@ -66,7 +66,7 @@ namespace mwmp
|
|||
{
|
||||
ESM::Cell cell;
|
||||
|
||||
enum CELl_STATE_ACTION
|
||||
enum CELL_STATE_ACTION
|
||||
{
|
||||
LOAD = 0,
|
||||
UNLOAD = 1
|
||||
|
@ -91,7 +91,7 @@ namespace mwmp
|
|||
ADD,
|
||||
REMOVE
|
||||
};
|
||||
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
|
||||
};
|
||||
|
||||
struct SpellbookChanges
|
||||
|
@ -104,7 +104,7 @@ namespace mwmp
|
|||
ADD,
|
||||
REMOVE
|
||||
};
|
||||
int action; //0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
|
||||
int action; // 0 - Clear and set in entirety, 1 - Add spell, 2 - Remove spell
|
||||
};
|
||||
|
||||
struct CellStateChanges
|
||||
|
|
|
@ -36,12 +36,34 @@ namespace mwmp
|
|||
std::string refId;
|
||||
int count;
|
||||
int health;
|
||||
|
||||
inline bool operator==(const ContainerItem& rhs)
|
||||
{
|
||||
return refId == rhs.refId && count == rhs.count && health == rhs.health;
|
||||
}
|
||||
};
|
||||
|
||||
struct ObjectChanges
|
||||
{
|
||||
std::vector<WorldObject> objects;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
struct ContainerChanges
|
||||
{
|
||||
std::vector<ContainerItem> items;
|
||||
unsigned int count;
|
||||
|
||||
enum CONTAINER_ACTION
|
||||
{
|
||||
SET = 0,
|
||||
ADD = 1,
|
||||
REMOVE = 2
|
||||
};
|
||||
|
||||
int action; // 0 - Clear and set in entirety, 1 - Add item, 2 - Remove item
|
||||
};
|
||||
|
||||
class WorldEvent
|
||||
{
|
||||
public:
|
||||
|
@ -56,18 +78,6 @@ namespace mwmp
|
|||
|
||||
}
|
||||
|
||||
struct ObjectChanges
|
||||
{
|
||||
std::vector<WorldObject> objects;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
struct ContainerChanges
|
||||
{
|
||||
std::vector<ContainerItem> items;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
RakNet::RakNetGUID guid;
|
||||
ObjectChanges objectChanges;
|
||||
ContainerChanges containerChanges;
|
||||
|
|
|
@ -12,8 +12,13 @@ void PacketContainer::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send
|
|||
{
|
||||
WorldPacket::Packet(bs, event, send);
|
||||
|
||||
RW(event->containerChanges.action, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
event->objectChanges.objects.clear();
|
||||
event->containerChanges.items.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
event->objectChanges.count = (unsigned int)(event->objectChanges.objects.size());
|
||||
|
|
Loading…
Reference in a new issue