diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-24 05:32:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-24 05:32:41 +0300 |
commit | 65d6e86c20604e76ac0de46e54bf5571c570fd53 (patch) | |
tree | a9487422a0a2e1a7be8db5a1ade415b8011dfe0f | |
parent | ccb35758a391807322265994b1712c8d7ed2d16c (diff) | |
download | mv-65d6e86c20604e76ac0de46e54bf5571c570fd53.tar.gz mv-65d6e86c20604e76ac0de46e54bf5571c570fd53.tar.bz2 mv-65d6e86c20604e76ac0de46e54bf5571c570fd53.tar.xz mv-65d6e86c20604e76ac0de46e54bf5571c570fd53.zip |
Add reset yellow bar command to bars context menu.
-rw-r--r-- | src/configuration.cpp | 49 | ||||
-rw-r--r-- | src/configuration.h | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 9 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 4 | ||||
-rw-r--r-- | src/gui/viewport.h | 3 | ||||
-rw-r--r-- | src/localplayer.cpp | 26 | ||||
-rw-r--r-- | src/localplayer.h | 2 |
7 files changed, 95 insertions, 2 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index 6755e0a4f..04acbce28 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -196,6 +196,30 @@ int Configuration::getIntValue(const std::string &key) const return defaultValue; } +int Configuration::resetIntValue(const std::string &key) +{ + GETLOG(); + int defaultValue = 0; + if (mDefaultsData) + { + DefaultsData::const_iterator itdef = mDefaultsData->find(key); + + if (itdef != mDefaultsData->end() && itdef->second + && itdef->second->getType() == Mana::VariableData::DATA_INT) + { + defaultValue = (static_cast<Mana::IntData*>( + itdef->second))->getData(); + } + else + { + logger->log("%s: No integer value in registry for key %s", + mConfigPath.c_str(), key.c_str()); + } + } + setValue(key, defaultValue); + return defaultValue; +} + std::string Configuration::getStringValue(const std::string &key) const { GETLOG(); @@ -291,6 +315,31 @@ bool Configuration::getBoolValue(const std::string &key) const return defaultValue; } +bool Configuration::resetBoolValue(const std::string &key) +{ + GETLOG(); + bool defaultValue = false; + if (mDefaultsData) + { + DefaultsData::const_iterator itdef = mDefaultsData->find(key); + + if (itdef != mDefaultsData->end() && itdef->second + && itdef->second->getType() == Mana::VariableData::DATA_BOOL) + { + defaultValue = (static_cast<Mana::BoolData*>( + itdef->second))->getData(); + } + else + { + logger->log("%s: No boolean value in registry for key %s", + mConfigPath.c_str(), key.c_str()); + } + } + + setValue(key, defaultValue); + return defaultValue; +} + void ConfigurationObject::initFromXML(xmlNodePtr parent_node) { clear(); diff --git a/src/configuration.h b/src/configuration.h index e0377aace..a0a790990 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -265,6 +265,10 @@ class Configuration : public ConfigurationObject inline void setValue(const std::string &key, bool value) { setValue(key, value ? "1" : "0"); } + int resetIntValue(const std::string &key); + + bool resetBoolValue(const std::string &key); + const std::string getConfigPath() const { return mConfigPath; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 06ee9a9b8..7b0688587 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -1261,6 +1261,10 @@ void PopupMenu::handleLink(const std::string &link, socialWindow->updateAttackFilter(); } } + else if (link == "reset yellow") + { + player_node->resetYellowBar(); + } else if (link == "guild-pos" && !mNick.empty()) { showChangePos(getX(), getY()); @@ -1539,7 +1543,7 @@ void PopupMenu::showPopup(int x, int y, Button *button) mBrowserBox->clearRows(); std::list <gcn::Button*> names = windowMenu->getButtons(); std::list <gcn::Button*>::iterator it, it_end; - for (it = names.begin(), it_end = names.end(); it != it_end; ++it) + for (it = names.begin(), it_end = names.end(); it != it_end; ++ it) { Button *btn = dynamic_cast<Button*>(*it); if (!btn || btn->getActionEventId() == "SET") @@ -1593,6 +1597,9 @@ void PopupMenu::showPopup(int x, int y, ProgressBar *b) } mBrowserBox->addRow("##3---"); + mBrowserBox->addRow(strprintf("@@reset yellow|%s@@", + _("Reset yellow bar"))); + mBrowserBox->addRow("##3---"); mBrowserBox->addRow(strprintf("@@cancel|%s@@", _("Cancel"))); showPopup(x, y); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index a3a82333e..a838befef 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -410,6 +410,8 @@ Setup_Video::Setup_Video(): mDrawHotKeysCheckBox->addKeyListener(this); mDrawPathCheckBox->addKeyListener(this); mShowJobCheckBox->addKeyListener(this); + mOpenGLDropDown->addActionListener(this); + mAlphaCacheCheckBox->addKeyListener(this); mSpeechLabel->setCaption(speechModeToString(mSpeechMode)); @@ -815,7 +817,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) } else if (id == "opengl") { - bool isSoftware = mOpenGLDropDown->getSelected(); + bool isSoftware = (mOpenGLDropDown->getSelected() == 0); mAlphaCacheCheckBox->setEnabled(isSoftware); } } diff --git a/src/gui/viewport.h b/src/gui/viewport.h index d6e0fc3dc..59db38e4c 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -223,6 +223,9 @@ class Viewport : public WindowContainer, public gcn::MouseListener, int getDebugPath() { return mShowDebugPath; } + void setDebugPath(int n) + { mShowDebugPath = n; } + int getCameraMode() { return mCameraMode; } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index c7ad181df..803101243 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -3845,6 +3845,32 @@ int LocalPlayer::getAttackMobIndex(std::string name) return (*i).second; } +void LocalPlayer::resetYellowBar() +{ + mInvertDirection = config.resetIntValue("invertMoveDirection"); + mCrazyMoveType = config.resetIntValue("crazyMoveType"); + mMoveToTargetType = config.resetIntValue("moveToTargetType"); + mFollowMode = config.resetIntValue("followMode"); + mAttackWeaponType = config.resetIntValue("attackWeaponType"); + mAttackType = config.resetIntValue("attackType"); + mMagicAttackType = config.resetIntValue("magicAttackType"); + mQuickDropCounter = config.resetIntValue("quickDropCounter"); + mPickUpType = config.resetIntValue("pickUpType"); + if (viewport) + { + viewport->setDebugPath(0); + if (viewport->getCameraMode()) + viewport->toggleCameraMode(); + } + if (mMap) + mMap->setDebugFlags(0); + mImitationMode = config.resetIntValue("imitationMode"); + mDisableGameModifiers = config.resetBoolValue("disableGameModifiers"); + + if (miniStatusWindow) + miniStatusWindow->updateStatus(); +} + void AwayListener::action(const gcn::ActionEvent &event) { if (event.getId() == "ok" && player_node && player_node->getAwayMode()) diff --git a/src/localplayer.h b/src/localplayer.h index 904ce74db..f42258a82 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -492,6 +492,8 @@ class LocalPlayer : public Being, public ActorSpriteListener, int getAttackMobIndex(std::string name); + void resetYellowBar(); + protected: /** Whether or not the name settings have changed */ bool mUpdateName; |