summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-22 19:45:03 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-22 19:45:56 +0100
commit0c43d04b438d41c277ae80402d4b4888db1a0b64 (patch)
tree3aaeb75ecd1bcbe85decedab5f1fa426fe0411e3 /src/player.cpp
parenta7f5eaeb7f643658d356533a608f0f18d85b6d32 (diff)
parent401802c1d7a1b3d659bdc53a45d9a6292fc1121e (diff)
downloadmana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.gz
mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.bz2
mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.xz
mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.zip
Merged the tmwserv client with the eAthena client
This merge involved major changes on both sides, and as such took several weeks. Lots of things are expected to be broken now, however, we now have a single code base to improve and extend, which can be compiled to support either eAthena or tmwserv. In the coming months, the plan is to work towards a client that supports both eAthena and tmwserv, without needing to be recompiled. Conflicts: Everywhere!
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp63
1 files changed, 61 insertions, 2 deletions
diff --git a/src/player.cpp b/src/player.cpp
index f620e637..09eec0d1 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -21,6 +21,9 @@
#include "animatedsprite.h"
#include "game.h"
+#ifdef TMWSERV_SUPPORT
+#include "guild.h"
+#endif
#include "player.h"
#include "text.h"
@@ -65,6 +68,7 @@ void Player::setName(const std::string &name)
}
}
+#ifdef EATHENA_SUPPORT
void Player::logic()
{
switch (mAction)
@@ -82,7 +86,7 @@ void Player::logic()
break;
case WALK:
- mFrame = (get_elapsed_time(mWalkTime) * 6) / mWalkSpeed;
+ mFrame = (get_elapsed_time(mWalkTime) * 6) / getWalkSpeed();
if (mFrame >= 6)
nextStep();
@@ -107,6 +111,7 @@ void Player::logic()
Being::logic();
}
+#endif
Being::Type Player::getType() const
{
@@ -153,7 +158,7 @@ void Player::setHairStyle(int style, int color)
setAction(mAction);
}
-void Player::setSprite(int slot, int id, std::string color)
+void Player::setSprite(int slot, int id, const std::string &color)
{
// id = 0 means unequip
if (id == 0)
@@ -161,8 +166,10 @@ void Player::setSprite(int slot, int id, std::string color)
delete mSprites[slot];
mSprites[slot] = NULL;
+#ifdef EATHENA_SUPPORT
if (slot == WEAPON_SPRITE)
mEquippedWeapon = NULL;
+#endif
}
else
{
@@ -199,3 +206,55 @@ void Player::updateCoords()
mName->adviseXY(mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET);
}
+#ifdef TMWSERV_SUPPORT
+
+Guild* Player::addGuild(short guildId, short rights)
+{
+ Guild *guild = new Guild(guildId, rights);
+ mGuilds.insert(std::pair<int, Guild*>(guildId, guild));
+ return guild;
+}
+
+void Player::removeGuild(int id)
+{
+ mGuilds.erase(id);
+}
+
+Guild* Player::getGuild(const std::string &guildName)
+{
+ std::map<int, Guild*>::iterator itr, itr_end = mGuilds.end();
+ for (itr = mGuilds.begin(); itr != itr_end; ++itr)
+ {
+ Guild *guild = itr->second;
+ if (guild->getName() == guildName)
+ {
+ return guild;
+ }
+ }
+
+ return NULL;
+}
+
+Guild* Player::getGuild(int id)
+{
+ std::map<int, Guild*>::iterator itr;
+ itr = mGuilds.find(id);
+ if (itr != mGuilds.end())
+ {
+ return itr->second;
+ }
+
+ return NULL;
+}
+
+short Player::getNumberOfGuilds()
+{
+ return mGuilds.size();
+}
+
+void Player::setInParty(bool value)
+{
+ mInParty = value;
+}
+
+#endif