summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-21 15:11:19 +0000
committerJoshua Langley <joshlangley[at]optusnet.com.au>2007-08-21 15:11:19 +0000
commit0f8e80bcfe92ca39803f0443cf4b30e3f9171eb9 (patch)
treea07d923f09e8c9aa4a478e2bd572ab94edf09ae4 /src/game.cpp
parent148b62c05337eaaaf3a1ead212b3792122812cee (diff)
downloadmana-0f8e80bcfe92ca39803f0443cf4b30e3f9171eb9.tar.gz
mana-0f8e80bcfe92ca39803f0443cf4b30e3f9171eb9.tar.bz2
mana-0f8e80bcfe92ca39803f0443cf4b30e3f9171eb9.tar.xz
mana-0f8e80bcfe92ca39803f0443cf4b30e3f9171eb9.zip
mantis id=118 - Added Item Shortcut Bar.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index a2ea9af6..ec0f7d24 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -36,6 +36,7 @@
#include "engine.h"
#include "flooritemmanager.h"
#include "graphics.h"
+#include "itemshortcut.h"
#include "joystick.h"
#include "keyboardconfig.h"
#include "localplayer.h"
@@ -53,6 +54,7 @@
#include "gui/gui.h"
#include "gui/help.h"
#include "gui/inventorywindow.h"
+#include "gui/itemshortcutwindow.h"
#include "gui/menuwindow.h"
#include "gui/minimap.h"
#include "gui/ministatus.h"
@@ -116,6 +118,7 @@ TradeWindow *tradeWindow;
//BuddyWindow *buddyWindow;
HelpWindow *helpWindow;
DebugWindow *debugWindow;
+ItemShortcutWindow *itemShortcutWindow;
BeingManager *beingManager = NULL;
FloorItemManager *floorItemManager = NULL;
@@ -195,7 +198,7 @@ void createGuiWindows(Network *network)
//buddyWindow = new BuddyWindow();
helpWindow = new HelpWindow();
debugWindow = new DebugWindow();
-
+ itemShortcutWindow = new ItemShortcutWindow();
// Initialize window positions
//chargeDialog->setPosition(
// graphics->getWidth() - 5 - chargeDialog->getWidth(),
@@ -207,6 +210,7 @@ void createGuiWindows(Network *network)
chatWindow->setVisible(true);
miniStatusWindow->setVisible(true);
menuWindow->setVisible(true);
+ itemShortcutWindow->setVisible(true);
}
/**
@@ -234,6 +238,7 @@ void destroyGuiWindows()
//delete buddyWindow;
delete helpWindow;
delete debugWindow;
+ delete itemShortcutWindow;
}
Game::Game(Network *network):
@@ -509,7 +514,19 @@ void Game::handleInput()
if (keyboard.isEnabled() && !chatWindow->isFocused())
{
- switch (keyboard.getKeyIndex(event.key.keysym.sym)) {
+ const int tKey = keyboard.getKeyIndex(event.key.keysym.sym);
+ // Checks if any item shortcut is pressed.
+ for (int i = KeyboardConfig::KEY_SHORTCUT_0;
+ i <= KeyboardConfig::KEY_SHORTCUT_9;
+ i++)
+ {
+ if (tKey == i) {
+ itemShortcut->useItem(
+ i - KeyboardConfig::KEY_SHORTCUT_0);
+ break;
+ }
+ }
+ switch (tKey) {
case KeyboardConfig::KEY_PICKUP:
{
FloorItem *item = floorItemManager->findByCoordinates(