diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-08-09 22:24:26 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-08-26 22:56:47 +0200 |
commit | 3d03f5dee9c67fbbf60e1df940a91842bd8a7e4c (patch) | |
tree | 34749eb2439b82ac49e4fd10271e8ad31ff8771f | |
parent | ff7b47229238738f92125e84d30d4e35efb362c8 (diff) | |
download | manaserv-3d03f5dee9c67fbbf60e1df940a91842bd8a7e4c.tar.gz manaserv-3d03f5dee9c67fbbf60e1df940a91842bd8a7e4c.tar.bz2 manaserv-3d03f5dee9c67fbbf60e1df940a91842bd8a7e4c.tar.xz manaserv-3d03f5dee9c67fbbf60e1df940a91842bd8a7e4c.zip |
Only call ability recharge callback if it is valid
-rw-r--r-- | src/game-server/abilitycomponent.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/game-server/abilitycomponent.cpp b/src/game-server/abilitycomponent.cpp index 19e832cb..d3154490 100644 --- a/src/game-server/abilitycomponent.cpp +++ b/src/game-server/abilitycomponent.cpp @@ -41,11 +41,14 @@ void AbilityComponent::update(Entity &entity) auto &ability = it.second; if (!ability.recharged && ability.rechargeTimeout.expired()) { ability.recharged = true; - Script *script = ScriptManager::currentState(); - script->prepare(ability.abilityInfo->rechargedCallback); - script->push(&entity); - script->push(ability.abilityInfo->id); - script->execute(entity.getMap()); + + if (ability.abilityInfo->rechargedCallback) { + Script *script = ScriptManager::currentState(); + script->prepare(ability.abilityInfo->rechargedCallback); + script->push(&entity); + script->push(ability.abilityInfo->id); + script->execute(entity.getMap()); + } } } |