diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 912fab50d..7b4f6dad9 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -165,7 +165,7 @@ void Player::update() packet->Send(false); packet->Send(true); - attributeChanges.attributeIndexes.clear(); + attributeIndexChanges.clear(); } if (skillsChanged) @@ -175,7 +175,7 @@ void Player::update() packet->Send(false); packet->Send(true); - skillChanges.skillIndexes.clear(); + skillIndexChanges.clear(); } if (inventory.isEquipmentChanged()) @@ -493,8 +493,8 @@ void Player::setAttribute(unsigned short attributeId, int base, int current) creatureStats.mAttributes[attributeId].mBase = base; creatureStats.mAttributes[attributeId].mCurrent = current; - if (!Utils::vectorContains(&attributeChanges.attributeIndexes, attributeId)) - attributeChanges.attributeIndexes.push_back(attributeId); + if (!Utils::vectorContains(&attributeIndexChanges, attributeId)) + attributeIndexChanges.push_back(attributeId); attributesChanged = true; } @@ -519,8 +519,8 @@ void Player::setSkill(unsigned short skillId, int base, int current, float progr skill.mCurrent = current; skill.mProgress = progress; - if (!Utils::vectorContains(&skillChanges.skillIndexes, skillId)) - skillChanges.skillIndexes.push_back(skillId); + if (!Utils::vectorContains(&skillIndexChanges, skillId)) + skillIndexChanges.push_back(skillId); skillsChanged = true; } @@ -537,8 +537,8 @@ void Player::setSkillIncrease(unsigned short attributeId, int increase) npcStats.mSkillIncrease[attributeId] = increase; - if (!Utils::vectorContains(&attributeChanges.attributeIndexes, attributeId)) - attributeChanges.attributeIndexes.push_back(attributeId); + if (!Utils::vectorContains(&attributeIndexChanges, attributeId)) + attributeIndexChanges.push_back(attributeId); attributesChanged = true; } diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 39fbf170f..e6726e816 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -237,15 +237,15 @@ void LocalPlayer::updateAttributes(bool forceUpdate) { ptrNpcStats.getAttribute(i).writeState(creatureStats.mAttributes[i]); npcStats.mSkillIncrease[i] = ptrNpcStats.getSkillIncrease(i); - attributeChanges.attributeIndexes.push_back(i); + attributeIndexChanges.push_back(i); } } - if (attributeChanges.attributeIndexes.size() > 0) + if (attributeIndexChanges.size() > 0) { getNetworking()->getPlayerPacket(ID_PLAYER_ATTRIBUTE)->setPlayer(this); getNetworking()->getPlayerPacket(ID_PLAYER_ATTRIBUTE)->Send(); - attributeChanges.attributeIndexes.clear(); + attributeIndexChanges.clear(); } } @@ -266,15 +266,15 @@ void LocalPlayer::updateSkills(bool forceUpdate) forceUpdate) { ptrNpcStats.getSkill(i).writeState(npcStats.mSkills[i]); - skillChanges.skillIndexes.push_back(i); + skillIndexChanges.push_back(i); } } - if (skillChanges.skillIndexes.size() > 0) + if (skillIndexChanges.size() > 0) { getNetworking()->getPlayerPacket(ID_PLAYER_SKILL)->setPlayer(this); getNetworking()->getPlayerPacket(ID_PLAYER_SKILL)->Send(); - skillChanges.skillIndexes.clear(); + skillIndexChanges.clear(); } } diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index ff63c24aa..c690f08cc 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -79,20 +79,6 @@ namespace mwmp int type; // 0 - Cell load, 1 - Cell unload }; - // Track only the indexes of the attributes that have been changed, - // with the attribute values themselves being stored in creatureStats.mAttributes - struct AttributeChanges - { - std::vector attributeIndexes; - }; - - // Track only the indexes of the skills that have been changed, - // with the skill values themselves being stored in npcStats.mSkills - struct SkillChanges - { - std::vector skillIndexes; - }; - struct JournalChanges { std::vector journalItems; @@ -238,8 +224,13 @@ namespace mwmp GUIWindow guiWindow; double hour; - AttributeChanges attributeChanges; - SkillChanges skillChanges; + // Track only the indexes of the attributes that have been changed, + // with the attribute values themselves being stored in creatureStats.mAttributes + std::vector attributeIndexChanges; + + // Track only the indexes of the skills that have been changed, + // with the skill values themselves being stored in npcStats.mSkills + std::vector skillIndexChanges; SpellbookChanges spellbookChanges; JournalChanges journalChanges; diff --git a/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp b/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp index feb0884dc..f2564f4c7 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerAttribute.cpp @@ -15,17 +15,17 @@ void PacketPlayerAttribute::Packet(RakNet::BitStream *bs, bool send) uint32_t count; if (send) - count = static_cast(player->attributeChanges.attributeIndexes.size()); + count = static_cast(player->attributeIndexChanges.size()); RW(count, send); if (!send) { - player->attributeChanges.attributeIndexes.clear(); - player->attributeChanges.attributeIndexes.resize(count); + player->attributeIndexChanges.clear(); + player->attributeIndexChanges.resize(count); } - for (auto &&attributeIndex : player->attributeChanges.attributeIndexes) + for (auto &&attributeIndex : player->attributeIndexChanges) { RW(attributeIndex, send); diff --git a/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp b/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp index fb8553a7f..e204e8ba6 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerSkill.cpp @@ -21,17 +21,17 @@ void PacketPlayerSkill::Packet(RakNet::BitStream *bs, bool send) uint32_t count; if (send) - count = static_cast(player->skillChanges.skillIndexes.size()); + count = static_cast(player->skillIndexChanges.size()); RW(count, send); if (!send) { - player->skillChanges.skillIndexes.clear(); - player->skillChanges.skillIndexes.resize(count); + player->skillIndexChanges.clear(); + player->skillIndexChanges.resize(count); } - for (auto && skillId : player->skillChanges.skillIndexes) + for (auto && skillId : player->skillIndexChanges) { RW(skillId, send); RW(player->npcStats.mSkills[skillId], send);