diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-12-29 19:53:06 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-12-29 19:53:06 +0100 |
commit | 8733cdf3ab6969613301138b05070a441a657b76 (patch) | |
tree | a8d64e2f7d03f32404841e843efda975b99997c1 /src/game-server | |
parent | 5f03e73484a50c9689956b32ef97630b56d2a00d (diff) | |
download | manaserv-8733cdf3ab6969613301138b05070a441a657b76.tar.gz manaserv-8733cdf3ab6969613301138b05070a441a657b76.tar.bz2 manaserv-8733cdf3ab6969613301138b05070a441a657b76.tar.xz manaserv-8733cdf3ab6969613301138b05070a441a657b76.zip |
Moved parts needing to be in sync with the client in protocol.h.
Trivial fix.
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/being.cpp | 8 | ||||
-rw-r--r-- | src/game-server/being.h | 47 | ||||
-rw-r--r-- | src/game-server/gamehandler.cpp | 18 | ||||
-rw-r--r-- | src/game-server/monster.cpp | 2 | ||||
-rw-r--r-- | src/game-server/monster.h | 4 |
5 files changed, 19 insertions, 60 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index 895afde4..9400f5df 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -316,7 +316,7 @@ int Being::performAttack(Being *target, const Damage &damage) { int Being::performAttack(Being *target, unsigned range, const Damage &damage) { // check target legality - if (!target || target == this || target->getAction() == Being::DEAD + if (!target || target == this || target->getAction() == DEAD || !target->canFight()) return -1; if (getMap()->getPvP() == PVP_NONE && target->getType() == OBJECT_CHARACTER @@ -336,11 +336,11 @@ int Being::performAttack(Being *target, unsigned range, const Damage &damage) return (mTarget->damage(this, damage)); } -void Being::setAction(Action action) +void Being::setAction(BeingAction action) { mAction = action; - if (action != Being::ATTACK && // The players are informed about these actions - action != Being::WALK) // by other messages + if (action != ATTACK && // The players are informed about these actions + action != WALK) // by other messages { raiseUpdateFlags(UPDATEFLAG_ACTIONCHANGE); } diff --git a/src/game-server/being.h b/src/game-server/being.h index 5e9565cc..07876a4a 100644 --- a/src/game-server/being.h +++ b/src/game-server/being.h @@ -37,18 +37,6 @@ class StatusEffect; typedef std::map< unsigned int, Attribute > AttributeMap; -/** - * Beings and actors directions - * Needs to match client - */ -enum Direction -{ - DIRECTION_UP = 1, - DIRECTION_DOWN, - DIRECTION_LEFT, - DIRECTION_RIGHT -}; - enum TimerID { T_M_STROLL, // time until monster strolls to new location @@ -80,35 +68,6 @@ class Being : public Actor { public: /** - * Moves enum for beings and actors for others players vision. - * WARNING: Has to be in sync with the same enum in the Being class - * of the client! - */ - enum Action - { - STAND, - WALK, - ATTACK, - SIT, - DEAD, - HURT - }; - - /** - * Moves enum for beings and actors for others players attack types. - * WARNING: Has to be in sync with the same enum in the Being class - * of the client! - */ - enum AttackType - { - HIT = 0x00, - CRITICAL = 0x0a, - MULTI = 0x08, - REFLECT = 0x04, - FLEE = 0x0b - }; - - /** * Proxy constructor. */ Being(ThingType type); @@ -196,12 +155,12 @@ class Being : public Actor /** * Sets the current action. */ - void setAction(Action action); + void setAction(BeingAction action); /** * Sets the current action. */ - Action getAction() const + BeingAction getAction() const { return mAction; } /** @@ -331,7 +290,7 @@ class Being : public Actor protected: static const int TICKS_PER_HP_REGENERATION = 100; - Action mAction; + BeingAction mAction; AttributeMap mAttributes; AutoAttacks mAutoAttacks; StatusEffects mStatus; diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp index f761abca..7aae2e2c 100644 --- a/src/game-server/gamehandler.cpp +++ b/src/game-server/gamehandler.cpp @@ -363,7 +363,7 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message) { Being *being = static_cast<Being*>(o); computer.character->setTarget(being); - computer.character->setAction(Being::ATTACK); + computer.character->setAction(ATTACK); } } break; @@ -377,25 +377,25 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message) case PGMSG_ACTION_CHANGE: { - Being::Action action = (Being::Action)message.readInt8(); - Being::Action current = (Being::Action)computer.character->getAction(); + BeingAction action = (BeingAction)message.readInt8(); + BeingAction current = (BeingAction)computer.character->getAction(); bool logActionChange = true; switch (action) { - case Being::STAND: + case STAND: { - if (current == Being::SIT) + if (current == SIT) { - computer.character->setAction(Being::STAND); + computer.character->setAction(STAND); logActionChange = false; } } break; - case Being::SIT: + case SIT: { - if (current == Being::STAND) + if (current == STAND) { - computer.character->setAction(Being::SIT); + computer.character->setAction(SIT); logActionChange = false; } } break; diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index 611fcea0..d78f04ba 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -224,7 +224,7 @@ void Monster::update() Being *bestAttackTarget = mTarget = NULL; int bestTargetPriority = 0; Point bestAttackPosition; - Direction bestAttackDirection = DIRECTION_DOWN; + BeingDirection bestAttackDirection = DIRECTION_DOWN; // Iterate through objects nearby int aroundArea = Configuration::getValue("game_visualRange", 448); diff --git a/src/game-server/monster.h b/src/game-server/monster.h index 0028920a..4b3a611c 100644 --- a/src/game-server/monster.h +++ b/src/game-server/monster.h @@ -211,7 +211,7 @@ class MonsterClass */ struct AttackPosition { - AttackPosition(int posX, int posY, Direction dir): + AttackPosition(int posX, int posY, BeingDirection dir): x(posX), y(posY), direction(dir) @@ -219,7 +219,7 @@ struct AttackPosition int x; int y; - Direction direction; + BeingDirection direction; }; /** |