summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/being.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index 6fce57e8..408b8fc0 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -669,8 +669,10 @@ void Being::update()
for (AttributeMap::iterator it = mAttributes.begin();
it != mAttributes.end();
++it)
+ {
if (it->second.tick())
updateDerivedAttributes(it->first);
+ }
// Update and run status effects
StatusEffects::iterator it = mStatus.begin();
@@ -682,10 +684,14 @@ void Being::update()
if (it->second.time <= 0 || mAction == DEAD)
{
- mStatus.erase(it);
- it = mStatus.begin();
+ StatusEffects::iterator removeIt = it;
+ it++; // bring this iterator to the safety of the next element
+ mStatus.erase(removeIt);
+ }
+ else
+ {
+ it++;
}
- it++;
}
// Check if being died