diff options
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 69 |
1 files changed, 64 insertions, 5 deletions
diff --git a/src/player.cpp b/src/player.cpp index ba4ed1ff..de4a012b 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,9 @@ #include "animatedsprite.h" #include "game.h" +#ifdef TMWSERV_SUPPORT +#include "guild.h" +#endif #include "localplayer.h" #include "particle.h" #include "player.h" @@ -31,6 +33,7 @@ #include "resources/colordb.h" #include "resources/itemdb.h" +#include "resources/iteminfo.h" #include "utils/strprintf.h" @@ -72,6 +75,7 @@ void Player::setName(const std::string &name) } } +#ifdef EATHENA_SUPPORT void Player::logic() { switch (mAction) @@ -89,7 +93,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(); @@ -137,6 +141,7 @@ void Player::logic() Being::logic(); } +#endif Being::Type Player::getType() const { @@ -183,7 +188,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) @@ -191,8 +196,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 { @@ -229,3 +236,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 |