diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-08-01 00:19:52 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-08-01 00:19:57 +0200 |
commit | 8f7053df40cd378bf8d165b4b878bace806965c9 (patch) | |
tree | 8268a4943040bdf2bef8a4f22d2f424fafff0b1e /src/game-server | |
parent | 9e25dbe968be4d772763156ab5a08e4f24eb6f38 (diff) | |
download | manaserv-8f7053df40cd378bf8d165b4b878bace806965c9.tar.gz manaserv-8f7053df40cd378bf8d165b4b878bace806965c9.tar.bz2 manaserv-8f7053df40cd378bf8d165b4b878bace806965c9.tar.xz manaserv-8f7053df40cd378bf8d165b4b878bace806965c9.zip |
Fixed issues with removing attribute modifiers
* AttributeModifiersEffect::remove was not calling updateMod with the
'value' parameter, causing it to have no effect at all for Stackable
modifiers.
* The cached value of the changed modifier effect was not being
recalculated when removing modifiers, because it started one layer too
high (there's an inconsistency here: AttributeModifiersEffect::add
updates this cached value while AttributeModifiersEffect::remove
doesn't).
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/attribute.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/game-server/attribute.cpp b/src/game-server/attribute.cpp index 82419e43..31d743f4 100644 --- a/src/game-server/attribute.cpp +++ b/src/game-server/attribute.cpp @@ -157,7 +157,7 @@ bool AttributeModifiersEffect::remove(double value, unsigned int id, /* If this is stackable, we need to update for every modifier affected */ if (mStackableType == Stackable) - updateMod(); + updateMod(value); ret = true; if (!id) @@ -283,9 +283,10 @@ bool Attribute::remove(double value, unsigned int layer, assert(mMods.size() > layer); if (mMods.at(layer)->remove(value, lvl, fullcheck)) { - while (++layer < mMods.size()) - if (!mMods.at(layer)->recalculateModifiedValue( - mMods.at(layer - 1)->getCachedModifiedValue())) + for (; layer < mMods.size(); ++layer) + if (!mMods.at(layer)->recalculateModifiedValue( + layer ? mMods.at(layer - 1)->getCachedModifiedValue() + : mBase)) return false; return true; } |