From 70470e12b4d03382c5818f36556fe383ffc192e2 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 17 Feb 2017 16:24:40 +0200 Subject: [PATCH] [Server] Reorder World script functions --- apps/openmw-mp/Script/Functions/World.cpp | 160 +++++++++++----------- apps/openmw-mp/Script/Functions/World.hpp | 60 ++++---- 2 files changed, 110 insertions(+), 110 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/World.cpp b/apps/openmw-mp/Script/Functions/World.cpp index 62d47f638..343f25851 100644 --- a/apps/openmw-mp/Script/Functions/World.cpp +++ b/apps/openmw-mp/Script/Functions/World.cpp @@ -28,6 +28,86 @@ void WorldFunctions::CreateBaseEvent(unsigned short pid) noexcept baseEvent = new BaseEvent(player->guid); } +unsigned int WorldFunctions::GetObjectChangesSize() noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.count; +} + +unsigned int WorldFunctions::GetBaseEventAction() noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->action; +} + +const char *WorldFunctions::GetObjectRefId(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refId.c_str(); +} + +int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refNumIndex; +} + +int WorldFunctions::GetObjectCharge(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).charge; +} + +int WorldFunctions::GetObjectCount(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).count; +} + +int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).goldValue; +} + +double WorldFunctions::GetObjectScale(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).scale; +} + +int WorldFunctions::GetObjectDoorState(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).doorState; +} + +int WorldFunctions::GetObjectLockLevel(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).lockLevel; +} + +double WorldFunctions::GetObjectPosX(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.pos[0]; +} + +double WorldFunctions::GetObjectPosY(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.pos[1]; +} + +double WorldFunctions::GetObjectPosZ(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.pos[2]; +} + +double WorldFunctions::GetObjectRotX(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.rot[0]; +} + +double WorldFunctions::GetObjectRotY(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.rot[1]; +} + +double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept +{ + return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.rot[2]; +} + void WorldFunctions::AddWorldObject() noexcept { WorldObject worldObject; @@ -126,86 +206,6 @@ void WorldFunctions::SetObjectRotation(double x, double y, double z) noexcept tempWorldObject.pos.rot[2] = z; } -unsigned int WorldFunctions::GetObjectChangesSize() noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.count; -} - -unsigned int WorldFunctions::GetBaseEventAction() noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->action; -} - -const char *WorldFunctions::GetObjectRefId(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refId.c_str(); -} - -int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).refNumIndex; -} - -int WorldFunctions::GetObjectCharge(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).charge; -} - -int WorldFunctions::GetObjectCount(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).count; -} - -int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).goldValue; -} - -double WorldFunctions::GetObjectScale(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).scale; -} - -int WorldFunctions::GetObjectDoorState(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).doorState; -} - -int WorldFunctions::GetObjectLockLevel(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).lockLevel; -} - -double WorldFunctions::GetObjectPosX(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.pos[0]; -} - -double WorldFunctions::GetObjectPosY(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.pos[1]; -} - -double WorldFunctions::GetObjectPosZ(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.pos[2]; -} - -double WorldFunctions::GetObjectRotX(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.rot[0]; -} - -double WorldFunctions::GetObjectRotY(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.rot[1]; -} - -double WorldFunctions::GetObjectRotZ(unsigned int i) noexcept -{ - return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects.at(i).pos.rot[2]; -} - void WorldFunctions::SendContainer() noexcept { mwmp::Networking::get().getWorldController()->GetPacket(ID_CONTAINER)->Send(baseEvent, baseEvent->guid); diff --git a/apps/openmw-mp/Script/Functions/World.hpp b/apps/openmw-mp/Script/Functions/World.hpp index 7331b533d..13f11b204 100644 --- a/apps/openmw-mp/Script/Functions/World.hpp +++ b/apps/openmw-mp/Script/Functions/World.hpp @@ -4,21 +4,6 @@ #define WORLDFUNCTIONS \ {"CreateBaseEvent", WorldFunctions::CreateBaseEvent},\ \ - {"AddWorldObject", WorldFunctions::AddWorldObject},\ - {"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\ - {"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\ - \ - {"SetObjectRefId", WorldFunctions::SetObjectRefId},\ - {"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\ - {"SetObjectCharge", WorldFunctions::SetObjectCharge},\ - {"SetObjectCount", WorldFunctions::SetObjectCount},\ - {"SetObjectGoldValue", WorldFunctions::SetObjectGoldValue},\ - {"SetObjectScale", WorldFunctions::SetObjectScale},\ - {"SetObjectDoorState", WorldFunctions::SetObjectDoorState},\ - {"SetObjectLockLevel", WorldFunctions::SetObjectLockLevel},\ - {"SetObjectPosition", WorldFunctions::SetObjectPosition},\ - {"SetObjectRotation", WorldFunctions::SetObjectRotation},\ - \ {"GetObjectChangesSize", WorldFunctions::GetObjectChangesSize},\ {"GetBaseEventAction", WorldFunctions::GetBaseEventAction},\ \ @@ -37,6 +22,21 @@ {"GetObjectRotY", WorldFunctions::GetObjectRotY},\ {"GetObjectRotZ", WorldFunctions::GetObjectRotZ},\ \ + {"AddWorldObject", WorldFunctions::AddWorldObject},\ + {"SetBaseEventCell", WorldFunctions::SetBaseEventCell},\ + {"SetBaseEventAction", WorldFunctions::SetBaseEventAction},\ + \ + {"SetObjectRefId", WorldFunctions::SetObjectRefId},\ + {"SetObjectRefNumIndex", WorldFunctions::SetObjectRefNumIndex},\ + {"SetObjectCharge", WorldFunctions::SetObjectCharge},\ + {"SetObjectCount", WorldFunctions::SetObjectCount},\ + {"SetObjectGoldValue", WorldFunctions::SetObjectGoldValue},\ + {"SetObjectScale", WorldFunctions::SetObjectScale},\ + {"SetObjectDoorState", WorldFunctions::SetObjectDoorState},\ + {"SetObjectLockLevel", WorldFunctions::SetObjectLockLevel},\ + {"SetObjectPosition", WorldFunctions::SetObjectPosition},\ + {"SetObjectRotation", WorldFunctions::SetObjectRotation},\ + \ {"SendContainer", WorldFunctions::SendContainer},\ \ {"SendObjectDelete", WorldFunctions::SendObjectDelete},\ @@ -56,21 +56,6 @@ public: static void CreateBaseEvent(unsigned short pid) noexcept; - static void AddWorldObject() noexcept; - static void SetBaseEventCell(const char* cellDescription) noexcept; - static void SetBaseEventAction(int action) noexcept; - - static void SetObjectRefId(const char* refId) noexcept; - static void SetObjectRefNumIndex(int refNumIndex) noexcept; - static void SetObjectCharge(int charge) noexcept; - static void SetObjectCount(int count) noexcept; - static void SetObjectGoldValue(int goldValue) noexcept; - static void SetObjectScale(double scale) noexcept; - static void SetObjectDoorState(int doorState) noexcept; - static void SetObjectLockLevel(int lockLevel) noexcept; - static void SetObjectPosition(double x, double y, double z) noexcept; - static void SetObjectRotation(double x, double y, double z) noexcept; - static unsigned int GetObjectChangesSize() noexcept; static unsigned int GetBaseEventAction() noexcept; @@ -89,6 +74,21 @@ public: static double GetObjectRotY(unsigned int i) noexcept; static double GetObjectRotZ(unsigned int i) noexcept; + static void AddWorldObject() noexcept; + static void SetBaseEventCell(const char* cellDescription) noexcept; + static void SetBaseEventAction(int action) noexcept; + + static void SetObjectRefId(const char* refId) noexcept; + static void SetObjectRefNumIndex(int refNumIndex) noexcept; + static void SetObjectCharge(int charge) noexcept; + static void SetObjectCount(int count) noexcept; + static void SetObjectGoldValue(int goldValue) noexcept; + static void SetObjectScale(double scale) noexcept; + static void SetObjectDoorState(int doorState) noexcept; + static void SetObjectLockLevel(int lockLevel) noexcept; + static void SetObjectPosition(double x, double y, double z) noexcept; + static void SetObjectRotation(double x, double y, double z) noexcept; + static void SendContainer() noexcept; static void SendObjectDelete() noexcept;