summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/gui/itemcontainer.cpp12
-rw-r--r--src/gui/itemshortcutcontainer.cpp6
-rw-r--r--src/itemshortcut.cpp25
4 files changed, 24 insertions, 20 deletions
diff --git a/NEWS b/NEWS
index bb0d2d09..df906034 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
- Mouse cursor will now hide when not used for some time
- Make sure news and update file list aren't cached (from Aethyra)
+- Added ability to add equipment to the shortcut bar
0.0.25 (27 July 2008)
- Added support for whispering to other players
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 5fb99ffc..141b4360 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -82,8 +82,7 @@ ItemContainer::~ItemContainer()
mSelImg->decRef();
}
-void
-ItemContainer::draw(gcn::Graphics *graphics)
+void ItemContainer::draw(gcn::Graphics *graphics)
{
Graphics *g = static_cast<Graphics*>(graphics);
@@ -147,8 +146,7 @@ ItemContainer::draw(gcn::Graphics *graphics)
}
}
-void
-ItemContainer::selectNone()
+void ItemContainer::selectNone()
{
setSelectedItem(NULL);
}
@@ -324,8 +322,7 @@ int ItemContainer::getSlotIndex(const int posX, const int posY) const
return Inventory::NO_SLOT_INDEX;
}
-void
-ItemContainer::keyAction()
+void ItemContainer::keyAction()
{
// If there is no highlight then return.
if (!mHighlightedItem)
@@ -362,8 +359,7 @@ ItemContainer::keyAction()
}
}
-void
-ItemContainer::moveHighlight(int direction)
+void ItemContainer::moveHighlight(int direction)
{
if (!mHighlightedItem)
{
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index 76104e12..e0604c78 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -85,7 +85,7 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics)
// Draw item keyboard shortcut.
const char *key = SDL_GetKeyName(
- (SDLKey) keyboard.getKeyValue(keyboard.KEY_SHORTCUT_0+i));
+ (SDLKey) keyboard.getKeyValue(keyboard.KEY_SHORTCUT_0 + i));
g->drawText(key, itemX + 2, itemY + 2, gcn::Graphics::LEFT);
if (itemShortcut->getItem(i) < 0)
@@ -96,9 +96,11 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics)
// Draw item icon.
Image* image = item->getImage();
if (image) {
+ // TODO: Have label indicate equipped status
+ const std::string label = toString(item->getQuantity());
g->drawImage(image, itemX, itemY);
g->drawText(
- toString(item->getQuantity()),
+ label,
itemX + mBoxWidth / 2,
itemY + mBoxHeight - 14,
gcn::Graphics::CENTER);
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index a89da974..bea14864 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -61,14 +61,8 @@ void ItemShortcut::save()
{
for (int i = 0; i < SHORTCUT_ITEMS; i++)
{
- if (mItems[i])
- {
- config.setValue("shortcut" + toString(i), mItems[i]);
- }
- else
- {
- config.setValue("shortcut" + toString(i), -1);
- }
+ const int itemId = mItems[i] ? mItems[i] : -1;
+ config.setValue("shortcut" + toString(i), itemId);
}
}
@@ -77,9 +71,20 @@ void ItemShortcut::useItem(int index)
if (mItems[index])
{
Item *item = player_node->searchForItem(mItems[index]);
- if (item && item->getQuantity()) {
+ if (item && item->getQuantity())
+ {
// TODO: Fix this (index vs. pointer mismatch)
- //player_node->useItem(item);
+ /*
+ if (item->isEquipment()) {
+ if (item->isEquipped()) {
+ player_node->unequipItem(item);
+ } else {
+ player_node->equipItem(item);
+ }
+ } else {
+ player_node->useItem(item);
+ }
+ */
}
}
}