summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-29 19:53:06 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-29 19:53:06 +0100
commit8733cdf3ab6969613301138b05070a441a657b76 (patch)
treea8d64e2f7d03f32404841e843efda975b99997c1
parent5f03e73484a50c9689956b32ef97630b56d2a00d (diff)
downloadmanaserv-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.
-rw-r--r--src/game-server/being.cpp8
-rw-r--r--src/game-server/being.h47
-rw-r--r--src/game-server/gamehandler.cpp18
-rw-r--r--src/game-server/monster.cpp2
-rw-r--r--src/game-server/monster.h4
-rw-r--r--src/protocol.h54
-rw-r--r--src/scripting/lua.cpp2
7 files changed, 70 insertions, 65 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;
};
/**
diff --git a/src/protocol.h b/src/protocol.h
index 1b4a1209..b592f548 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -19,8 +19,8 @@
* along with The Mana Server. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef PROTOCOL_H
-#define PROTOCOL_H
+#ifndef MANASERV_PROTOCOL_H
+#define MANASERV_PROTOCOL_H
/**
* Enumerated type for communicated messages:
@@ -377,8 +377,54 @@ enum {
GUILD_EVENT_OFFLINE_PLAYER
};
+/**
+ * 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 BeingAction
+{
+ 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
+};
-enum
+/**
+ * Beings and actors directions
+ * WARNING: Has to be in sync with the same enum in the Being class
+ * of the client!
+ */
+enum BeingDirection
+{
+ DIRECTION_UP = 1,
+ DIRECTION_DOWN,
+ DIRECTION_LEFT,
+ DIRECTION_RIGHT
+};
+
+/**
+ * enum for sprites layers.
+ * WARNING: Has to be in sync with the same enum in the Sprite class
+ * of the client!
+ */
+enum SpriteLayer
{
SPRITE_BASE = 0,
SPRITE_SHOE,
@@ -390,4 +436,4 @@ enum
SPRITE_VECTOREND
};
-#endif // PROTOCOL_H
+#endif // MANASERV_PROTOCOL_H
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index e672c1a6..f79f2f8d 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -822,7 +822,7 @@ static int being_set_action(lua_State *s)
if (being)
{
- being->setAction((Being::Action) act);
+ being->setAction((BeingAction) act);
}
return 0;