diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-21 21:25:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-21 21:25:47 +0300 |
commit | c41fcc1f637e76e5ff671b223ce6c151af89e7d3 (patch) | |
tree | ae7afae3d8c30eff4569fc0c41fb8d0ef99ecd94 /src/gamemodifiers.cpp | |
parent | 8b6afd0d756b9fc66c9f4de3ef452c24f64c87d1 (diff) | |
download | plus-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.tar.gz plus-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.tar.bz2 plus-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.tar.xz plus-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.zip |
move "change drop counter" option into gamemodifiers.
Diffstat (limited to 'src/gamemodifiers.cpp')
-rw-r--r-- | src/gamemodifiers.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp index 6fa606408..d98332f39 100644 --- a/src/gamemodifiers.cpp +++ b/src/gamemodifiers.cpp @@ -42,6 +42,7 @@ GameModifiers::GameModifiers() settings.followMode = config.getIntValue("followMode"); settings.attackWeaponType = config.getIntValue("attackWeaponType"); settings.attackType = config.getIntValue("attackType"); + settings.quickDropCounter = config.getIntValue("quickDropCounter"); } GameModifiers::~GameModifiers() @@ -282,3 +283,35 @@ std::string GameModifiers::getAttackTypeString() return gettext(getVarItem(&attackTypeStrings[0], settings.attackType, attackTypeSize)); } + +const unsigned quickDropCounterSize = 31; + +void GameModifiers::changeQuickDropCounter(const bool forward) +{ + changeMode(&settings.quickDropCounter, quickDropCounterSize, + "quickDropCounter", + &GameModifiers::getQuickDropCounterString, 1, true, forward); +} + +std::string GameModifiers::getQuickDropCounterString() +{ + const unsigned int cnt = settings.quickDropCounter; + if (cnt > 9) + { + return strprintf("(%c) drop counter %u", static_cast<signed char>( + 'a' + cnt - 10), cnt); + } + else + { + return strprintf("(%u) drop counter %u", cnt, cnt); + } +} + +void GameModifiers::setQuickDropCounter(const int n) +{ + if (n < 1 || n >= static_cast<signed>(quickDropCounterSize)) + return; + settings.quickDropCounter = n; + config.setValue("quickDropCounter", n); + UpdateStatusListener::distributeEvent(); +} |