From de49f5f17564fc0c1976d6804b2bba740e5036e7 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 7 May 2017 03:07:09 +0300 Subject: [PATCH] [General] Add and use isActor bool for WorldObject --- apps/openmw-mp/Script/Functions/World.cpp | 5 +++++ apps/openmw-mp/Script/Functions/World.hpp | 2 ++ apps/openmw/mwmp/WorldEvent.cpp | 2 ++ components/openmw-mp/Base/BaseEvent.hpp | 2 ++ components/openmw-mp/Packets/World/PacketObjectPlace.cpp | 1 + 5 files changed, 12 insertions(+) diff --git a/apps/openmw-mp/Script/Functions/World.cpp b/apps/openmw-mp/Script/Functions/World.cpp index bd202833e..c6fb45680 100644 --- a/apps/openmw-mp/Script/Functions/World.cpp +++ b/apps/openmw-mp/Script/Functions/World.cpp @@ -119,6 +119,11 @@ double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept return readEvent->worldObjects.at(i).position.rot[2]; } +bool WorldFunctions::GetObjectIsActor(unsigned int i) noexcept +{ + return readEvent->worldObjects.at(i).isActor; +} + unsigned int WorldFunctions::GetContainerChangesSize(unsigned int objectIndex) noexcept { return readEvent->worldObjects.at(objectIndex).containerItemCount; diff --git a/apps/openmw-mp/Script/Functions/World.hpp b/apps/openmw-mp/Script/Functions/World.hpp index d643665cd..892eb2780 100644 --- a/apps/openmw-mp/Script/Functions/World.hpp +++ b/apps/openmw-mp/Script/Functions/World.hpp @@ -23,6 +23,7 @@ {"GetObjectRotX", WorldFunctions::GetObjectRotX},\ {"GetObjectRotY", WorldFunctions::GetObjectRotY},\ {"GetObjectRotZ", WorldFunctions::GetObjectRotZ},\ + {"GetObjectIsActor", WorldFunctions::GetObjectIsActor},\ \ {"GetContainerChangesSize", WorldFunctions::GetContainerChangesSize},\ {"GetContainerItemRefId", WorldFunctions::GetContainerItemRefId},\ @@ -89,6 +90,7 @@ public: static double GetObjectRotX(unsigned int i) noexcept; static double GetObjectRotY(unsigned int i) noexcept; static double GetObjectRotZ(unsigned int i) noexcept; + static bool GetObjectIsActor(unsigned int i) noexcept; static unsigned int GetContainerChangesSize(unsigned int objectIndex) noexcept; static const char *GetContainerItemRefId(unsigned int objectIndex, unsigned int itemIndex) noexcept; diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index 971ca675c..ecf24bf94 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -471,6 +471,8 @@ void WorldEvent::addObjectPlace(const MWWorld::Ptr& ptr) // Get the real count of gold in a stack worldObject.goldValue = ptr.getCellRef().getGoldValue(); + worldObject.isActor = ptr.getClass().isActor(); + addObject(worldObject); } diff --git a/components/openmw-mp/Base/BaseEvent.hpp b/components/openmw-mp/Base/BaseEvent.hpp index e13ce77ca..436e81f80 100644 --- a/components/openmw-mp/Base/BaseEvent.hpp +++ b/components/openmw-mp/Base/BaseEvent.hpp @@ -47,6 +47,8 @@ namespace mwmp float floatVal; std::string varName; + bool isActor; + std::vector containerItems; unsigned int containerItemCount; }; diff --git a/components/openmw-mp/Packets/World/PacketObjectPlace.cpp b/components/openmw-mp/Packets/World/PacketObjectPlace.cpp index 7a0be6428..1270ab87c 100644 --- a/components/openmw-mp/Packets/World/PacketObjectPlace.cpp +++ b/components/openmw-mp/Packets/World/PacketObjectPlace.cpp @@ -40,6 +40,7 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, bool send) RW(worldObject.charge, send); RW(worldObject.goldValue, send); RW(worldObject.position, send); + RW(worldObject.isActor, send); if (!send) {