[Server] Rename script functions for clearing packet vectors for players

pull/475/head 0.7.0-alpha
David Cernat 6 years ago
parent c79660f721
commit 292536439e

@ -7,12 +7,12 @@
using namespace mwmp; using namespace mwmp;
void BookFunctions::InitializeBookChanges(unsigned short pid) noexcept void BookFunctions::ClearBookChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
return player->bookChanges.books.clear(); player->bookChanges.books.clear();
} }
unsigned int BookFunctions::GetBookChangesSize(unsigned short pid) noexcept unsigned int BookFunctions::GetBookChangesSize(unsigned short pid) noexcept
@ -59,3 +59,10 @@ void BookFunctions::SendBookChanges(unsigned short pid, bool sendToOtherPlayers,
if (sendToOtherPlayers) if (sendToOtherPlayers)
packet->Send(true); packet->Send(true);
} }
// All methods below are deprecated versions of methods from above
void BookFunctions::InitializeBookChanges(unsigned short pid) noexcept
{
ClearBookChanges(pid);
}

@ -2,7 +2,7 @@
#define OPENMW_BOOKAPI_HPP #define OPENMW_BOOKAPI_HPP
#define BOOKAPI \ #define BOOKAPI \
{"InitializeBookChanges", BookFunctions::InitializeBookChanges},\ {"ClearBookChanges", BookFunctions::ClearBookChanges},\
\ \
{"GetBookChangesSize", BookFunctions::GetBookChangesSize},\ {"GetBookChangesSize", BookFunctions::GetBookChangesSize},\
\ \
@ -10,7 +10,9 @@
\ \
{"GetBookId", BookFunctions::GetBookId},\ {"GetBookId", BookFunctions::GetBookId},\
\ \
{"SendBookChanges", BookFunctions::SendBookChanges} {"SendBookChanges", BookFunctions::SendBookChanges},\
\
{"InitializeBookChanges", BookFunctions::InitializeBookChanges}
class BookFunctions class BookFunctions
{ {
@ -24,7 +26,7 @@ public:
* \param pid The player ID whose book changes should be used. * \param pid The player ID whose book changes should be used.
* \return void * \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. * \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; 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;
}; };

@ -7,7 +7,7 @@
using namespace mwmp; using namespace mwmp;
void DialogueFunctions::InitializeTopicChanges(unsigned short pid) noexcept void DialogueFunctions::ClearTopicChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
@ -89,3 +89,10 @@ void DialogueFunctions::PlaySpeech(unsigned short pid, const char* sound) noexce
packet->Send(false); packet->Send(false);
player->sendToLoaded(packet); player->sendToLoaded(packet);
} }
// All methods below are deprecated versions of methods from above
void DialogueFunctions::InitializeTopicChanges(unsigned short pid) noexcept
{
ClearTopicChanges(pid);
}

@ -2,7 +2,7 @@
#define OPENMW_DIALOGUEAPI_HPP #define OPENMW_DIALOGUEAPI_HPP
#define DIALOGUEAPI \ #define DIALOGUEAPI \
{"InitializeTopicChanges", DialogueFunctions::InitializeTopicChanges},\ {"ClearTopicChanges", DialogueFunctions::ClearTopicChanges},\
\ \
{"GetTopicChangesSize", DialogueFunctions::GetTopicChangesSize},\ {"GetTopicChangesSize", DialogueFunctions::GetTopicChangesSize},\
\ \
@ -13,7 +13,9 @@
{"SendTopicChanges", DialogueFunctions::SendTopicChanges},\ {"SendTopicChanges", DialogueFunctions::SendTopicChanges},\
\ \
{"PlayAnimation", DialogueFunctions::PlayAnimation},\ {"PlayAnimation", DialogueFunctions::PlayAnimation},\
{"PlaySpeech", DialogueFunctions::PlaySpeech} {"PlaySpeech", DialogueFunctions::PlaySpeech},\
\
{"InitializeTopicChanges", DialogueFunctions::InitializeTopicChanges}
class DialogueFunctions class DialogueFunctions
{ {
@ -27,7 +29,7 @@ public:
* \param pid The player ID whose topic changes should be used. * \param pid The player ID whose topic changes should be used.
* \return void * \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. * \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; 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;
}; };

@ -11,7 +11,7 @@ using namespace mwmp;
Faction tempFaction; Faction tempFaction;
const Faction emptyFaction = {}; const Faction emptyFaction = {};
void FactionFunctions::InitializeFactionChanges(unsigned short pid) noexcept void FactionFunctions::ClearFactionChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
@ -121,3 +121,10 @@ void FactionFunctions::SendFactionChanges(unsigned short pid, bool sendToOtherPl
if (sendToOtherPlayers) if (sendToOtherPlayers)
packet->Send(true); packet->Send(true);
} }
// All methods below are deprecated versions of methods from above
void FactionFunctions::InitializeFactionChanges(unsigned short pid) noexcept
{
ClearFactionChanges(pid);
}

@ -2,7 +2,7 @@
#define OPENMW_FACTIONAPI_HPP #define OPENMW_FACTIONAPI_HPP
#define FACTIONAPI \ #define FACTIONAPI \
{"InitializeFactionChanges", FactionFunctions::InitializeFactionChanges},\ {"ClearFactionChanges", FactionFunctions::ClearFactionChanges},\
\ \
{"GetFactionChangesSize", FactionFunctions::GetFactionChangesSize},\ {"GetFactionChangesSize", FactionFunctions::GetFactionChangesSize},\
{"GetFactionChangesAction", FactionFunctions::GetFactionChangesAction},\ {"GetFactionChangesAction", FactionFunctions::GetFactionChangesAction},\
@ -20,7 +20,9 @@
\ \
{"AddFaction", FactionFunctions::AddFaction},\ {"AddFaction", FactionFunctions::AddFaction},\
\ \
{"SendFactionChanges", FactionFunctions::SendFactionChanges} {"SendFactionChanges", FactionFunctions::SendFactionChanges},\
\
{"InitializeFactionChanges", FactionFunctions::InitializeFactionChanges}
class FactionFunctions class FactionFunctions
{ {
@ -34,7 +36,7 @@ public:
* \param pid The player ID whose faction changes should be used. * \param pid The player ID whose faction changes should be used.
* \return void * \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. * \brief Get the number of indexes in a player's latest faction changes.
@ -151,7 +153,10 @@ public:
* \return void * \return void
*/ */
static void SendFactionChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; 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;
}; };

@ -1,7 +1,3 @@
//
// Created by koncord on 23.07.16.
//
#include "GUI.hpp" #include "GUI.hpp"
#include <components/openmw-mp/NetworkMessages.hpp> #include <components/openmw-mp/NetworkMessages.hpp>
@ -88,7 +84,7 @@ void GUIFunctions::ListBox(unsigned short pid, int id, const char *label, const
packet->Send(false); packet->Send(false);
} }
void GUIFunctions::InitializeQuickKeyChanges(unsigned short pid) noexcept void GUIFunctions::ClearQuickKeyChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
@ -168,3 +164,10 @@ void GUIFunctions::SetMapVisibilityAll(unsigned short targetPid, unsigned short
{ {
LOG_MESSAGE(Log::LOG_WARN, "stub"); 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);
}

@ -1,7 +1,3 @@
//
// Created by koncord on 30.08.16.
//
#ifndef OPENMW_GUIAPI_HPP #ifndef OPENMW_GUIAPI_HPP
#define OPENMW_GUIAPI_HPP #define OPENMW_GUIAPI_HPP
@ -12,7 +8,7 @@
{"PasswordDialog", GUIFunctions::PasswordDialog},\ {"PasswordDialog", GUIFunctions::PasswordDialog},\
{"ListBox", GUIFunctions::ListBox},\ {"ListBox", GUIFunctions::ListBox},\
\ \
{"InitializeQuickKeyChanges", GUIFunctions::InitializeQuickKeyChanges},\ {"ClearQuickKeyChanges", GUIFunctions::ClearQuickKeyChanges},\
\ \
{"GetQuickKeyChangesSize", GUIFunctions::GetQuickKeyChangesSize},\ {"GetQuickKeyChangesSize", GUIFunctions::GetQuickKeyChangesSize},\
\ \
@ -25,7 +21,9 @@
{"SendQuickKeyChanges", GUIFunctions::SendQuickKeyChanges},\ {"SendQuickKeyChanges", GUIFunctions::SendQuickKeyChanges},\
\ \
{"SetMapVisibility", GUIFunctions::SetMapVisibility},\ {"SetMapVisibility", GUIFunctions::SetMapVisibility},\
{"SetMapVisibilityAll", GUIFunctions::SetMapVisibilityAll} {"SetMapVisibilityAll", GUIFunctions::SetMapVisibilityAll},\
\
{"InitializeQuickKeyChanges", GUIFunctions::InitializeQuickKeyChanges}
class GUIFunctions class GUIFunctions
{ {
@ -103,7 +101,7 @@ public:
* \param pid The player ID whose quick key changes should be used. * \param pid The player ID whose quick key changes should be used.
* \return void * \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. * \brief Get the number of indexes in a player's latest quick key changes.
@ -183,6 +181,11 @@ public:
* \return void * \return void
*/ */
static void SetMapVisibilityAll(unsigned short targetPid, unsigned short state) noexcept; 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 #endif //OPENMW_GUIAPI_HPP

@ -9,7 +9,7 @@
using namespace mwmp; using namespace mwmp;
void ItemFunctions::InitializeInventoryChanges(unsigned short pid) noexcept void ItemFunctions::ClearInventoryChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, 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 // 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, void ItemFunctions::AddItem(unsigned short pid, const char* refId, unsigned int count, int charge,
double enchantmentCharge, const char* soul) noexcept double enchantmentCharge, const char* soul) noexcept
{ {

@ -2,7 +2,7 @@
#define OPENMW_ITEMAPI_HPP #define OPENMW_ITEMAPI_HPP
#define ITEMAPI \ #define ITEMAPI \
{"InitializeInventoryChanges", ItemFunctions::InitializeInventoryChanges},\ {"ClearInventoryChanges", ItemFunctions::ClearInventoryChanges},\
\ \
{"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\ {"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\
{"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\ {"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\
@ -38,6 +38,7 @@
{"SendInventoryChanges", ItemFunctions::SendInventoryChanges},\ {"SendInventoryChanges", ItemFunctions::SendInventoryChanges},\
{"SendItemUse", ItemFunctions::SendItemUse},\ {"SendItemUse", ItemFunctions::SendItemUse},\
\ \
{"InitializeInventoryChanges", ItemFunctions::InitializeInventoryChanges},\
{"AddItem", ItemFunctions::AddItem} {"AddItem", ItemFunctions::AddItem}
class ItemFunctions class ItemFunctions
@ -52,7 +53,7 @@ public:
* \param pid The player ID whose inventory changes should be used. * \param pid The player ID whose inventory changes should be used.
* \return void * \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. * \brief Get the number of slots used for equipment.
@ -293,6 +294,8 @@ public:
// All methods below are deprecated versions of methods from above // 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, static void AddItem(unsigned short pid, const char* refId, unsigned int count, int charge,
double enchantmentCharge, const char* soul) noexcept; double enchantmentCharge, const char* soul) noexcept;

@ -8,7 +8,7 @@
using namespace mwmp; using namespace mwmp;
void QuestFunctions::InitializeJournalChanges(unsigned short pid) noexcept void QuestFunctions::ClearJournalChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
@ -16,7 +16,7 @@ void QuestFunctions::InitializeJournalChanges(unsigned short pid) noexcept
player->journalChanges.journalItems.clear(); player->journalChanges.journalItems.clear();
} }
void QuestFunctions::InitializeKillChanges(unsigned short pid) noexcept void QuestFunctions::ClearKillChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
@ -211,3 +211,15 @@ void QuestFunctions::SendReputation(unsigned short pid, bool sendToOtherPlayers,
if (sendToOtherPlayers) if (sendToOtherPlayers)
packet->Send(true); 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);
}

@ -2,8 +2,8 @@
#define OPENMW_QUESTAPI_HPP #define OPENMW_QUESTAPI_HPP
#define QUESTAPI \ #define QUESTAPI \
{"InitializeJournalChanges", QuestFunctions::InitializeJournalChanges},\ {"ClearJournalChanges", QuestFunctions::ClearJournalChanges},\
{"InitializeKillChanges", QuestFunctions::InitializeKillChanges},\ {"ClearKillChanges", QuestFunctions::ClearKillChanges},\
\ \
{"GetJournalChangesSize", QuestFunctions::GetJournalChangesSize},\ {"GetJournalChangesSize", QuestFunctions::GetJournalChangesSize},\
{"GetKillChangesSize", QuestFunctions::GetKillChangesSize},\ {"GetKillChangesSize", QuestFunctions::GetKillChangesSize},\
@ -26,7 +26,10 @@
\ \
{"SendJournalChanges", QuestFunctions::SendJournalChanges},\ {"SendJournalChanges", QuestFunctions::SendJournalChanges},\
{"SendKillChanges", QuestFunctions::SendKillChanges},\ {"SendKillChanges", QuestFunctions::SendKillChanges},\
{"SendReputation", QuestFunctions::SendReputation} {"SendReputation", QuestFunctions::SendReputation},\
\
{"InitializeJournalChanges", QuestFunctions::InitializeJournalChanges},\
{"InitializeKillChanges", QuestFunctions::InitializeKillChanges}
class QuestFunctions class QuestFunctions
{ {
@ -40,7 +43,7 @@ public:
* \param pid The player ID whose journal changes should be used. * \param pid The player ID whose journal changes should be used.
* \return void * \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. * \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. * \param pid The player ID whose kill count changes should be used.
* \return void * \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. * \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; 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: private:
}; };

@ -8,7 +8,7 @@
using namespace mwmp; using namespace mwmp;
void SpellFunctions::InitializeSpellbookChanges(unsigned short pid) noexcept void SpellFunctions::ClearSpellbookChanges(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
@ -75,3 +75,10 @@ void SpellFunctions::SendSpellbookChanges(unsigned short pid, bool sendToOtherPl
if (sendToOtherPlayers) if (sendToOtherPlayers)
packet->Send(true); packet->Send(true);
} }
// All methods below are deprecated versions of methods from above
void SpellFunctions::InitializeSpellbookChanges(unsigned short pid) noexcept
{
ClearSpellbookChanges(pid);
}

@ -2,7 +2,7 @@
#define OPENMW_SPELLAPI_HPP #define OPENMW_SPELLAPI_HPP
#define SPELLAPI \ #define SPELLAPI \
{"InitializeSpellbookChanges", SpellFunctions::InitializeSpellbookChanges},\ {"ClearSpellbookChanges", SpellFunctions::ClearSpellbookChanges},\
\ \
{"GetSpellbookChangesSize", SpellFunctions::GetSpellbookChangesSize},\ {"GetSpellbookChangesSize", SpellFunctions::GetSpellbookChangesSize},\
{"GetSpellbookChangesAction", SpellFunctions::GetSpellbookChangesAction},\ {"GetSpellbookChangesAction", SpellFunctions::GetSpellbookChangesAction},\
@ -12,7 +12,9 @@
\ \
{"GetSpellId", SpellFunctions::GetSpellId},\ {"GetSpellId", SpellFunctions::GetSpellId},\
\ \
{"SendSpellbookChanges", SpellFunctions::SendSpellbookChanges} {"SendSpellbookChanges", SpellFunctions::SendSpellbookChanges},\
\
{"InitializeSpellbookChanges", SpellFunctions::InitializeSpellbookChanges}
class SpellFunctions class SpellFunctions
{ {
@ -26,7 +28,7 @@ public:
* \param pid The player ID whose spellbook changes should be used. * \param pid The player ID whose spellbook changes should be used.
* \return void * \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. * \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; 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: private:
}; };

Loading…
Cancel
Save