diff --git a/apps/openmw/mwmechanics/activespells.cpp b/apps/openmw/mwmechanics/activespells.cpp index b80fe7a76..285cdcb62 100644 --- a/apps/openmw/mwmechanics/activespells.cpp +++ b/apps/openmw/mwmechanics/activespells.cpp @@ -308,8 +308,10 @@ namespace MWMechanics Remove the spell with a certain ID and a certain timestamp, useful when there are stacked spells with the same ID + + Returns a boolean that indicates whether the corresponding spell was found */ - void ActiveSpells::removeSpellByTimestamp(const std::string& id, MWWorld::TimeStamp timestamp) + bool ActiveSpells::removeSpellByTimestamp(const std::string& id, MWWorld::TimeStamp timestamp) { for (TContainer::iterator spell = mSpells.begin(); spell != mSpells.end(); ++spell) { @@ -319,10 +321,12 @@ namespace MWMechanics { spell->second.mEffects.clear(); mSpellsChanged = true; - break; + return true; } } } + + return false; } /* End of tes3mp addition diff --git a/apps/openmw/mwmechanics/activespells.hpp b/apps/openmw/mwmechanics/activespells.hpp index aae4c032c..75a2f22d2 100644 --- a/apps/openmw/mwmechanics/activespells.hpp +++ b/apps/openmw/mwmechanics/activespells.hpp @@ -107,7 +107,7 @@ namespace MWMechanics Remove the spell with a certain ID and a certain timestamp, useful when there are stacked spells with the same ID */ - void removeSpellByTimestamp(const std::string& id, MWWorld::TimeStamp timestamp); + bool removeSpellByTimestamp(const std::string& id, MWWorld::TimeStamp timestamp); /* End of tes3mp addition */ diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 427b49dd6..019a0c4f0 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -824,11 +824,18 @@ void LocalPlayer::removeSpellsActive() for (const auto& activeSpell : spellsActiveChanges.activeSpells) { + LOG_APPEND(TimedLog::LOG_INFO, "- removing %sstacking active spell %s", activeSpell.isStackingSpell ? "" : "non-", activeSpell.id.c_str()); + // Remove stacking spells based on their timestamps if (activeSpell.isStackingSpell) { MWWorld::TimeStamp timestamp = MWWorld::TimeStamp(activeSpell.timestampHour, activeSpell.timestampDay); - activeSpells.removeSpellByTimestamp(activeSpell.id, timestamp); + bool foundSpell = activeSpells.removeSpellByTimestamp(activeSpell.id, timestamp); + + if (!foundSpell) + { + LOG_APPEND(TimedLog::LOG_INFO, "-- spell with this ID and timestamp could not be found!"); + } } else {