From 2f1ef049d260256cf555f7dcff3f0b07db9f3e34 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 7 Jul 2018 20:08:59 +0300 Subject: [PATCH] [Server] Turn sendToAttachedPlayer into skipAttachedPlayer Unfortunately, default values set in the C++ code for our script function parameters don't actually seem to work, and they always default to false because they receive a nil value from Lua. As a result, to not break compatibility with previous scripts, I've decided to use a skipAttachedPlayer argument instead so it can default to false while still providing the same benefits that sendToAttachedPlayer provided. --- apps/openmw-mp/Script/Functions/Books.cpp | 4 +- apps/openmw-mp/Script/Functions/Books.hpp | 2 +- apps/openmw-mp/Script/Functions/Chat.cpp | 4 +- apps/openmw-mp/Script/Functions/Chat.hpp | 2 +- apps/openmw-mp/Script/Functions/Dialogue.cpp | 4 +- apps/openmw-mp/Script/Functions/Dialogue.hpp | 2 +- apps/openmw-mp/Script/Functions/Factions.cpp | 4 +- apps/openmw-mp/Script/Functions/Factions.hpp | 2 +- apps/openmw-mp/Script/Functions/Items.cpp | 4 +- apps/openmw-mp/Script/Functions/Items.hpp | 2 +- apps/openmw-mp/Script/Functions/Objects.cpp | 48 +++++++++---------- apps/openmw-mp/Script/Functions/Objects.hpp | 24 +++++----- apps/openmw-mp/Script/Functions/Quests.cpp | 12 ++--- apps/openmw-mp/Script/Functions/Quests.hpp | 6 +-- apps/openmw-mp/Script/Functions/Spells.cpp | 4 +- apps/openmw-mp/Script/Functions/Spells.hpp | 2 +- .../openmw-mp/Script/Functions/Worldstate.cpp | 12 ++--- .../openmw-mp/Script/Functions/Worldstate.hpp | 6 +-- apps/openmw-mp/Script/ScriptFunctions.cpp | 1 - 19 files changed, 72 insertions(+), 73 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Books.cpp b/apps/openmw-mp/Script/Functions/Books.cpp index 18d0e1671..8102a419f 100644 --- a/apps/openmw-mp/Script/Functions/Books.cpp +++ b/apps/openmw-mp/Script/Functions/Books.cpp @@ -45,7 +45,7 @@ const char *BookFunctions::GetBookId(unsigned short pid, unsigned int i) noexcep return player->bookChanges.books.at(i).bookId.c_str(); } -void BookFunctions::SendBookChanges(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void BookFunctions::SendBookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -54,7 +54,7 @@ void BookFunctions::SendBookChanges(unsigned short pid, bool sendToOtherPlayers, packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Books.hpp b/apps/openmw-mp/Script/Functions/Books.hpp index 35f47d0c6..d9932062d 100644 --- a/apps/openmw-mp/Script/Functions/Books.hpp +++ b/apps/openmw-mp/Script/Functions/Books.hpp @@ -62,7 +62,7 @@ public: * to the packet (true by default). * \return void */ - static void SendBookChanges(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendBookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; private: diff --git a/apps/openmw-mp/Script/Functions/Chat.cpp b/apps/openmw-mp/Script/Functions/Chat.cpp index 0b72a173c..477cc1b17 100644 --- a/apps/openmw-mp/Script/Functions/Chat.cpp +++ b/apps/openmw-mp/Script/Functions/Chat.cpp @@ -6,7 +6,7 @@ #include #include -void ChatFunctions::SendMessage(unsigned short pid, const char *message, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ChatFunctions::SendMessage(unsigned short pid, const char *message, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player,); @@ -18,7 +18,7 @@ void ChatFunctions::SendMessage(unsigned short pid, const char *message, bool se mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Chat.hpp b/apps/openmw-mp/Script/Functions/Chat.hpp index 2424aa5f8..3d736f4b7 100644 --- a/apps/openmw-mp/Script/Functions/Chat.hpp +++ b/apps/openmw-mp/Script/Functions/Chat.hpp @@ -23,7 +23,7 @@ public: * to the packet (true by default). * \return void */ - static void SendMessage(unsigned short pid, const char *message, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendMessage(unsigned short pid, const char *message, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Remove all messages from chat for a certain player. diff --git a/apps/openmw-mp/Script/Functions/Dialogue.cpp b/apps/openmw-mp/Script/Functions/Dialogue.cpp index b3e90b794..c1217b8db 100644 --- a/apps/openmw-mp/Script/Functions/Dialogue.cpp +++ b/apps/openmw-mp/Script/Functions/Dialogue.cpp @@ -45,7 +45,7 @@ const char *DialogueFunctions::GetTopicId(unsigned short pid, unsigned int i) no return player->topicChanges.topics.at(i).topicId.c_str(); } -void DialogueFunctions::SendTopicChanges(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void DialogueFunctions::SendTopicChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -53,7 +53,7 @@ void DialogueFunctions::SendTopicChanges(unsigned short pid, bool sendToOtherPla mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_TOPIC); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Dialogue.hpp b/apps/openmw-mp/Script/Functions/Dialogue.hpp index e1cdae481..9ae5e4ed0 100644 --- a/apps/openmw-mp/Script/Functions/Dialogue.hpp +++ b/apps/openmw-mp/Script/Functions/Dialogue.hpp @@ -65,7 +65,7 @@ public: * to the packet (true by default). * \return void */ - static void SendTopicChanges(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendTopicChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; static void PlayAnimation(unsigned short pid, const char* groupname, int mode = 0, int count = 1, bool persist = false) noexcept; static void PlaySpeech(unsigned short pid, const char* sound) noexcept; diff --git a/apps/openmw-mp/Script/Functions/Factions.cpp b/apps/openmw-mp/Script/Functions/Factions.cpp index 0fc1121a5..8ae57ddbb 100644 --- a/apps/openmw-mp/Script/Functions/Factions.cpp +++ b/apps/openmw-mp/Script/Functions/Factions.cpp @@ -108,7 +108,7 @@ void FactionFunctions::AddFaction(unsigned short pid) noexcept tempFaction = emptyFaction; } -void FactionFunctions::SendFactionChanges(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void FactionFunctions::SendFactionChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -116,7 +116,7 @@ void FactionFunctions::SendFactionChanges(unsigned short pid, bool sendToOtherPl mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_FACTION); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Factions.hpp b/apps/openmw-mp/Script/Functions/Factions.hpp index a5983159b..6a05e7161 100644 --- a/apps/openmw-mp/Script/Functions/Factions.hpp +++ b/apps/openmw-mp/Script/Functions/Factions.hpp @@ -150,7 +150,7 @@ public: * to the packet (true by default). * \return void */ - static void SendFactionChanges(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendFactionChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; private: }; diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index 7b2b35b95..7182dcd32 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -177,7 +177,7 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept player->equipmentIndexChanges.clear(); } -void ItemFunctions::SendInventoryChanges(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ItemFunctions::SendInventoryChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -185,7 +185,7 @@ void ItemFunctions::SendInventoryChanges(unsigned short pid, bool sendToOtherPla mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_INVENTORY); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Items.hpp b/apps/openmw-mp/Script/Functions/Items.hpp index e297ebcaf..2cfec98ed 100644 --- a/apps/openmw-mp/Script/Functions/Items.hpp +++ b/apps/openmw-mp/Script/Functions/Items.hpp @@ -217,7 +217,7 @@ public: * to the packet (true by default). * \return void */ - static void SendInventoryChanges(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendInventoryChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; private: }; diff --git a/apps/openmw-mp/Script/Functions/Objects.cpp b/apps/openmw-mp/Script/Functions/Objects.cpp index f6b037c3a..380c1e712 100644 --- a/apps/openmw-mp/Script/Functions/Objects.cpp +++ b/apps/openmw-mp/Script/Functions/Objects.cpp @@ -399,133 +399,133 @@ void ObjectFunctions::AddContainerItem() noexcept tempContainerItem = emptyContainerItem; } -void ObjectFunctions::SendObjectPlace(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendObjectPlace(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_PLACE); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendObjectSpawn(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendObjectSpawn(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SPAWN); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendObjectDelete(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendObjectDelete(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_DELETE); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendObjectLock(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendObjectLock(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_LOCK); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendObjectTrap(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendObjectTrap(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_TRAP); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendObjectScale(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendObjectScale(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_SCALE); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendObjectState(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendObjectState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_OBJECT_STATE); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendDoorState(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendDoorState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_STATE); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendDoorDestination(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendDoorDestination(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_DOOR_DESTINATION); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendContainer(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendContainer(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONTAINER); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendVideoPlay(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendVideoPlay(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_VIDEO_PLAY); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void ObjectFunctions::SendConsoleCommand(bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void ObjectFunctions::SendConsoleCommand(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { mwmp::ObjectPacket *packet = mwmp::Networking::get().getObjectPacketController()->GetPacket(ID_CONSOLE_COMMAND); packet->setObjectList(&writeObjectList); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Objects.hpp b/apps/openmw-mp/Script/Functions/Objects.hpp index 6e7948f6b..f90c8bade 100644 --- a/apps/openmw-mp/Script/Functions/Objects.hpp +++ b/apps/openmw-mp/Script/Functions/Objects.hpp @@ -785,7 +785,7 @@ public: * to the packet (true by default). * \return void */ - static void SendObjectPlace(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendObjectPlace(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send an ObjectSpawn packet. @@ -796,7 +796,7 @@ public: * to the packet (true by default). * \return void */ - static void SendObjectSpawn(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendObjectSpawn(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send an ObjectDelete packet. @@ -806,7 +806,7 @@ public: * * \return void */ - static void SendObjectDelete(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendObjectDelete(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send an ObjectLock packet. @@ -817,7 +817,7 @@ public: * to the packet (true by default). * \return void */ - static void SendObjectLock(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendObjectLock(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send an ObjectTrap packet. @@ -827,7 +827,7 @@ public: * * \return void */ - static void SendObjectTrap(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendObjectTrap(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send an ObjectScale packet. @@ -838,7 +838,7 @@ public: * to the packet (true by default). * \return void */ - static void SendObjectScale(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendObjectScale(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send an ObjectState packet. @@ -849,7 +849,7 @@ public: * to the packet (true by default). * \return void */ - static void SendObjectState(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendObjectState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a DoorState packet. @@ -860,7 +860,7 @@ public: * to the packet (true by default). * \return void */ - static void SendDoorState(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendDoorState(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a DoorDestination packet. @@ -871,7 +871,7 @@ public: * to the packet (true by default). * \return void */ - static void SendDoorDestination(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendDoorDestination(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a Container packet. @@ -882,7 +882,7 @@ public: * to the packet (true by default). * \return void */ - static void SendContainer(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendContainer(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a VideoPlay packet. @@ -893,7 +893,7 @@ public: * to the packet (true by default). * \return void */ - static void SendVideoPlay(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendVideoPlay(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a ConsoleCommand packet. @@ -904,7 +904,7 @@ public: * to the packet (true by default). * \return void */ - static void SendConsoleCommand(bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendConsoleCommand(bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; // All methods below are deprecated versions of methods from above diff --git a/apps/openmw-mp/Script/Functions/Quests.cpp b/apps/openmw-mp/Script/Functions/Quests.cpp index 1a8ce11e3..383b0992a 100644 --- a/apps/openmw-mp/Script/Functions/Quests.cpp +++ b/apps/openmw-mp/Script/Functions/Quests.cpp @@ -149,7 +149,7 @@ int QuestFunctions::GetReputation(unsigned short pid) noexcept return player->npcStats.mReputation; } -void QuestFunctions::SendJournalChanges(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void QuestFunctions::SendJournalChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -157,13 +157,13 @@ void QuestFunctions::SendJournalChanges(unsigned short pid, bool sendToOtherPlay mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JOURNAL); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void QuestFunctions::SendKillChanges(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void QuestFunctions::SendKillChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -171,13 +171,13 @@ void QuestFunctions::SendKillChanges(unsigned short pid, bool sendToOtherPlayers mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_KILL_COUNT); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void QuestFunctions::SendReputation(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void QuestFunctions::SendReputation(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -185,7 +185,7 @@ void QuestFunctions::SendReputation(unsigned short pid, bool sendToOtherPlayers, mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_REPUTATION); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Quests.hpp b/apps/openmw-mp/Script/Functions/Quests.hpp index c3ec29583..14d3abe06 100644 --- a/apps/openmw-mp/Script/Functions/Quests.hpp +++ b/apps/openmw-mp/Script/Functions/Quests.hpp @@ -181,7 +181,7 @@ public: * to the packet (true by default). * \return void */ - static void SendJournalChanges(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendJournalChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a PlayerKillCount packet with a player's recorded kill count changes. @@ -193,7 +193,7 @@ public: * to the packet (true by default). * \return void */ - static void SendKillChanges(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendKillChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a PlayerReputation packet with a player's recorded reputation. @@ -205,7 +205,7 @@ public: * to the packet (true by default). * \return void */ - static void SendReputation(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendReputation(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; private: diff --git a/apps/openmw-mp/Script/Functions/Spells.cpp b/apps/openmw-mp/Script/Functions/Spells.cpp index e76613f71..369496414 100644 --- a/apps/openmw-mp/Script/Functions/Spells.cpp +++ b/apps/openmw-mp/Script/Functions/Spells.cpp @@ -269,7 +269,7 @@ int SpellFunctions::GetSpellEffectMagnMax(unsigned short pid, unsigned int i, un return player->spellbookChanges.spells.at(i).mEffects.mList.at(j).mMagnMax; } -void SpellFunctions::SendSpellbookChanges(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void SpellFunctions::SendSpellbookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -277,7 +277,7 @@ void SpellFunctions::SendSpellbookChanges(unsigned short pid, bool sendToOtherPl mwmp::PlayerPacket *packet = mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_SPELLBOOK); packet->setPlayer(player); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Spells.hpp b/apps/openmw-mp/Script/Functions/Spells.hpp index ab59a7ccf..266bc8fee 100644 --- a/apps/openmw-mp/Script/Functions/Spells.hpp +++ b/apps/openmw-mp/Script/Functions/Spells.hpp @@ -261,7 +261,7 @@ public: * to the packet (true by default). * \return void */ - static void SendSpellbookChanges(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendSpellbookChanges(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; private: diff --git a/apps/openmw-mp/Script/Functions/Worldstate.cpp b/apps/openmw-mp/Script/Functions/Worldstate.cpp index 214b7aa9d..1a2582c09 100644 --- a/apps/openmw-mp/Script/Functions/Worldstate.cpp +++ b/apps/openmw-mp/Script/Functions/Worldstate.cpp @@ -137,7 +137,7 @@ void WorldstateFunctions::LoadMapTileImageFile(int cellX, int cellY, const char* } } -void WorldstateFunctions::SendWorldMap(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void WorldstateFunctions::SendWorldMap(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -147,13 +147,13 @@ void WorldstateFunctions::SendWorldMap(unsigned short pid, bool sendToOtherPlaye mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_MAP); packet->setWorldstate(&writeWorldstate); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void WorldstateFunctions::SendWorldTime(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void WorldstateFunctions::SendWorldTime(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -163,13 +163,13 @@ void WorldstateFunctions::SendWorldTime(unsigned short pid, bool sendToOtherPlay mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_TIME); packet->setWorldstate(&writeWorldstate); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); } -void WorldstateFunctions::SendWorldCollisionOverride(unsigned short pid, bool sendToOtherPlayers, bool sendToAttachedPlayer) noexcept +void WorldstateFunctions::SendWorldCollisionOverride(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -179,7 +179,7 @@ void WorldstateFunctions::SendWorldCollisionOverride(unsigned short pid, bool se mwmp::WorldstatePacket *packet = mwmp::Networking::get().getWorldstatePacketController()->GetPacket(ID_WORLD_COLLISION_OVERRIDE); packet->setWorldstate(&writeWorldstate); - if (sendToAttachedPlayer) + if (!skipAttachedPlayer) packet->Send(false); if (sendToOtherPlayers) packet->Send(true); diff --git a/apps/openmw-mp/Script/Functions/Worldstate.hpp b/apps/openmw-mp/Script/Functions/Worldstate.hpp index 58e2eb180..1598105ea 100644 --- a/apps/openmw-mp/Script/Functions/Worldstate.hpp +++ b/apps/openmw-mp/Script/Functions/Worldstate.hpp @@ -223,7 +223,7 @@ public: * or to all players on the server. * \return void */ - static void SendWorldMap(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendWorldMap(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a WorldTime packet with the current time and time scale in the write-only @@ -236,7 +236,7 @@ public: * to the packet (true by default). * \return void */ - static void SendWorldTime(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendWorldTime(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; /** * \brief Send a WorldCollisionOverride packet with the current collision overrides in @@ -249,7 +249,7 @@ public: * to the packet (true by default). * \return void */ - static void SendWorldCollisionOverride(unsigned short pid, bool sendToOtherPlayers = false, bool sendToAttachedPlayer = true) noexcept; + static void SendWorldCollisionOverride(unsigned short pid, bool sendToOtherPlayers, bool skipAttachedPlayer) noexcept; }; diff --git a/apps/openmw-mp/Script/ScriptFunctions.cpp b/apps/openmw-mp/Script/ScriptFunctions.cpp index 1053a10d3..776b72353 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.cpp +++ b/apps/openmw-mp/Script/ScriptFunctions.cpp @@ -5,7 +5,6 @@ #include #include #include -#include template constexpr char TypeString::value[];