summaryrefslogtreecommitdiff
path: root/src/spellmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-25 01:20:00 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-25 01:38:14 +0200
commit5322d978519f9d5677d2096e1167439c84b23cd1 (patch)
treedfe6324fb6d3b573290687716dd98e45efb76019 /src/spellmanager.cpp
parent473dc9b1949ba7c51b59146815969b723a748d6d (diff)
downloadmv-5322d978519f9d5677d2096e1167439c84b23cd1.tar.gz
mv-5322d978519f9d5677d2096e1167439c84b23cd1.tar.bz2
mv-5322d978519f9d5677d2096e1167439c84b23cd1.tar.xz
mv-5322d978519f9d5677d2096e1167439c84b23cd1.zip
Add tabs to spells window. Now it 5 tabs.
Also dont save to configs default cell items for different item containers.
Diffstat (limited to 'src/spellmanager.cpp')
-rw-r--r--src/spellmanager.cpp54
1 files changed, 41 insertions, 13 deletions
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index 2f4e7bd26..f845246fd 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -92,7 +92,7 @@ void SpellManager::fillSpells()
addSpell(new TextCommand(11, "hi", "hi", NOTARGET, ""));
addSpell(new TextCommand(12, "hea", "heal", NOTARGET, ""));
addSpell(new TextCommand(13, "@sp", "@spawn maggot 10", NOTARGET, ""));
- for (int f = 12; f < SPELL_SHORTCUT_ITEMS; f++)
+ for (int f = 12; f < SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; f++)
addSpell(new TextCommand(f));
}
@@ -254,7 +254,7 @@ void SpellManager::load(bool oldConfig)
unsigned int mana;
unsigned int commandType;
- for (int i = 0; i < SPELL_SHORTCUT_ITEMS; i++)
+ for (int i = 0; i < SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; i++)
{
std::string flags =
cfg->getValue("commandShortcutFlags" + toString(i), "");
@@ -288,21 +288,49 @@ void SpellManager::load(bool oldConfig)
void SpellManager::save()
{
- for (int i = 0; i < SPELL_SHORTCUT_ITEMS; i++)
+ for (int i = 0; i < SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; i++)
{
TextCommand *spell = mSpellsVector[i];
if (spell)
{
- serverConfig.setValue("commandShortcutCmd" + toString(i),
- spell->getCommand());
- serverConfig.setValue("commandShortcutSymbol" + toString(i),
- spell->getSymbol());
- serverConfig.setValue("commandShortcutIcon" + toString(i),
- spell->getIcon());
- serverConfig.setValue("commandShortcutFlags" + toString(i),
- strprintf("%u %u %u %u %u %u", spell->getCommandType(),
- spell->getTargetType(), spell->getBaseLvl(),
- spell->getSchool(), spell->getSchoolLvl(), spell->getMana()));
+ if (spell->getCommand() != "")
+ {
+ serverConfig.setValue("commandShortcutCmd" + toString(i),
+ spell->getCommand());
+ }
+ else
+ {
+ serverConfig.deleteKey("commandShortcutCmd" + toString(i));
+ }
+ if (spell->getSymbol() != "")
+ {
+ serverConfig.setValue("commandShortcutSymbol" + toString(i),
+ spell->getSymbol());
+ }
+ else
+ {
+ serverConfig.deleteKey("commandShortcutSymbol" + toString(i));
+ }
+ if (spell->getIcon() != "")
+ {
+ serverConfig.setValue("commandShortcutIcon" + toString(i),
+ spell->getIcon());
+ }
+ else
+ {
+ serverConfig.deleteKey("commandShortcutIcon" + toString(i));
+ }
+ if (spell->getCommand() != "" && spell->getSymbol() != "")
+ {
+ serverConfig.setValue("commandShortcutFlags" + toString(i),
+ strprintf("%u %u %u %u %u %u", spell->getCommandType(),
+ spell->getTargetType(), spell->getBaseLvl(),
+ spell->getSchool(), spell->getSchoolLvl(), spell->getMana()));
+ }
+ else
+ {
+ serverConfig.deleteKey("commandShortcutFlags" + toString(i));
+ }
}
}
}