From d308897f95d1d98c1e102978ea18010ef1f8fed3 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 20 Jan 2017 12:43:05 +0200 Subject: [PATCH] Rename PacketItems, PacketSpells into InventoryChanges, SpellbookChanges --- apps/openmw-mp/Player.hpp | 4 +- apps/openmw-mp/Script/Functions/Items.cpp | 32 ++++++------- apps/openmw-mp/Script/Functions/Items.hpp | 36 +++++++-------- apps/openmw-mp/Script/Functions/Spells.cpp | 28 +++++------ apps/openmw-mp/Script/Functions/Spells.hpp | 16 +++---- apps/openmw/mwmp/LocalPlayer.cpp | 46 +++++++++---------- apps/openmw/mwmp/Networking.cpp | 16 +++---- components/openmw-mp/Base/BasePlayer.hpp | 15 +++--- .../Packets/Player/PacketInventory.cpp | 14 +++--- .../Packets/Player/PacketSpellbook.cpp | 14 +++--- 10 files changed, 111 insertions(+), 110 deletions(-) diff --git a/apps/openmw-mp/Player.hpp b/apps/openmw-mp/Player.hpp index bbef2dcac..6d30f1b2e 100644 --- a/apps/openmw-mp/Player.hpp +++ b/apps/openmw-mp/Player.hpp @@ -68,8 +68,8 @@ public: virtual ~Player(); public: - mwmp::PacketItems packetItemsBuffer; - mwmp::PacketSpells packetSpellsBuffer; + mwmp::InventoryChanges inventoryChangesBuffer; + mwmp::SpellbookChanges spellbookChangesBuffer; private: bool handshakeState; diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index f6377ea4a..98c8cf60f 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -16,12 +16,12 @@ int ItemFunctions::GetEquipmentSize() noexcept return MWWorld::InventoryStore::Slots; } -unsigned int ItemFunctions::GetInventorySize(unsigned short pid) noexcept +unsigned int ItemFunctions::GetInventoryChangesSize(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, 0); - return player->packetItems.count; + return player->inventoryChanges.count; } void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const char *itemId, unsigned int count, int health) noexcept @@ -52,8 +52,8 @@ void ItemFunctions::AddItem(unsigned short pid, const char* itemId, unsigned int item.count = count; item.health = health; - player->packetItemsBuffer.items.push_back(item); - player->packetItemsBuffer.action = PacketItems::ADD; + player->inventoryChangesBuffer.items.push_back(item); + player->inventoryChangesBuffer.action = InventoryChanges::ADD; } void ItemFunctions::RemoveItem(unsigned short pid, const char* itemId, unsigned short count) noexcept @@ -65,8 +65,8 @@ void ItemFunctions::RemoveItem(unsigned short pid, const char* itemId, unsigned item.refid = itemId; item.count = count; - player->packetItemsBuffer.items.push_back(item); - player->packetItemsBuffer.action = PacketItems::REMOVE; + player->inventoryChangesBuffer.items.push_back(item); + player->inventoryChangesBuffer.action = InventoryChanges::REMOVE; } void ItemFunctions::ClearInventory(unsigned short pid) noexcept @@ -74,8 +74,8 @@ void ItemFunctions::ClearInventory(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - player->packetItemsBuffer.items.clear(); - player->packetItemsBuffer.action = PacketItems::SET; + player->inventoryChangesBuffer.items.clear(); + player->inventoryChangesBuffer.action = InventoryChanges::SET; } bool ItemFunctions::HasItemEquipped(unsigned short pid, const char* itemId) @@ -118,10 +118,10 @@ const char *ItemFunctions::GetInventoryItemId(unsigned short pid, unsigned int i Player *player; GET_PLAYER(pid, player, ""); - if (i >= player->packetItems.count) + if (i >= player->inventoryChanges.count) return "invalid"; - return player->packetItems.items.at(i).refid.c_str(); + return player->inventoryChanges.items.at(i).refid.c_str(); } int ItemFunctions::GetInventoryItemCount(unsigned short pid, unsigned int i) noexcept @@ -129,7 +129,7 @@ int ItemFunctions::GetInventoryItemCount(unsigned short pid, unsigned int i) noe Player *player; GET_PLAYER(pid, player, 0); - return player->packetItems.items.at(i).count; + return player->inventoryChanges.items.at(i).count; } int ItemFunctions::GetInventoryItemHealth(unsigned short pid, unsigned int i) noexcept @@ -137,7 +137,7 @@ int ItemFunctions::GetInventoryItemHealth(unsigned short pid, unsigned int i) no Player *player; GET_PLAYER(pid, player, 0); - return player->packetItems.items.at(i).health; + return player->inventoryChanges.items.at(i).health; } void ItemFunctions::SendEquipment(unsigned short pid) noexcept @@ -149,13 +149,13 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true); } -void ItemFunctions::SendItems(unsigned short pid) noexcept +void ItemFunctions::SendInventoryChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); - std::swap(player->packetItems, player->packetItemsBuffer); + std::swap(player->inventoryChanges, player->inventoryChangesBuffer); mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_INVENTORY)->Send(player, false); - player->packetItems = std::move(player->packetItemsBuffer); - player->packetItemsBuffer.items.clear(); + player->inventoryChanges = std::move(player->inventoryChangesBuffer); + player->inventoryChangesBuffer.items.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Items.hpp b/apps/openmw-mp/Script/Functions/Items.hpp index 86242d2fc..50f9191b8 100644 --- a/apps/openmw-mp/Script/Functions/Items.hpp +++ b/apps/openmw-mp/Script/Functions/Items.hpp @@ -6,35 +6,35 @@ #define OPENMW_ITEMS_HPP #define ITEMAPI \ - {"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\ - {"GetInventorySize", ItemFunctions::GetInventorySize},\ + {"GetEquipmentSize", ItemFunctions::GetEquipmentSize},\ + {"GetInventoryChangesSize", ItemFunctions::GetInventoryChangesSize},\ \ - {"EquipItem", ItemFunctions::EquipItem},\ - {"UnequipItem", ItemFunctions::UnequipItem},\ + {"EquipItem", ItemFunctions::EquipItem},\ + {"UnequipItem", ItemFunctions::UnequipItem},\ \ - {"AddItem", ItemFunctions::AddItem},\ - {"RemoveItem", ItemFunctions::RemoveItem},\ - {"ClearInventory", ItemFunctions::ClearInventory},\ + {"AddItem", ItemFunctions::AddItem},\ + {"RemoveItem", ItemFunctions::RemoveItem},\ + {"ClearInventory", ItemFunctions::ClearInventory},\ \ - {"HasItemEquipped", ItemFunctions::HasItemEquipped},\ + {"HasItemEquipped", ItemFunctions::HasItemEquipped},\ \ - {"GetEquipmentItemId", ItemFunctions::GetEquipmentItemId},\ - {"GetEquipmentItemCount", ItemFunctions::GetEquipmentItemCount},\ - {"GetEquipmentItemHealth", ItemFunctions::GetEquipmentItemHealth},\ + {"GetEquipmentItemId", ItemFunctions::GetEquipmentItemId},\ + {"GetEquipmentItemCount", ItemFunctions::GetEquipmentItemCount},\ + {"GetEquipmentItemHealth", ItemFunctions::GetEquipmentItemHealth},\ \ - {"GetInventoryItemId", ItemFunctions::GetInventoryItemId},\ - {"GetInventoryItemCount", ItemFunctions::GetInventoryItemCount},\ - {"GetInventoryItemHealth", ItemFunctions::GetInventoryItemHealth},\ + {"GetInventoryItemId", ItemFunctions::GetInventoryItemId},\ + {"GetInventoryItemCount", ItemFunctions::GetInventoryItemCount},\ + {"GetInventoryItemHealth", ItemFunctions::GetInventoryItemHealth},\ \ - {"SendEquipment", ItemFunctions::SendEquipment},\ - {"SendItems", ItemFunctions::SendItems} + {"SendEquipment", ItemFunctions::SendEquipment},\ + {"SendInventoryChanges", ItemFunctions::SendInventoryChanges} class ItemFunctions { public: static int GetEquipmentSize() noexcept; - static unsigned int GetInventorySize(unsigned short pid) noexcept; + static unsigned int GetInventoryChangesSize(unsigned short pid) noexcept; static void EquipItem(unsigned short pid, unsigned short slot, const char* itemId, unsigned int count, int health) noexcept; static void UnequipItem(unsigned short pid, unsigned short slot) noexcept; @@ -54,7 +54,7 @@ public: static int GetInventoryItemHealth(unsigned short pid, unsigned int i) noexcept; static void SendEquipment(unsigned short pid) noexcept; - static void SendItems(unsigned short pid) noexcept; + static void SendInventoryChanges(unsigned short pid) noexcept; private: }; diff --git a/apps/openmw-mp/Script/Functions/Spells.cpp b/apps/openmw-mp/Script/Functions/Spells.cpp index 8515efc1b..06289ab5d 100644 --- a/apps/openmw-mp/Script/Functions/Spells.cpp +++ b/apps/openmw-mp/Script/Functions/Spells.cpp @@ -6,12 +6,12 @@ using namespace mwmp; -unsigned int SpellFunctions::GetSpellbookSize(unsigned short pid) noexcept +unsigned int SpellFunctions::GetSpellbookChangesSize(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, 0); - return player->packetSpells.count; + return player->spellbookChanges.count; } void SpellFunctions::AddSpell(unsigned short pid, const char* spellId) noexcept @@ -22,8 +22,8 @@ void SpellFunctions::AddSpell(unsigned short pid, const char* spellId) noexcept ESM::Spell spell; spell.mId = spellId; - player->packetSpellsBuffer.spells.push_back(spell); - player->packetSpellsBuffer.action = PacketSpells::ADD; + player->spellbookChangesBuffer.spells.push_back(spell); + player->spellbookChangesBuffer.action = SpellbookChanges::ADD; } void SpellFunctions::RemoveSpell(unsigned short pid, const char* spellId) noexcept @@ -34,8 +34,8 @@ void SpellFunctions::RemoveSpell(unsigned short pid, const char* spellId) noexce ESM::Spell spell; spell.mId = spellId; - player->packetSpellsBuffer.spells.push_back(spell); - player->packetSpellsBuffer.action = PacketSpells::REMOVE; + player->spellbookChangesBuffer.spells.push_back(spell); + player->spellbookChangesBuffer.action = SpellbookChanges::REMOVE; } void SpellFunctions::ClearSpellbook(unsigned short pid) noexcept @@ -43,8 +43,8 @@ void SpellFunctions::ClearSpellbook(unsigned short pid) noexcept Player *player; GET_PLAYER(pid, player, ); - player->packetSpellsBuffer.spells.clear(); - player->packetSpellsBuffer.action = PacketSpells::SET; + player->spellbookChangesBuffer.spells.clear(); + player->spellbookChangesBuffer.action = SpellbookChanges::SET; } const char *SpellFunctions::GetSpellId(unsigned short pid, unsigned int i) noexcept @@ -52,19 +52,19 @@ const char *SpellFunctions::GetSpellId(unsigned short pid, unsigned int i) noexc Player *player; GET_PLAYER(pid, player, ""); - if (i >= player->packetSpells.count) + if (i >= player->spellbookChanges.count) return "invalid"; - return player->packetSpells.spells.at(i).mId.c_str(); + return player->spellbookChanges.spells.at(i).mId.c_str(); } -void SpellFunctions::SendSpells(unsigned short pid) noexcept +void SpellFunctions::SendSpellbookChanges(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ); - std::swap(player->packetSpells, player->packetSpellsBuffer); + std::swap(player->spellbookChanges, player->spellbookChangesBuffer); mwmp::Networking::get().getPlayerController()->GetPacket(ID_GAME_SPELLBOOK)->Send(player, false); - player->packetSpells = std::move(player->packetSpellsBuffer); - player->packetSpellsBuffer.spells.clear(); + player->spellbookChanges = std::move(player->spellbookChangesBuffer); + player->spellbookChangesBuffer.spells.clear(); } diff --git a/apps/openmw-mp/Script/Functions/Spells.hpp b/apps/openmw-mp/Script/Functions/Spells.hpp index 841bd31dd..8e21e7297 100644 --- a/apps/openmw-mp/Script/Functions/Spells.hpp +++ b/apps/openmw-mp/Script/Functions/Spells.hpp @@ -2,21 +2,21 @@ #define OPENMW_SPELLS_HPP #define SPELLAPI \ - {"GetSpellbookSize", SpellFunctions::GetSpellbookSize},\ + {"GetSpellbookChangesSize", SpellFunctions::GetSpellbookChangesSize},\ \ - {"AddSpell", SpellFunctions::AddSpell},\ - {"RemoveSpell", SpellFunctions::RemoveSpell},\ - {"ClearSpellbook", SpellFunctions::ClearSpellbook},\ + {"AddSpell", SpellFunctions::AddSpell},\ + {"RemoveSpell", SpellFunctions::RemoveSpell},\ + {"ClearSpellbook", SpellFunctions::ClearSpellbook},\ \ - {"GetSpellId", SpellFunctions::GetSpellId},\ + {"GetSpellId", SpellFunctions::GetSpellId},\ \ - {"SendSpells", SpellFunctions::SendSpells} + {"SendSpellbookChanges", SpellFunctions::SendSpellbookChanges} class SpellFunctions { public: - static unsigned int GetSpellbookSize(unsigned short pid) noexcept; + static unsigned int GetSpellbookChangesSize(unsigned short pid) noexcept; static void AddSpell(unsigned short pid, const char* spellId) noexcept; static void RemoveSpell(unsigned short pid, const char* spellId) noexcept; @@ -24,7 +24,7 @@ public: static const char *GetSpellId(unsigned short pid, unsigned int i) noexcept; - static void SendSpells(unsigned short pid) noexcept; + static void SendSpellbookChanges(unsigned short pid) noexcept; private: }; diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 66683d8f6..a1d9e1fcb 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -433,7 +433,7 @@ void LocalPlayer::updateInventory(bool forceUpdate) if (!invChanged) { - for (vector::iterator iter = packetItems.items.begin(); iter != packetItems.items.end(); ++iter) + for (vector::iterator iter = inventoryChanges.items.begin(); iter != inventoryChanges.items.end(); ++iter) { MWWorld::ContainerStoreIterator result(ptrInventory.begin()); for (; result != ptrInventory.end(); ++result) @@ -467,15 +467,15 @@ void LocalPlayer::updateInventory(bool forceUpdate) item.count = iter->getRefData().getCount(); item.health = iter->getCellRef().getCharge(); - vector::iterator result = packetItems.items.begin(); + vector::iterator result = inventoryChanges.items.begin(); - for (; result != packetItems.items.end(); result++) + for (; result != inventoryChanges.items.end(); result++) { if ((*result) == item) break; } - if (result == packetItems.items.end()) + if (result == inventoryChanges.items.end()) { invChanged = true; break; @@ -624,9 +624,9 @@ void LocalPlayer::addItems() MWWorld::Ptr ptrPlayer = getPlayerPtr(); MWWorld::ContainerStore &ptrStore = ptrPlayer.getClass().getContainerStore(ptrPlayer); - for (unsigned int i = 0; i < packetItems.count; i++) + for (unsigned int i = 0; i < inventoryChanges.count; i++) { - mwmp::Item item = packetItems.items[i]; + mwmp::Item item = inventoryChanges.items[i]; MWWorld::Ptr itemPtr = *ptrStore.add(item.refid, item.count, ptrPlayer); if (item.health != -1) itemPtr.getCellRef().setCharge(item.health); @@ -638,7 +638,7 @@ void LocalPlayer::addSpells() MWWorld::Ptr ptrPlayer = getPlayerPtr(); MWMechanics::Spells &ptrSpells = ptrPlayer.getClass().getCreatureStats(ptrPlayer).getSpells(); - for (vector::const_iterator spell = packetSpells.spells.begin(); spell != packetSpells.spells.end(); spell++) + for (vector::const_iterator spell = spellbookChanges.spells.begin(); spell != spellbookChanges.spells.end(); spell++) ptrSpells.add(spell->mId); } @@ -648,9 +648,9 @@ void LocalPlayer::removeItems() MWWorld::Ptr ptrPlayer = getPlayerPtr(); MWWorld::ContainerStore &ptrStore = ptrPlayer.getClass().getContainerStore(ptrPlayer); - for (unsigned int i = 0; i < packetItems.count; i++) + for (unsigned int i = 0; i < inventoryChanges.count; i++) { - mwmp::Item item = packetItems.items[i]; + mwmp::Item item = inventoryChanges.items[i]; ptrStore.remove(item.refid, item.count, ptrPlayer); } } @@ -660,7 +660,7 @@ void LocalPlayer::removeSpells() MWWorld::Ptr ptrPlayer = getPlayerPtr(); MWMechanics::Spells &ptrSpells = ptrPlayer.getClass().getCreatureStats(ptrPlayer).getSpells(); - for (vector::const_iterator spell = packetSpells.spells.begin(); spell != packetSpells.spells.end(); spell++) + for (vector::const_iterator spell = spellbookChanges.spells.begin(); spell != spellbookChanges.spells.end(); spell++) { ptrSpells.remove(spell->mId); @@ -917,7 +917,7 @@ void LocalPlayer::sendInventory() MWWorld::InventoryStore &ptrInventory = ptrPlayer.getClass().getInventoryStore(ptrPlayer); mwmp::Item item; - packetItems.items.clear(); + inventoryChanges.items.clear(); for (MWWorld::ContainerStoreIterator iter(ptrInventory.begin()); iter != ptrInventory.end(); ++iter) { @@ -928,11 +928,11 @@ void LocalPlayer::sendInventory() item.count = iter->getRefData().getCount(); item.health = iter->getCellRef().getCharge(); - packetItems.items.push_back(item); + inventoryChanges.items.push_back(item); } - packetItems.count = (unsigned int) packetItems.items.size(); - packetItems.action = PacketItems::SET; + inventoryChanges.count = (unsigned int) inventoryChanges.items.size(); + inventoryChanges.action = InventoryChanges::SET; Main::get().getNetworking()->getPlayerPacket(ID_GAME_INVENTORY)->Send(this); } @@ -941,7 +941,7 @@ void LocalPlayer::sendSpellbook() MWWorld::Ptr ptrPlayer = getPlayerPtr(); MWMechanics::Spells &ptrSpells = ptrPlayer.getClass().getCreatureStats(ptrPlayer).getSpells(); - packetSpells.spells.clear(); + spellbookChanges.spells.clear(); // Send spells in spellbook, while ignoring abilities, powers, etc. for (MWMechanics::Spells::TIterator iter = ptrSpells.begin(); iter != ptrSpells.end(); ++iter) @@ -950,11 +950,11 @@ void LocalPlayer::sendSpellbook() if (spell->mData.mType == ESM::Spell::ST_Spell) { - packetSpells.spells.push_back(*spell); + spellbookChanges.spells.push_back(*spell); } } - packetSpells.action = PacketSpells::SET; + spellbookChanges.action = SpellbookChanges::SET; Main::get().getNetworking()->getPlayerPacket(ID_GAME_SPELLBOOK)->Send(this); } @@ -963,13 +963,13 @@ void LocalPlayer::sendSpellAddition(std::string id) if (id.find("$dynamic") != string::npos) // skip custom spells return; - packetSpells.spells.clear(); + spellbookChanges.spells.clear(); ESM::Spell spell; spell.mId = id; - packetSpells.spells.push_back(spell); + spellbookChanges.spells.push_back(spell); - packetSpells.action = PacketSpells::ADD; + spellbookChanges.action = SpellbookChanges::ADD; Main::get().getNetworking()->getPlayerPacket(ID_GAME_SPELLBOOK)->Send(this); } @@ -978,13 +978,13 @@ void LocalPlayer::sendSpellRemoval(std::string id) if (id.find("$dynamic") != string::npos) // skip custom spells return; - packetSpells.spells.clear(); + spellbookChanges.spells.clear(); ESM::Spell spell; spell.mId = id; - packetSpells.spells.push_back(spell); + spellbookChanges.spells.push_back(spell); - packetSpells.action = PacketSpells::REMOVE; + spellbookChanges.action = SpellbookChanges::REMOVE; Main::get().getNetworking()->getPlayerPacket(ID_GAME_SPELLBOOK)->Send(this); } diff --git a/apps/openmw/mwmp/Networking.cpp b/apps/openmw/mwmp/Networking.cpp index d449e3583..590f32609 100644 --- a/apps/openmw/mwmp/Networking.cpp +++ b/apps/openmw/mwmp/Networking.cpp @@ -299,17 +299,17 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) else { myPacket->Packet(&bsIn, getLocalPlayer(), false); - int inventoryAction = getLocalPlayer()->packetItems.action; + int inventoryAction = getLocalPlayer()->inventoryChanges.action; - if (inventoryAction == PacketItems::ADD) + if (inventoryAction == InventoryChanges::ADD) { getLocalPlayer()->addItems(); } - else if (inventoryAction == PacketItems::REMOVE) + else if (inventoryAction == InventoryChanges::REMOVE) { getLocalPlayer()->removeItems(); } - else // PacketItems::SET + else // InventoryChanges::SET { getLocalPlayer()->setInventory(); } @@ -328,17 +328,17 @@ void Networking::processPlayerPacket(RakNet::Packet *packet) else { myPacket->Packet(&bsIn, getLocalPlayer(), false); - int spellbookAction = getLocalPlayer()->packetSpells.action; + int spellbookAction = getLocalPlayer()->spellbookChanges.action; - if (spellbookAction == PacketSpells::ADD) + if (spellbookAction == SpellbookChanges::ADD) { getLocalPlayer()->addSpells(); } - else if (spellbookAction == PacketSpells::REMOVE) + else if (spellbookAction == SpellbookChanges::REMOVE) { getLocalPlayer()->removeSpells(); } - else // PacketSpells::SET + else // SpellbookChanges::SET { getLocalPlayer()->setSpellbook(); } diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index 1163bcca1..ac13689a8 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -64,7 +64,7 @@ namespace mwmp unsigned int count; }; - struct PacketItems + struct InventoryChanges { std::vector items; unsigned int count; @@ -77,7 +77,7 @@ namespace mwmp int action; //0 - Clear and set in entirety, 1 - Add item, 2 - Remove item }; - struct PacketSpells + struct SpellbookChanges { std::vector spells; unsigned int count; @@ -119,9 +119,10 @@ namespace mwmp BasePlayer(RakNet::RakNetGUID guid) : guid(guid) { - packetItems.action = 0; - packetItems.count = 0; - packetItems.action = 0; + inventoryChanges.action = 0; + inventoryChanges.count = 0; + spellbookChanges.action = 0; + spellbookChanges.count = 0; } BasePlayer() @@ -206,8 +207,8 @@ namespace mwmp int month; int day; double hour; - PacketItems packetItems; - PacketSpells packetSpells; + InventoryChanges inventoryChanges; + SpellbookChanges spellbookChanges; bool consoleAllowed; bool ignorePosPacket; ESM::ActiveSpells activeSpells; diff --git a/components/openmw-mp/Packets/Player/PacketInventory.cpp b/components/openmw-mp/Packets/Player/PacketInventory.cpp index 429f69576..d028c33b0 100644 --- a/components/openmw-mp/Packets/Player/PacketInventory.cpp +++ b/components/openmw-mp/Packets/Player/PacketInventory.cpp @@ -17,22 +17,22 @@ void PacketInventory::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen { PlayerPacket::Packet(bs, player, send); - RW(player->packetItems.action, send); + RW(player->inventoryChanges.action, send); if (!send) - player->packetItems.items.clear(); + player->inventoryChanges.items.clear(); else - player->packetItems.count = (unsigned int) (player->packetItems.items.size()); + player->inventoryChanges.count = (unsigned int) (player->inventoryChanges.items.size()); - RW(player->packetItems.count, send); + RW(player->inventoryChanges.count, send); - for (unsigned int i = 0; i < player->packetItems.count; i++) + for (unsigned int i = 0; i < player->inventoryChanges.count; i++) { Item item; if (send) { - item = player->packetItems.items[i]; + item = player->inventoryChanges.items[i]; RW(item.refid, send); RW(item.count, send); RW(item.health, send); @@ -42,7 +42,7 @@ void PacketInventory::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen RW(item.refid, send); RW(item.count, send); RW(item.health, send); - player->packetItems.items.push_back(item); + player->inventoryChanges.items.push_back(item); } } } diff --git a/components/openmw-mp/Packets/Player/PacketSpellbook.cpp b/components/openmw-mp/Packets/Player/PacketSpellbook.cpp index 62afe5790..1b9094d77 100644 --- a/components/openmw-mp/Packets/Player/PacketSpellbook.cpp +++ b/components/openmw-mp/Packets/Player/PacketSpellbook.cpp @@ -13,28 +13,28 @@ void PacketSpellbook::Packet(RakNet::BitStream *bs, BasePlayer *player, bool sen { PlayerPacket::Packet(bs, player, send); - RW(player->packetSpells.action, send); + RW(player->spellbookChanges.action, send); if (!send) - player->packetSpells.spells.clear(); + player->spellbookChanges.spells.clear(); else - player->packetSpells.count = (unsigned int) (player->packetSpells.spells.size()); + player->spellbookChanges.count = (unsigned int) (player->spellbookChanges.spells.size()); - RW(player->packetSpells.count, send); + RW(player->spellbookChanges.count, send); - for (unsigned int i = 0; i < player->packetSpells.count; i++) + for (unsigned int i = 0; i < player->spellbookChanges.count; i++) { ESM::Spell spell; if (send) { - spell = player->packetSpells.spells[i]; + spell = player->spellbookChanges.spells[i]; RW(spell.mId, send); } else { RW(spell.mId, send); - player->packetSpells.spells.push_back(spell); + player->spellbookChanges.spells.push_back(spell); } }