summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/outfitwindow.cpp17
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp19
-rw-r--r--src/gui/widgets/spellshortcutcontainer.h3
3 files changed, 28 insertions, 11 deletions
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index ddd337767..2796e13c8 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -157,14 +157,25 @@ void OutfitWindow::save()
std::string outfitStr;
for (int o = 0; o < OUTFITS_COUNT; o++)
{
+ bool good = false;
for (int i = 0; i < OUTFIT_ITEM_COUNT; i++)
{
- outfitStr += mItems[o][i] ? toString(mItems[o][i]) : toString(-1);
+ int res = mItems[o][i] ? mItems[o][i] : -1;
+ if (res != -1)
+ good = true;
+ outfitStr += toString(res);
if (i < OUTFIT_ITEM_COUNT - 1)
outfitStr += " ";
}
- serverConfig.setValue("Outfit" + toString(o), outfitStr);
- serverConfig.setValue("OutfitUnequip" + toString(o), mItemsUnequip[o]);
+ if (good)
+ serverConfig.setValue("Outfit" + toString(o), outfitStr);
+ else
+ serverConfig.deleteKey("Outfit" + toString(o));
+
+ if (mItemsUnequip[o])
+ serverConfig.deleteKey("OutfitUnequip" + toString(o));
+ else
+ serverConfig.setValue("OutfitUnequip" + toString(o), mItemsUnequip[o]);
outfitStr = "";
}
serverConfig.setValue("OutfitAwayIndex", mAwayOutfit);
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 18482369d..d0f6931aa 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -48,10 +48,11 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
-SpellShortcutContainer::SpellShortcutContainer():
+SpellShortcutContainer::SpellShortcutContainer(unsigned number):
ShortcutContainer(),
mSpellClicked(false),
- mSpellMoved(NULL)
+ mSpellMoved(NULL),
+ mNumber(number)
{
mBoxWidth = mBoxWidth;
@@ -115,7 +116,7 @@ void SpellShortcutContainer::draw(gcn::Graphics *graphics)
g->drawImage(mBackgroundImg, itemX, itemY);
- int itemId = spellShortcut->getItem(i);
+ int itemId = spellShortcut->getItem((mNumber * SPELL_SHORTCUT_ITEMS) + i);
if (selectedId >= 0 && itemId == selectedId)
{
g->drawRectangle(gcn::Rectangle(
@@ -163,7 +164,8 @@ void SpellShortcutContainer::mouseDragged(gcn::MouseEvent &event)
if (index == -1)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
if (itemId < 0)
return;
@@ -195,7 +197,8 @@ void SpellShortcutContainer::mousePressed(gcn::MouseEvent &event)
if (!spellShortcut || !spellManager)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
spellManager->invoke(itemId);
}
}
@@ -210,7 +213,8 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event)
if (index == -1)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
if (event.getButton() == gcn::MouseEvent::LEFT)
{
@@ -263,7 +267,8 @@ void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event)
if (index == -1)
return;
- const int itemId = spellShortcut->getItem(index);
+ const int itemId = spellShortcut->getItem(
+ (mNumber * SPELL_SHORTCUT_ITEMS) + index);
mSpellPopup->setVisible(false);
TextCommand *spell = spellManager->getSpell(itemId);
diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h
index 8f1c4b221..a4ad1576a 100644
--- a/src/gui/widgets/spellshortcutcontainer.h
+++ b/src/gui/widgets/spellshortcutcontainer.h
@@ -49,7 +49,7 @@ class SpellShortcutContainer : public ShortcutContainer
/**
* Constructor. Initializes the graphic.
*/
- SpellShortcutContainer();
+ SpellShortcutContainer(unsigned number);
/**
* Destructor.
@@ -83,6 +83,7 @@ class SpellShortcutContainer : public ShortcutContainer
bool mSpellClicked;
TextCommand *mSpellMoved;
SpellPopup *mSpellPopup;
+ unsigned mNumber;
};
#endif