diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-26 20:04:36 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-26 20:04:49 +0200 |
commit | 2f68a9da7121ab2adaa70ff257577ee596b4c4ee (patch) | |
tree | d858a2eb16f2a89a856015a15396b87b835d12cd /src/game-server/character.cpp | |
parent | 53b547b11fb3c34bd6e2ae0bae0090f2677ef529 (diff) | |
download | manaserv-2f68a9da7121ab2adaa70ff257577ee596b4c4ee.tar.gz manaserv-2f68a9da7121ab2adaa70ff257577ee596b4c4ee.tar.xz manaserv-2f68a9da7121ab2adaa70ff257577ee596b4c4ee.zip |
Some general cleanups and merged Being::perform() into update()
The main change here is to remove the separate calling of 'perform' on all
beings, and rather rely on the beings to do whatever they were doing in
that function when the virtual 'update' function is called.
Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/game-server/character.cpp')
-rw-r--r-- | src/game-server/character.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index 031cf87..1a46ce5 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -18,11 +18,6 @@ * along with The Mana Server. If not, see <http://www.gnu.org/licenses/>. */ -#include <algorithm> -#include <cassert> -#include <cmath> -#include <limits.h> - #include "game-server/character.h" #include "common/configuration.h" @@ -47,6 +42,11 @@ #include "utils/logger.h" +#include <algorithm> +#include <cassert> +#include <cmath> +#include <limits.h> + // Experience curve related values const float Character::EXPCURVE_EXPONENT = 3.0f; const float Character::EXPCURVE_FACTOR = 10.0f; @@ -174,15 +174,17 @@ void Character::update() mStatusEffects[it->first] = it->second.time; it++; } + + processAttacks(); } -void Character::perform() +void Character::processAttacks() { // Ticks attacks even when not attacking to permit cooldowns and warmups. std::list<AutoAttack> attacksReady; mAutoAttacks.tick(&attacksReady); - if (mAction != ATTACK || mTarget == NULL) + if (mAction != ATTACK || !mTarget) { mAutoAttacks.stop(); return; |