aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-01 15:26:44 -0500
committermegamage <none@none>2009-06-01 15:26:44 -0500
commit30544055ded8d8d617e8462f373b6d2a24b6a100 (patch)
treeb75828f4c9ecc808f07cb3b4cca85c6c283229ad /src/game/Player.cpp
parent00d9a7b351fb0f474cb4859d120424dcbce97d78 (diff)
parent3a223e0e8075139f4a91572ec33fa2841fd60c2d (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 3d86d52919f..d90183f2a0c 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -17040,6 +17040,28 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
}
}
+// Restore spellmods in case of failed cast
+void Player::RestoreSpellMods(Spell const* spell)
+{
+ if(!spell || (m_SpellModRemoveCount == 0))
+ return;
+
+ for(int i=0;i<MAX_SPELLMOD;++i)
+ {
+ for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();++itr)
+ {
+ SpellModifier *mod = *itr;
+
+ if (mod && mod->charges == -1 && mod->lastAffected == spell)
+ {
+ mod->lastAffected = NULL;
+ mod->charges = 1;
+ m_SpellModRemoveCount--;
+ }
+ }
+ }
+}
+
void Player::RemoveSpellMods(Spell const* spell)
{
if(!spell || (m_SpellModRemoveCount == 0))