summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-27 16:23:36 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-27 16:23:36 +0000
commit1554a6749f2dbcd9b44aae1df3e320a06b049d4f (patch)
tree08efd4ca4dc8a81bb53894d138cf702fd1d40c55
parent8ca48faeb472bb6645ec18c7b2e0480e8e20435e (diff)
downloadmana-client-1554a6749f2dbcd9b44aae1df3e320a06b049d4f.tar.gz
mana-client-1554a6749f2dbcd9b44aae1df3e320a06b049d4f.tar.bz2
mana-client-1554a6749f2dbcd9b44aae1df3e320a06b049d4f.tar.xz
mana-client-1554a6749f2dbcd9b44aae1df3e320a06b049d4f.zip
Cleaned the logic members.
-rw-r--r--ChangeLog3
-rw-r--r--src/being.cpp6
-rw-r--r--src/localplayer.cpp18
-rw-r--r--src/monster.cpp14
-rw-r--r--src/monster.h2
-rw-r--r--src/player.cpp20
-rw-r--r--src/player.h3
7 files changed, 12 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index b5364be0..2d7cbdd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,9 @@
* src/localplayer.cpp, src/beingmanager.cpp, src/player.cpp,
src/monster.cpp, src/net/playerhandler.cpp, src/being.h: Removed
Being::mFrame field.
+ * src/localplayer.cpp, src/player.cpp, src/monster.h, src/being.cpp,
+ src/monster.cpp, src/player.h: Cleaned the logic members.
+
2006-08-26 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/being.cpp b/src/being.cpp
index b49f790e..46fb67bb 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -285,6 +285,12 @@ Being::nextStep()
void
Being::logic()
{
+ // Determine whether the being should take another step
+ if (mAction == WALK && get_elapsed_time(mWalkTime) >= mWalkSpeed)
+ {
+ nextStep();
+ }
+
// Determine whether speech should still be displayed
if (get_elapsed_time(mSpeechTime) > 5000)
{
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 74924b1d..368bc8e3 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -52,21 +52,9 @@ LocalPlayer::~LocalPlayer()
void LocalPlayer::logic()
{
- switch (mAction) {
- case WALK:
- if (get_elapsed_time(mWalkTime) >= mWalkSpeed)
- {
- nextStep();
- }
- break;
-
- case ATTACK:
- if (get_elapsed_time(mWalkTime) >= mAttackSpeed)
- {
- nextStep();
- attack();
- }
- break;
+ if (mAction == ATTACK && get_elapsed_time(mWalkTime) >= mAttackSpeed)
+ {
+ attack();
}
// Actions are allowed once per second
diff --git a/src/monster.cpp b/src/monster.cpp
index 26345a6c..aba242b6 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -35,20 +35,6 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map):
mSprites[BASE_SPRITE] = new AnimatedSprite("graphics/sprites/monster" + toString(job - 1002) + ".xml", 0);
}
-void
-Monster::logic()
-{
- if (mAction != STAND)
- {
- if (get_elapsed_time(mWalkTime) >= mWalkSpeed && mAction != MONSTER_DEAD)
- {
- nextStep();
- }
- }
-
- Being::logic();
-}
-
Being::Type
Monster::getType() const
{
diff --git a/src/monster.h b/src/monster.h
index 4a82a461..6ce0d69d 100644
--- a/src/monster.h
+++ b/src/monster.h
@@ -31,8 +31,6 @@ class Monster : public Being
public:
Monster(Uint32 id, Uint16 job, Map *map);
- virtual void logic();
-
virtual Type getType() const;
};
diff --git a/src/player.cpp b/src/player.cpp
index 52f2cdb0..b635397e 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -42,26 +42,6 @@ Player::Player(Uint32 id, Uint16 job, Map *map):
new AnimatedSprite("graphics/sprites/weapons.xml", 0);
}
-void
-Player::logic()
-{
- switch (mAction) {
- case WALK:
- if (get_elapsed_time(mWalkTime) >= mWalkSpeed)
- {
- nextStep();
- }
- break;
- case ATTACK:
- if (get_elapsed_time(mWalkTime) >= mAttackSpeed)
- {
- nextStep();
- }
- break;
- }
- Being::logic();
-}
-
Being::Type
Player::getType() const
{
diff --git a/src/player.h b/src/player.h
index 5ff0509f..d0d55cc8 100644
--- a/src/player.h
+++ b/src/player.h
@@ -40,9 +40,6 @@ class Player : public Being
*/
Player(Uint32 id, Uint16 job, Map *map);
- virtual void
- logic();
-
virtual Type
getType() const;