summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-01-10 20:47:59 +0000
committerJared Adams <jaxad0127@gmail.com>2010-01-10 20:48:37 +0000
commit4c6165ece76dff406d324c240a7fc099a3e0c42b (patch)
treeceff7fbaa928d2397552c34e51210a419e630a41
parent023ca895db6aaf1c4ed5a2240cf85443f83e84db (diff)
downloadmana-client-4c6165ece76dff406d324c240a7fc099a3e0c42b.tar.gz
mana-client-4c6165ece76dff406d324c240a7fc099a3e0c42b.tar.bz2
mana-client-4c6165ece76dff406d324c240a7fc099a3e0c42b.tar.xz
mana-client-4c6165ece76dff406d324c240a7fc099a3e0c42b.zip
Remove some support ifdefs
-rw-r--r--src/localplayer.cpp39
-rw-r--r--src/localplayer.h19
-rw-r--r--src/net/manaserv/gamehandler.cpp4
-rw-r--r--src/net/manaserv/playerhandler.cpp3
4 files changed, 25 insertions, 40 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 58abf75f..f5af4434 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -79,11 +79,9 @@ LocalPlayer *player_node = NULL;
LocalPlayer::LocalPlayer(int id, int job, Map *map):
Player(id, job, map),
-#ifdef EATHENA_SUPPORT
- mAttackRange(0),
-#endif
mEquipment(new Equipment),
mInStorage(false),
+ mAttackRange(0),
mTargetTime(-1),
mLastTarget(-1),
mCharacterPoints(0),
@@ -294,7 +292,7 @@ void LocalPlayer::nextStep(unsigned char dir = 0)
Player::nextStep();
#else
- if (!mMap || !dir)
+ if (!mMap || !dir)
return;
const Vector &pos = getPosition();
@@ -389,7 +387,6 @@ void LocalPlayer::clearInventory()
mInventory->clear();
}
-#ifdef MANASERV_SUPPORT
void LocalPlayer::setInvItem(int index, int id, int amount)
{
bool equipment = false;
@@ -398,7 +395,6 @@ void LocalPlayer::setInvItem(int index, int id, int amount)
equipment = true;
mInventory->setItem(index, id, amount, equipment);
}
-#endif
void LocalPlayer::pickUp(FloorItem *item)
{
@@ -685,7 +681,6 @@ void LocalPlayer::emote(Uint8 emotion)
Net::getPlayerHandler()->emote(emotion);
}
-#ifdef MANASERV_SUPPORT
void LocalPlayer::useSpecial(int special)
{
Net::getSpecialHandler()->use(special);
@@ -698,7 +693,6 @@ void LocalPlayer::setSpecialStatus(int id, int current, int max, int recharge)
mSpecials[id].neededMana = max;
mSpecials[id].recharge = recharge;
}
-#endif
void LocalPlayer::attack(Being *target, bool keep)
{
@@ -922,13 +916,11 @@ void LocalPlayer::setLevel(int value)
statusWindow->update(StatusWindow::LEVEL);
}
-void LocalPlayer::setExp(int value)
+void LocalPlayer::setExp(int value, bool notify)
{
- if (mMap && value > mExp)
+ if (mMap && notify && value > mExp)
{
- #ifdef EATHENA_SUPPORT
- addMessageToQueue(toString(value - mExp) + " xp");
- #endif
+ addMessageToQueue(toString(value - mExp) + " xp");
}
mExp = value;
@@ -999,17 +991,20 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount)
int LocalPlayer::getAttackRange()
{
-#ifdef MANASERV_SUPPORT
- Item *weapon = mEquipment->getEquipment(EQUIP_FIGHT1_SLOT);
- if (weapon)
+ if (mAttackRange > -1)
{
- const ItemInfo info = weapon->getInfo();
- return info.getAttackRange();
+ return mAttackRange;
+ }
+ else
+ {
+ Item *weapon = mEquipment->getEquipment(EQUIP_FIGHT1_SLOT);
+ if (weapon)
+ {
+ const ItemInfo info = weapon->getInfo();
+ return info.getAttackRange();
+ }
+ return 48; // unarmed range
}
- return 48; // unarmed range
-#else
- return mAttackRange;
-#endif
}
bool LocalPlayer::withinAttackRange(Being *target)
diff --git a/src/localplayer.h b/src/localplayer.h
index 819b086d..00415ab9 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -101,13 +101,6 @@ enum
class LocalPlayer : public Player
{
public:
-#ifdef MANASERV_SUPPORT
- enum Attribute
- {
- STR = 0, AGI, DEX, VIT, INT, WIL, CHR
- };
-#endif
-
/**
* Constructor.
*/
@@ -152,18 +145,14 @@ class LocalPlayer : public Player
void inviteToGuild(Being *being);
void clearInventory();
-#ifdef MANASERV_SUPPORT
void setInvItem(int index, int id, int amount);
-#endif
void pickUp(FloorItem *item);
-#ifdef EATHENA_SUPPORT
/**
* Sets the attack range.
*/
void setAttackRange(int range) { mAttackRange = range; }
-#endif
/**
* Gets the attack range.
@@ -282,10 +271,6 @@ class LocalPlayer : public Player
bool getInStorage() { return mInStorage; }
void setInStorage(bool inStorage);
-#ifdef EATHENA_SUPPORT
- Uint16 mAttackRange;
-#endif
-
int getHp() const
{ return mHp; }
@@ -301,7 +286,7 @@ class LocalPlayer : public Player
void setLevel(int value);
- void setExp(int value);
+ void setExp(int value, bool notify = true);
int getExp() const
{ return mExp; }
@@ -399,6 +384,8 @@ class LocalPlayer : public Player
bool mInStorage; /**< Whether storage is currently accessible */
+ Uint16 mAttackRange;
+
int mTargetTime; /** How long the being has been targeted **/
int mLastTarget; /** Time stamp of last targeting action, -1 if none. */
diff --git a/src/net/manaserv/gamehandler.cpp b/src/net/manaserv/gamehandler.cpp
index 51b9d1c9..700d2d6c 100644
--- a/src/net/manaserv/gamehandler.cpp
+++ b/src/net/manaserv/gamehandler.cpp
@@ -26,6 +26,7 @@
#include "net/manaserv/messageout.h"
#include "net/manaserv/protocol.h"
+#include "localplayer.h"
#include "main.h"
extern Net::GameHandler *gameHandler;
@@ -113,6 +114,9 @@ void GameHandler::inGame()
gameServerConnection->send(msg);
chatHandler->connect();
+
+ // Attack range from item DB
+ player_node->setAttackRange(-1);
}
void GameHandler::mapLoaded(const std::string &mapName)
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 671d02a3..62110f8f 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -180,8 +180,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
case GPMSG_LEVEL_PROGRESS:
{
- logger->log("Level Progress Update");
- player_node->setExp(msg.readInt8());
+ player_node->setExp(msg.readInt8(), false);
} break;