From 292536439eeda58becdb7e441fe2e61ebb74529e Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 3 Oct 2018 02:26:47 +0300 Subject: [PATCH] [Server] Rename script functions for clearing packet vectors for players --- apps/openmw-mp/Script/Functions/Books.cpp | 11 +++++++++-- apps/openmw-mp/Script/Functions/Books.hpp | 12 ++++++++---- apps/openmw-mp/Script/Functions/Dialogue.cpp | 9 ++++++++- apps/openmw-mp/Script/Functions/Dialogue.hpp | 12 ++++++++---- apps/openmw-mp/Script/Functions/Factions.cpp | 9 ++++++++- apps/openmw-mp/Script/Functions/Factions.hpp | 13 +++++++++---- apps/openmw-mp/Script/Functions/GUI.cpp | 13 ++++++++----- apps/openmw-mp/Script/Functions/GUI.hpp | 17 ++++++++++------- apps/openmw-mp/Script/Functions/Items.cpp | 7 ++++++- apps/openmw-mp/Script/Functions/Items.hpp | 7 +++++-- apps/openmw-mp/Script/Functions/Quests.cpp | 16 ++++++++++++++-- apps/openmw-mp/Script/Functions/Quests.hpp | 18 +++++++++++++----- apps/openmw-mp/Script/Functions/Spells.cpp | 9 ++++++++- apps/openmw-mp/Script/Functions/Spells.hpp | 12 +++++++++--- 14 files changed, 123 insertions(+), 42 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Books.cpp b/apps/openmw-mp/Script/Functions/Books.cpp index 1415c4c3b..49556f32f 100644 --- a/apps/openmw-mp/Script/Functions/Books.cpp +++ b/apps/openmw-mp/Script/Functions/Books.cpp @@ -7,12 +7,12 @@ using namespace mwmp; -void BookFunctions::InitializeBookChanges(unsigned short pid) noexcept +void BookFunctions::ClearBookChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); - return player->bookChanges.books.clear(); + player->bookChanges.books.clear(); } unsigned int BookFunctions::GetBookChangesSize(unsigned short pid) noexcept @@ -59,3 +59,10 @@ void BookFunctions::SendBookChanges(unsigned short pid, bool sendToOtherPlayers, if (sendToOtherPlayers) packet->Send(true); } + +// All methods below are deprecated versions of methods from above + +void BookFunctions::InitializeBookChanges(unsigned short pid) noexcept +{ + ClearBookChanges(pid); +} diff --git a/apps/openmw-mp/Script/Functions/Books.hpp b/apps/openmw-mp/Script/Functions/Books.hpp index af8c60565..b01f26b0f 100644 --- a/apps/openmw-mp/Script/Functions/Books.hpp +++ b/apps/openmw-mp/Script/Functions/Books.hpp @@ -2,7 +2,7 @@ #define OPENMW_BOOKAPI_HPP #define BOOKAPI \ - {"InitializeBookChanges", BookFunctions::InitializeBookChanges},\ + {"ClearBookChanges", BookFunctions::ClearBookChanges},\ \ {"GetBookChangesSize", BookFunctions::GetBookChangesSize},\ \ @@ -10,7 +10,9 @@ \ {"GetBookId", BookFunctions::GetBookId},\ \ - {"SendBookChanges", BookFunctions::SendBookChanges} + {"SendBookChanges", BookFunctions::SendBookChanges},\ + \ + {"InitializeBookChanges", BookFunctions::InitializeBookChanges} class BookFunctions { @@ -24,7 +26,7 @@ public: * \param pid The player ID whose book changes should be used. * \return void */ - static void InitializeBookChanges(unsigned short pid) noexcept; + static void ClearBookChanges(unsigned short pid) noexcept; /** * \brief Get the number of indexes in a player's latest book changes. @@ -64,7 +66,9 @@ public: */ static void SendBookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; -private: + // All methods below are deprecated versions of methods from above + + static void InitializeBookChanges(unsigned short pid) noexcept; }; diff --git a/apps/openmw-mp/Script/Functions/Dialogue.cpp b/apps/openmw-mp/Script/Functions/Dialogue.cpp index db06001eb..0659bcfa2 100644 --- a/apps/openmw-mp/Script/Functions/Dialogue.cpp +++ b/apps/openmw-mp/Script/Functions/Dialogue.cpp @@ -7,7 +7,7 @@ using namespace mwmp; -void DialogueFunctions::InitializeTopicChanges(unsigned short pid) noexcept +void DialogueFunctions::ClearTopicChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -89,3 +89,10 @@ void DialogueFunctions::PlaySpeech(unsigned short pid, const char* sound) noexce packet->Send(false); player->sendToLoaded(packet); } + +// All methods below are deprecated versions of methods from above + +void DialogueFunctions::InitializeTopicChanges(unsigned short pid) noexcept +{ + ClearTopicChanges(pid); +} diff --git a/apps/openmw-mp/Script/Functions/Dialogue.hpp b/apps/openmw-mp/Script/Functions/Dialogue.hpp index 63bf4a2b2..a79ad1040 100644 --- a/apps/openmw-mp/Script/Functions/Dialogue.hpp +++ b/apps/openmw-mp/Script/Functions/Dialogue.hpp @@ -2,7 +2,7 @@ #define OPENMW_DIALOGUEAPI_HPP #define DIALOGUEAPI \ - {"InitializeTopicChanges", DialogueFunctions::InitializeTopicChanges},\ + {"ClearTopicChanges", DialogueFunctions::ClearTopicChanges},\ \ {"GetTopicChangesSize", DialogueFunctions::GetTopicChangesSize},\ \ @@ -13,7 +13,9 @@ {"SendTopicChanges", DialogueFunctions::SendTopicChanges},\ \ {"PlayAnimation", DialogueFunctions::PlayAnimation},\ - {"PlaySpeech", DialogueFunctions::PlaySpeech} + {"PlaySpeech", DialogueFunctions::PlaySpeech},\ + \ + {"InitializeTopicChanges", DialogueFunctions::InitializeTopicChanges} class DialogueFunctions { @@ -27,7 +29,7 @@ public: * \param pid The player ID whose topic changes should be used. * \return void */ - static void InitializeTopicChanges(unsigned short pid) noexcept; + static void ClearTopicChanges(unsigned short pid) noexcept; /** * \brief Get the number of indexes in a player's latest topic changes. @@ -90,7 +92,9 @@ public: */ static void PlaySpeech(unsigned short pid, const char* sound) noexcept; -private: + // All methods below are deprecated versions of methods from above + + static void InitializeTopicChanges(unsigned short pid) noexcept; }; diff --git a/apps/openmw-mp/Script/Functions/Factions.cpp b/apps/openmw-mp/Script/Functions/Factions.cpp index 47149ff90..668b1a786 100644 --- a/apps/openmw-mp/Script/Functions/Factions.cpp +++ b/apps/openmw-mp/Script/Functions/Factions.cpp @@ -11,7 +11,7 @@ using namespace mwmp; Faction tempFaction; const Faction emptyFaction = {}; -void FactionFunctions::InitializeFactionChanges(unsigned short pid) noexcept +void FactionFunctions::ClearFactionChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -121,3 +121,10 @@ void FactionFunctions::SendFactionChanges(unsigned short pid, bool sendToOtherPl if (sendToOtherPlayers) packet->Send(true); } + +// All methods below are deprecated versions of methods from above + +void FactionFunctions::InitializeFactionChanges(unsigned short pid) noexcept +{ + ClearFactionChanges(pid); +} diff --git a/apps/openmw-mp/Script/Functions/Factions.hpp b/apps/openmw-mp/Script/Functions/Factions.hpp index 70355a7c1..6caf604d2 100644 --- a/apps/openmw-mp/Script/Functions/Factions.hpp +++ b/apps/openmw-mp/Script/Functions/Factions.hpp @@ -2,7 +2,7 @@ #define OPENMW_FACTIONAPI_HPP #define FACTIONAPI \ - {"InitializeFactionChanges", FactionFunctions::InitializeFactionChanges},\ + {"ClearFactionChanges", FactionFunctions::ClearFactionChanges},\ \ {"GetFactionChangesSize", FactionFunctions::GetFactionChangesSize},\ {"GetFactionChangesAction", FactionFunctions::GetFactionChangesAction},\ @@ -20,7 +20,9 @@ \ {"AddFaction", FactionFunctions::AddFaction},\ \ - {"SendFactionChanges", FactionFunctions::SendFactionChanges} + {"SendFactionChanges", FactionFunctions::SendFactionChanges},\ + \ + {"InitializeFactionChanges", FactionFunctions::InitializeFactionChanges} class FactionFunctions { @@ -34,7 +36,7 @@ public: * \param pid The player ID whose faction changes should be used. * \return void */ - static void InitializeFactionChanges(unsigned short pid) noexcept; + static void ClearFactionChanges(unsigned short pid) noexcept; /** * \brief Get the number of indexes in a player's latest faction changes. @@ -151,7 +153,10 @@ public: * \return void */ static void SendFactionChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; -private: + + // All methods below are deprecated versions of methods from above + + static void InitializeFactionChanges(unsigned short pid) noexcept; }; diff --git a/apps/openmw-mp/Script/Functions/GUI.cpp b/apps/openmw-mp/Script/Functions/GUI.cpp index 3a91b56f7..9ce4c10bf 100644 --- a/apps/openmw-mp/Script/Functions/GUI.cpp +++ b/apps/openmw-mp/Script/Functions/GUI.cpp @@ -1,7 +1,3 @@ -// -// Created by koncord on 23.07.16. -// - #include "GUI.hpp" #include @@ -88,7 +84,7 @@ void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const packet->Send(false); } -void GUIFunctions::InitializeQuickKeyChanges(unsigned short pid) noexcept +void GUIFunctions::ClearQuickKeyChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -168,3 +164,10 @@ void GUIFunctions::SetMapVisibilityAll(unsigned short targetPid, unsigned short { LOG_MESSAGE(Log::LOG_WARN, "stub"); } + +// All methods below are deprecated versions of methods from above + +void GUIFunctions::InitializeQuickKeyChanges(unsigned short pid) noexcept +{ + ClearQuickKeyChanges(pid); +} diff --git a/apps/openmw-mp/Script/Functions/GUI.hpp b/apps/openmw-mp/Script/Functions/GUI.hpp index b3faee75d..d2df31727 100644 --- a/apps/openmw-mp/Script/Functions/GUI.hpp +++ b/apps/openmw-mp/Script/Functions/GUI.hpp @@ -1,7 +1,3 @@ -// -// Created by koncord on 30.08.16. -// - #ifndef OPENMW_GUIAPI_HPP #define OPENMW_GUIAPI_HPP @@ -12,7 +8,7 @@ {"PasswordDialog", GUIFunctions::PasswordDialog},\ {"ListBox", GUIFunctions::ListBox},\ \ - {"InitializeQuickKeyChanges", GUIFunctions::InitializeQuickKeyChanges},\ + {"ClearQuickKeyChanges", GUIFunctions::ClearQuickKeyChanges},\ \ {"GetQuickKeyChangesSize", GUIFunctions::GetQuickKeyChangesSize},\ \ @@ -25,7 +21,9 @@ {"SendQuickKeyChanges", GUIFunctions::SendQuickKeyChanges},\ \ {"SetMapVisibility", GUIFunctions::SetMapVisibility},\ - {"SetMapVisibilityAll", GUIFunctions::SetMapVisibilityAll} + {"SetMapVisibilityAll", GUIFunctions::SetMapVisibilityAll},\ + \ + {"InitializeQuickKeyChanges", GUIFunctions::InitializeQuickKeyChanges} class GUIFunctions { @@ -103,7 +101,7 @@ public: * \param pid The player ID whose quick key changes should be used. * \return void */ - static void InitializeQuickKeyChanges(unsigned short pid) noexcept; + static void ClearQuickKeyChanges(unsigned short pid) noexcept; /** * \brief Get the number of indexes in a player's latest quick key changes. @@ -183,6 +181,11 @@ public: * \return void */ static void SetMapVisibilityAll(unsigned short targetPid, unsigned short state) noexcept; + + // All methods below are deprecated versions of methods from above + + static void InitializeQuickKeyChanges(unsigned short pid) noexcept; + }; #endif //OPENMW_GUIAPI_HPP diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index 5a0f7da2e..ba9bf7d88 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -9,7 +9,7 @@ using namespace mwmp; -void ItemFunctions::InitializeInventoryChanges(unsigned short pid) noexcept +void ItemFunctions::ClearInventoryChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -255,6 +255,11 @@ void ItemFunctions::SendItemUse(unsigned short pid) noexcept // All methods below are deprecated versions of methods from above +void ItemFunctions::InitializeInventoryChanges(unsigned short pid) noexcept +{ + ClearInventoryChanges(pid); +} + void ItemFunctions::AddItem(unsigned short pid, const char* refId, unsigned int count, int charge, double enchantmentCharge, const char* soul) noexcept { diff --git a/apps/openmw-mp/Script/Functions/Items.hpp b/apps/openmw-mp/Script/Functions/Items.hpp index ead63c850..041b07f33 100644 --- a/apps/openmw-mp/Script/Functions/Items.hpp +++ b/apps/openmw-mp/Script/Functions/Items.hpp @@ -2,7 +2,7 @@ #define OPENMW_ITEMAPI_HPP #define ITEMAPI \ - {"InitializeInventoryChanges", ItemFunctions::InitializeInventoryChanges},\ + {"ClearInventoryChanges", ItemFunctions::ClearInventoryChanges},\ \ {"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\ {"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\ @@ -38,6 +38,7 @@ {"SendInventoryChanges", ItemFunctions::SendInventoryChanges},\ {"SendItemUse", ItemFunctions::SendItemUse},\ \ + {"InitializeInventoryChanges", ItemFunctions::InitializeInventoryChanges},\ {"AddItem", ItemFunctions::AddItem} class ItemFunctions @@ -52,7 +53,7 @@ public: * \param pid The player ID whose inventory changes should be used. * \return void */ - static void InitializeInventoryChanges(unsigned short pid) noexcept; + static void ClearInventoryChanges(unsigned short pid) noexcept; /** * \brief Get the number of slots used for equipment. @@ -293,6 +294,8 @@ public: // All methods below are deprecated versions of methods from above + static void InitializeInventoryChanges(unsigned short pid) noexcept; + static void AddItem(unsigned short pid, const char* refId, unsigned int count, int charge, double enchantmentCharge, const char* soul) noexcept; diff --git a/apps/openmw-mp/Script/Functions/Quests.cpp b/apps/openmw-mp/Script/Functions/Quests.cpp index ed841f7b9..9711a05ef 100644 --- a/apps/openmw-mp/Script/Functions/Quests.cpp +++ b/apps/openmw-mp/Script/Functions/Quests.cpp @@ -8,7 +8,7 @@ using namespace mwmp; -void QuestFunctions::InitializeJournalChanges(unsigned short pid) noexcept +void QuestFunctions::ClearJournalChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -16,7 +16,7 @@ void QuestFunctions::InitializeJournalChanges(unsigned short pid) noexcept player->journalChanges.journalItems.clear(); } -void QuestFunctions::InitializeKillChanges(unsigned short pid) noexcept +void QuestFunctions::ClearKillChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -211,3 +211,15 @@ void QuestFunctions::SendReputation(unsigned short pid, bool sendToOtherPlayers, if (sendToOtherPlayers) packet->Send(true); } + +// All methods below are deprecated versions of methods from above + +void QuestFunctions::InitializeJournalChanges(unsigned short pid) noexcept +{ + ClearJournalChanges(pid); +} + +void QuestFunctions::InitializeKillChanges(unsigned short pid) noexcept +{ + ClearKillChanges(pid); +} diff --git a/apps/openmw-mp/Script/Functions/Quests.hpp b/apps/openmw-mp/Script/Functions/Quests.hpp index 587e8ae6f..27912a928 100644 --- a/apps/openmw-mp/Script/Functions/Quests.hpp +++ b/apps/openmw-mp/Script/Functions/Quests.hpp @@ -2,8 +2,8 @@ #define OPENMW_QUESTAPI_HPP #define QUESTAPI \ - {"InitializeJournalChanges", QuestFunctions::InitializeJournalChanges},\ - {"InitializeKillChanges", QuestFunctions::InitializeKillChanges},\ + {"ClearJournalChanges", QuestFunctions::ClearJournalChanges},\ + {"ClearKillChanges", QuestFunctions::ClearKillChanges},\ \ {"GetJournalChangesSize", QuestFunctions::GetJournalChangesSize},\ {"GetKillChangesSize", QuestFunctions::GetKillChangesSize},\ @@ -26,7 +26,10 @@ \ {"SendJournalChanges", QuestFunctions::SendJournalChanges},\ {"SendKillChanges", QuestFunctions::SendKillChanges},\ - {"SendReputation", QuestFunctions::SendReputation} + {"SendReputation", QuestFunctions::SendReputation},\ + \ + {"InitializeJournalChanges", QuestFunctions::InitializeJournalChanges},\ + {"InitializeKillChanges", QuestFunctions::InitializeKillChanges} class QuestFunctions { @@ -40,7 +43,7 @@ public: * \param pid The player ID whose journal changes should be used. * \return void */ - static void InitializeJournalChanges(unsigned short pid) noexcept; + static void ClearJournalChanges(unsigned short pid) noexcept; /** * \brief Clear the last recorded kill count changes for a player. @@ -50,7 +53,7 @@ public: * \param pid The player ID whose kill count changes should be used. * \return void */ - static void InitializeKillChanges(unsigned short pid) noexcept; + static void ClearKillChanges(unsigned short pid) noexcept; /** * \brief Get the number of indexes in a player's latest journal changes. @@ -225,6 +228,11 @@ public: */ static void SendReputation(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; + // All methods below are deprecated versions of methods from above + + static void InitializeJournalChanges(unsigned short pid) noexcept; + static void InitializeKillChanges(unsigned short pid) noexcept; + private: }; diff --git a/apps/openmw-mp/Script/Functions/Spells.cpp b/apps/openmw-mp/Script/Functions/Spells.cpp index 08269cc14..b9f29f899 100644 --- a/apps/openmw-mp/Script/Functions/Spells.cpp +++ b/apps/openmw-mp/Script/Functions/Spells.cpp @@ -8,7 +8,7 @@ using namespace mwmp; -void SpellFunctions::InitializeSpellbookChanges(unsigned short pid) noexcept +void SpellFunctions::ClearSpellbookChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -75,3 +75,10 @@ void SpellFunctions::SendSpellbookChanges(unsigned short pid, bool sendToOtherPl if (sendToOtherPlayers) packet->Send(true); } + +// All methods below are deprecated versions of methods from above + +void SpellFunctions::InitializeSpellbookChanges(unsigned short pid) noexcept +{ + ClearSpellbookChanges(pid); +} diff --git a/apps/openmw-mp/Script/Functions/Spells.hpp b/apps/openmw-mp/Script/Functions/Spells.hpp index 9e3dabc70..d760dbdd0 100644 --- a/apps/openmw-mp/Script/Functions/Spells.hpp +++ b/apps/openmw-mp/Script/Functions/Spells.hpp @@ -2,7 +2,7 @@ #define OPENMW_SPELLAPI_HPP #define SPELLAPI \ - {"InitializeSpellbookChanges", SpellFunctions::InitializeSpellbookChanges},\ + {"ClearSpellbookChanges", SpellFunctions::ClearSpellbookChanges},\ \ {"GetSpellbookChangesSize", SpellFunctions::GetSpellbookChangesSize},\ {"GetSpellbookChangesAction", SpellFunctions::GetSpellbookChangesAction},\ @@ -12,7 +12,9 @@ \ {"GetSpellId", SpellFunctions::GetSpellId},\ \ - {"SendSpellbookChanges", SpellFunctions::SendSpellbookChanges} + {"SendSpellbookChanges", SpellFunctions::SendSpellbookChanges},\ + \ + {"InitializeSpellbookChanges", SpellFunctions::InitializeSpellbookChanges} class SpellFunctions { @@ -26,7 +28,7 @@ public: * \param pid The player ID whose spellbook changes should be used. * \return void */ - static void InitializeSpellbookChanges(unsigned short pid) noexcept; + static void ClearSpellbookChanges(unsigned short pid) noexcept; /** * \brief Get the number of indexes in a player's latest spellbook changes. @@ -83,6 +85,10 @@ public: */ static void SendSpellbookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; + // All methods below are deprecated versions of methods from above + + static void InitializeSpellbookChanges(unsigned short pid) noexcept; + private: };