From b474de4a54c9b1d4d863971e40b807588d554436 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 24 Aug 2012 22:48:35 +0300 Subject: replace defines to consts. --- src/net/ea/specialhandler.cpp | 55 ++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp index 7db3f1b31..226531a11 100644 --- a/src/net/ea/specialhandler.cpp +++ b/src/net/ea/specialhandler.cpp @@ -37,33 +37,33 @@ #include "debug.h" /** job dependend identifiers (?) */ -#define SKILL_BASIC 0x0001 -#define SKILL_WARP 0x001b -#define SKILL_STEAL 0x0032 -#define SKILL_ENVENOM 0x0034 +static const unsigned int SKILL_BASIC = 0x0001; +static const unsigned int SKILL_WARP = 0x001b; +static const unsigned int SKILL_STEAL = 0x0032; +static const unsigned int SKILL_ENVENOM = 0x0034; /** basic skills identifiers */ -#define BSKILL_TRADE 0x0000 -#define BSKILL_EMOTE 0x0001 -#define BSKILL_SIT 0x0002 -#define BSKILL_CREATECHAT 0x0003 -#define BSKILL_JOINPARTY 0x0004 -#define BSKILL_SHOUT 0x0005 +static const unsigned int BSKILL_TRADE = 0x0000; +static const unsigned int BSKILL_EMOTE = 0x0001; +static const unsigned int BSKILL_SIT = 0x0002; +static const unsigned int BSKILL_CREATECHAT = 0x0003; +static const unsigned int BSKILL_JOINPARTY = 0x0004; +static const unsigned int BSKILL_SHOUT = 0x0005; /** reasons why action failed */ -#define RFAIL_SKILLDEP 0x00 -#define RFAIL_INSUFSP 0x01 -#define RFAIL_INSUFHP 0x02 -#define RFAIL_NOMEMO 0x03 -#define RFAIL_SKILLDELAY 0x04 -#define RFAIL_ZENY 0x05 -#define RFAIL_WEAPON 0x06 -#define RFAIL_REDGEM 0x07 -#define RFAIL_BLUEGEM 0x08 -#define RFAIL_OVERWEIGHT 0x09 +static const unsigned int RFAIL_SKILLDEP = 0x00; +static const unsigned int RFAIL_INSUFSP = 0x01; +static const unsigned int RFAIL_INSUFHP = 0x02; +static const unsigned int RFAIL_NOMEMO = 0x03; +static const unsigned int RFAIL_SKILLDELAY = 0x04; +static const unsigned int RFAIL_ZENY = 0x05; +static const unsigned int RFAIL_WEAPON = 0x06; +static const unsigned int RFAIL_REDGEM = 0x07; +static const unsigned int RFAIL_BLUEGEM = 0x08; +static const unsigned int RFAIL_OVERWEIGHT = 0x09; /** should always be zero if failed */ -#define SKILL_FAILED 0x00 +static const unsigned int SKILL_FAILED = 0x00; namespace Ea { @@ -129,14 +129,21 @@ void SpecialHandler::processSkillFailed(Net::MessageIn &msg) msg.readInt16(); // btype char success = msg.readInt8(); char reason = msg.readInt8(); - if (success != SKILL_FAILED && bskill == BSKILL_EMOTE) + if (success != static_cast(SKILL_FAILED) + && bskill == static_cast(BSKILL_EMOTE)) + { logger->log("Action: %d/%d", bskill, success); + } std::string txt; - if (success == SKILL_FAILED && skillId == SKILL_BASIC) + if (success == static_cast(SKILL_FAILED) + && skillId == static_cast(SKILL_BASIC)) { - if (player_node && bskill == BSKILL_EMOTE && reason == RFAIL_SKILLDEP) + if (player_node && bskill == static_cast(BSKILL_EMOTE) + && reason == static_cast(RFAIL_SKILLDEP)) + { player_node->stopAdvert(); + } switch (bskill) { -- cgit v1.2.3-60-g2f50