From e100ed7b63f9ddaf052bed8e432abb53c110cbe1 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 26 Oct 2020 20:34:01 +0200 Subject: [PATCH] [Server] Add server functions for getting & setting dialogue choices Fix typo in description for SetObjectSoul() --- apps/openmw-mp/Script/Functions/Objects.cpp | 10 ++++++++++ apps/openmw-mp/Script/Functions/Objects.hpp | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/apps/openmw-mp/Script/Functions/Objects.cpp b/apps/openmw-mp/Script/Functions/Objects.cpp index 36270146b..5f3d05dbd 100644 --- a/apps/openmw-mp/Script/Functions/Objects.cpp +++ b/apps/openmw-mp/Script/Functions/Objects.cpp @@ -154,6 +154,11 @@ int ObjectFunctions::GetObjectLockLevel(unsigned int index) noexcept return readObjectList->baseObjects.at(index).lockLevel; } +const char* ObjectFunctions::GetObjectDialogueChoice(unsigned int index) noexcept +{ + return readObjectList->baseObjects.at(index).dialogueChoice.c_str(); +} + unsigned int ObjectFunctions::GetObjectGoldPool(unsigned int index) noexcept { return readObjectList->baseObjects.at(index).goldPool; @@ -495,6 +500,11 @@ void ObjectFunctions::SetObjectLockLevel(int lockLevel) noexcept tempObject.lockLevel = lockLevel; } +void ObjectFunctions::SetObjectDialogueChoice(const char* dialogueChoice) noexcept +{ + tempObject.dialogueChoice = dialogueChoice; +} + void ObjectFunctions::SetObjectGoldPool(unsigned int goldPool) noexcept { tempObject.goldPool = goldPool; diff --git a/apps/openmw-mp/Script/Functions/Objects.hpp b/apps/openmw-mp/Script/Functions/Objects.hpp index f00592020..be67bc717 100644 --- a/apps/openmw-mp/Script/Functions/Objects.hpp +++ b/apps/openmw-mp/Script/Functions/Objects.hpp @@ -31,6 +31,7 @@ {"GetObjectState", ObjectFunctions::GetObjectState},\ {"GetObjectDoorState", ObjectFunctions::GetObjectDoorState},\ {"GetObjectLockLevel", ObjectFunctions::GetObjectLockLevel},\ + {"GetObjectDialogueChoice", ObjectFunctions::GetObjectDialogueChoice},\ {"GetObjectGoldPool", ObjectFunctions::GetObjectGoldPool},\ {"GetObjectLastGoldRestockHour", ObjectFunctions::GetObjectLastGoldRestockHour},\ {"GetObjectLastGoldRestockDay", ObjectFunctions::GetObjectLastGoldRestockDay},\ @@ -105,6 +106,7 @@ {"SetObjectScale", ObjectFunctions::SetObjectScale},\ {"SetObjectState", ObjectFunctions::SetObjectState},\ {"SetObjectLockLevel", ObjectFunctions::SetObjectLockLevel},\ + {"SetObjectDialogueChoice", ObjectFunctions::SetObjectDialogueChoice},\ {"SetObjectGoldPool", ObjectFunctions::SetObjectGoldPool},\ {"SetObjectLastGoldRestockHour", ObjectFunctions::SetObjectLastGoldRestockHour},\ {"SetObjectLastGoldRestockDay", ObjectFunctions::SetObjectLastGoldRestockDay},\ @@ -390,6 +392,14 @@ public: */ static int GetObjectLockLevel(unsigned int index) noexcept; + /** + * \brief Get the dialogue choice for the object at a certain index in the read object list. + * + * \param index The index of the object. + * \return The dialogue choice. + */ + static const char *GetObjectDialogueChoice(unsigned int index) noexcept; + /** * \brief Get the gold pool of the object at a certain index in the read object list. * @@ -946,7 +956,7 @@ public: /** * \brief Set the soul of the temporary object stored on the server. * - * \param refId The soul. + * \param soul The ID of the soul. * \return void */ static void SetObjectSoul(const char* soul) noexcept; @@ -989,6 +999,14 @@ public: */ static void SetObjectLockLevel(int lockLevel) noexcept; + /** + * \brief Set the dialogue choice for the temporary object stored on the server. + * + * \param dialogueChoice The dialogue choice. + * \return void + */ + static void SetObjectDialogueChoice(const char* dialogueChoice) noexcept; + /** * \brief Set the gold pool of the temporary object stored on the server. *