summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-03 19:46:13 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-01-03 19:46:13 +0100
commitac0a394505c0cf1124f48e4700e214d337c2e527 (patch)
treeb583a06055b36eb9b3af5ad5f66723b7fb277257 /src
parenta696323aa2a3e2430c888a2756c6a988233df94c (diff)
downloadmanaserv-ac0a394505c0cf1124f48e4700e214d337c2e527.tar.gz
manaserv-ac0a394505c0cf1124f48e4700e214d337c2e527.tar.bz2
manaserv-ac0a394505c0cf1124f48e4700e214d337c2e527.tar.xz
manaserv-ac0a394505c0cf1124f48e4700e214d337c2e527.zip
Change Actor::mActionTime to mMoveTime member to reflect more its actual use.
Trivial.
Diffstat (limited to 'src')
-rw-r--r--src/game-server/actor.h4
-rw-r--r--src/game-server/being.cpp16
-rw-r--r--src/game-server/character.cpp6
3 files changed, 14 insertions, 12 deletions
diff --git a/src/game-server/actor.h b/src/game-server/actor.h
index 483cb78e..b5c634f4 100644
--- a/src/game-server/actor.h
+++ b/src/game-server/actor.h
@@ -52,7 +52,7 @@ class Actor : public Thing
*/
Actor(ThingType type)
: Thing(type),
- mActionTime(0),
+ mMoveTime(0),
mUpdateFlags(0),
mPublicID(65535),
mSize(0)
@@ -130,7 +130,7 @@ class Actor : public Thing
virtual Map::BlockType getBlockType() const
{ return Map::BLOCKTYPE_NONE; }
- unsigned short mActionTime; /**< Delay until next action. */
+ unsigned short mMoveTime; /**< Delay until next action. */
private:
char mUpdateFlags; /**< Changes in actor status. */
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index e266da0d..4e78586d 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -211,10 +211,10 @@ void Being::move()
mOld = getPosition();
- if (mActionTime > 100)
+ if (mMoveTime > 100)
{
// Current move has not yet ended
- mActionTime -= 100;
+ mMoveTime -= 100;
return;
}
@@ -230,7 +230,7 @@ void Being::move()
setAction(STAND);
// Moving while staying on the same tile is free
setPosition(mDst);
- mActionTime = 0;
+ mMoveTime = 0;
return;
}
@@ -264,7 +264,7 @@ void Being::move()
setAction(STAND);
// no path was found
mDst = mOld;
- mActionTime = 0;
+ mMoveTime = 0;
return;
}
@@ -277,7 +277,7 @@ void Being::move()
Position next = mPath.front();
mPath.pop_front();
// SQRT2 is used for diagonal movement.
- mActionTime += (prev.x == next.x || prev.y == next.y) ?
+ mMoveTime += (prev.x == next.x || prev.y == next.y) ?
getModifiedAttribute(ATTR_MOVE_SPEED_RAW) :
getModifiedAttribute(ATTR_MOVE_SPEED_RAW) * SQRT2;
if (mPath.empty())
@@ -291,10 +291,10 @@ void Being::move()
pos.x = next.x * tileWidth + (tileWidth / 2);
pos.y = next.y * tileHeight + (tileHeight / 2);
}
- while (mActionTime < 100);
+ while (mMoveTime < 100);
setPosition(pos);
- mActionTime = mActionTime > 100 ? mActionTime - 100 : 0;
+ mMoveTime = mMoveTime > 100 ? mMoveTime - 100 : 0;
}
int Being::directionToAngle(int direction)
@@ -331,7 +331,7 @@ int Being::performAttack(Being *target, unsigned range, const Damage &damage)
if (maxDist * maxDist < distSquare)
return -1;
- //mActionTime += 1000; // No tick. Auto-attacks should have their own, built-in delays.
+ // Note: The auto-attack system will handle the delay between two attacks.
return (mTarget->damage(this, damage));
}
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index 49cecebc..3fadf18e 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -146,9 +146,11 @@ void Character::perform()
if (mAction != ATTACK || mTarget == NULL) return;
// wait before next attack
- if (mActionTime > 100)
+ // Note: The auto-attack system will handle the delay between two attacks.
+ // TODO: Remove this condition when it's done.
+ if (mMoveTime > 100)
{
- mActionTime -= 100;
+ mMoveTime -= 100;
return;
}