diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-06 12:36:14 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-06 12:36:14 +0100 |
commit | 57701ac70f2b81e11eedb4c01f680e46c1abadb2 (patch) | |
tree | f75159985b58c87a39fe7d602a2e94acdbb0ccbd /src/game-server | |
parent | 8404033af0218ccd0221bf6ae9c0939bec86c4c9 (diff) | |
download | manaserv-57701ac70f2b81e11eedb4c01f680e46c1abadb2.tar.gz manaserv-57701ac70f2b81e11eedb4c01f680e46c1abadb2.tar.bz2 manaserv-57701ac70f2b81e11eedb4c01f680e46c1abadb2.tar.xz manaserv-57701ac70f2b81e11eedb4c01f680e46c1abadb2.zip |
Get rid of the server tick magic number.
Reviewed-by: CodyMartin.
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/actor.h | 3 | ||||
-rw-r--r-- | src/game-server/being.cpp | 8 | ||||
-rw-r--r-- | src/game-server/character.cpp | 4 | ||||
-rw-r--r-- | src/game-server/main-game.cpp | 5 |
4 files changed, 11 insertions, 9 deletions
diff --git a/src/game-server/actor.h b/src/game-server/actor.h index b5c634f4..fa443559 100644 --- a/src/game-server/actor.h +++ b/src/game-server/actor.h @@ -130,7 +130,8 @@ class Actor : public Thing virtual Map::BlockType getBlockType() const { return Map::BLOCKTYPE_NONE; } - unsigned short mMoveTime; /**< Delay until next action. */ + /** Delay until move to next tile in miliseconds. */ + unsigned short mMoveTime; private: char mUpdateFlags; /**< Changes in actor status. */ diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index 4e78586d..c0fc65e9 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -211,10 +211,10 @@ void Being::move() mOld = getPosition(); - if (mMoveTime > 100) + if (mMoveTime > WORLD_TICK_MS) { // Current move has not yet ended - mMoveTime -= 100; + mMoveTime -= WORLD_TICK_MS; return; } @@ -291,10 +291,10 @@ void Being::move() pos.x = next.x * tileWidth + (tileWidth / 2); pos.y = next.y * tileHeight + (tileHeight / 2); } - while (mMoveTime < 100); + while (mMoveTime < WORLD_TICK_MS); setPosition(pos); - mMoveTime = mMoveTime > 100 ? mMoveTime - 100 : 0; + mMoveTime = mMoveTime > WORLD_TICK_MS ? mMoveTime - WORLD_TICK_MS : 0; } int Being::directionToAngle(int direction) diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index 3fadf18e..62464023 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -148,9 +148,9 @@ void Character::perform() // wait before next attack // Note: The auto-attack system will handle the delay between two attacks. // TODO: Remove this condition when it's done. - if (mMoveTime > 100) + if (mMoveTime > WORLD_TICK_MS) { - mMoveTime -= 100; + mMoveTime -= WORLD_TICK_MS; return; } diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp index d62c92aa..182e4593 100644 --- a/src/game-server/main-game.cpp +++ b/src/game-server/main-game.cpp @@ -77,8 +77,9 @@ using utils::Logger; static int const WORLD_TICK_SKIP = 2; /** tolerance for lagging behind in world calculation) **/ -utils::Timer worldTimer(100, false); /**< Timer for world tics set to 100 ms */ -int worldTime = 0; /**< Current world time in 100ms ticks */ +/** Timer for world ticks */ +utils::Timer worldTimer(WORLD_TICK_MS, false); +int worldTime = 0; /**< Current world time in ticks */ bool running = true; /**< Determines if server keeps running */ utils::StringFilter *stringFilter; /**< Slang's Filter */ |