From 3d03f5dee9c67fbbf60e1df940a91842bd8a7e4c Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Fri, 9 Aug 2013 22:24:26 +0200 Subject: Only call ability recharge callback if it is valid --- src/game-server/abilitycomponent.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/game-server/abilitycomponent.cpp') 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()); + } } } -- cgit v1.2.3-60-g2f50