From d6329c13a589affed482783272db23e4980a5507 Mon Sep 17 00:00:00 2001 From: Bertram Date: Mon, 1 Feb 2010 23:59:14 +0100 Subject: Small cleanups. --- src/being.cpp | 4 ++-- src/being.h | 4 ++-- src/gui/setup_video.cpp | 4 ++-- src/gui/viewport.cpp | 6 +++--- src/localplayer.cpp | 8 +++---- src/localplayer.h | 56 ++++++++++++++++++++++++++++++++++++------------- src/monster.cpp | 2 +- src/player.cpp | 4 ++-- 8 files changed, 58 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index 6ce2120a..beed9c35 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -200,7 +200,7 @@ void Being::setPath(const Path &path) if ((Net::getNetworkType() == ServerInfo::EATHENA) && mAction != WALK && mAction != DEAD) { - nextStep(); + nextTile(); mWalkTime = tick_time; } } @@ -471,7 +471,7 @@ void Being::setDirection(Uint8 direction) } /** TODO: Used by eAthena only */ -void Being::nextStep() +void Being::nextTile() { if (mPath.empty()) { diff --git a/src/being.h b/src/being.h index b286ef41..4d0f714a 100644 --- a/src/being.h +++ b/src/being.h @@ -147,10 +147,10 @@ class Being : public Sprite, public ConfigListener void setWalkTime(int walkTime) { mWalkTime = walkTime; } /** - * Makes this being take the next step (tile) of its path. + * Makes this being take the next tile of its path. * TODO: Used by eAthena only? */ - virtual void nextStep(); + virtual void nextTile(); /** * Get the current X pixel offset. diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index d7ad3e5f..aaa3ea35 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -449,7 +449,7 @@ void Setup_Video::cancel() config.setValue("speech", mSpeechMode); config.setValue("showownname", mNameEnabled); if (player_node) - player_node->mUpdateName = true; + player_node->setCheckNameSetting(true); config.setValue("guialpha", mOpacity); config.setValue("opengl", mOpenGLEnabled); config.setValue("showpickupchat", mPickupChatEnabled); @@ -529,7 +529,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) // Notify the local player that settings have changed for the name // and requires an update if (player_node) - player_node->mUpdateName = true; + player_node->setCheckNameSetting(true); config.setValue("showownname", mNameCheckBox->isSelected()); } else if (event.getId() == "fpslimitslider") diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 76bf5a22..1a34fa96 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -109,7 +109,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) // Ensure the client doesn't freak out if a feature localplayer uses // is dependent on a map. - player_node->mMapInitialized = true; + player_node->setMapInitialized(true); // Avoid freaking out when tick_time overflows if (tick_time < lastTick) @@ -201,9 +201,9 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) } } - if (player_node->mUpdateName) + if (player_node->getCheckNameSetting()) { - player_node->mUpdateName = false; + player_node->setCheckNameSetting(false); player_node->setName(player_node->getName()); } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index eb8d8164..49e5bfaa 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -259,7 +259,7 @@ void LocalPlayer::setGMLevel(int level) } -void LocalPlayer::nextStep(unsigned char dir = 0) +void LocalPlayer::nextTile(unsigned char dir = 0) { if (Net::getNetworkType() == ServerInfo::EATHENA) { @@ -290,7 +290,7 @@ void LocalPlayer::nextStep(unsigned char dir = 0) } - Player::nextStep(); + Player::nextTile(); } else { @@ -569,7 +569,7 @@ void LocalPlayer::setWalkingDir(int dir) } else if (mAction == WALK && (Net::getNetworkType() == ServerInfo::MANASERV)) { - nextStep(dir); + nextTile(dir); } } @@ -630,7 +630,7 @@ void LocalPlayer::startWalking(unsigned char dir) } } else - nextStep(dir); + nextTile(dir); } void LocalPlayer::stopWalking(bool sendToServer) diff --git a/src/localplayer.h b/src/localplayer.h index 36876500..58be0824 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -117,13 +117,15 @@ class LocalPlayer : public Player virtual void setAction(Action action, int attackType = 0); /** - * Adds a new step when walking before calling super. Also, when - * specified it picks up an item at the end of a path. + * Adds a new tile to the path when walking. + * @note Eathena + * Also, when specified, it picks up an item at the end of a path + * or attack target. */ - virtual void nextStep() - { nextStep(0); } + virtual void nextTile() + { nextTile(0); } - virtual void nextStep(unsigned char dir); + virtual void nextTile(unsigned char dir); /** * Returns the player's inventory. @@ -357,12 +359,6 @@ class LocalPlayer : public Player bool isPathSetByMouse() const { return mPathSetByMouse; } - bool mUpdateName; /** Whether or not the name settings have changed */ - - bool mMapInitialized; /** Whether or not the map is available yet */ - - const std::auto_ptr mEquipment; - void addMessageToQueue(const std::string &message, Palette::ColorType color = Palette::EXP_INFO); @@ -385,16 +381,48 @@ class LocalPlayer : public Player int getNextDestY() const { return mNextDestY; } /** - * stops a following + * Stop following a player. */ void cancelFollow() { mPlayerFollowed = ""; } /** - * get following + * Get the playername followed by the current player. */ std::string getFollow() const { return mPlayerFollowed; } + /** + * Tells the engine wether to check + * if the Player Name is to be displayed. + */ + void setCheckNameSetting(bool checked) { mUpdateName = checked; } + + /** + * Gets if the engine has to check + * if the Player Name is to be displayed. + */ + bool getCheckNameSetting() const { return mUpdateName; } + + /** + * Set if the current map is initialized. + */ + void setMapInitialized(bool initialized) + { mMapInitialized = initialized; } + + /** + * Tells if the current map is initialized. + */ + bool isMapInitialized() const { return mMapInitialized; } + + /** Keeps the Equipment related values */ + const std::auto_ptr mEquipment; + protected: + + /** Whether or not the name settings have changed */ + bool mUpdateName; + + bool mMapInitialized; /**< Whether or not the map is available yet */ + virtual void handleStatusEffect(StatusEffect *effect, int effectId); // Colors don't change for local player @@ -458,7 +486,7 @@ class LocalPlayer : public Player Inventory *mStorage; - // Load the target cursors into memory + /** Load the target cursors into memory */ void initTargetCursor(); /** diff --git a/src/monster.cpp b/src/monster.cpp index 7da7e759..a0eb5719 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -78,7 +78,7 @@ void Monster::logic() mFrame = (int) ((get_elapsed_time(mWalkTime) * 4) / getWalkSpeed()); if (mFrame >= 4 && mAction != DEAD) - nextStep(); + nextTile(); } Being::logic(); diff --git a/src/player.cpp b/src/player.cpp index 022b06ba..ea620581 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -86,7 +86,7 @@ void Player::logic() case WALK: mFrame = (int) ((get_elapsed_time(mWalkTime) * 6) / getWalkSpeed()); if (mFrame >= 6) - nextStep(); + nextTile(); break; case ATTACK: @@ -123,7 +123,7 @@ void Player::logic() } if (mFrame >= frames) - nextStep(); + nextTile(); break; } -- cgit v1.2.3-70-g09d2