From cd68076f45b1ae6332b5298f57240aa4b0ebf357 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 9 Apr 2008 14:49:07 +0000 Subject: Re-enabled non-functional item shortcut window, planned to be fixed for 0.0.25 (reverted change 3811). Somehow seems it's not drawing anything, not sure why. --- ChangeLog | 4 ++++ src/CMakeLists.txt | 6 ++++++ src/Makefile.am | 6 ++++++ src/game.cpp | 14 ++++++-------- src/gui/itemcontainer.cpp | 12 ++++++------ src/gui/menuwindow.cpp | 12 ++++++------ src/main.cpp | 6 +++--- src/net/inventoryhandler.cpp | 4 ++-- 8 files changed, 39 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0fae7ff0..b2c136db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * src/gui/shoplistbox.cpp, src/gui/shoplistbox.h: Fixed problem with row height in shop list box. + * src/game.cpp, src/gui/menuwindow.cpp, src/gui/itemcontainer.cpp, + src/main.cpp, src/CMakeLists.txt, src/net/inventoryhandler.cpp, + src/Makefile.am: Re-enabled non-functional item shortcut window, + planned to be fixed for 0.0.25. 2008-04-07 Bjørn Lindeijer diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 793d135f..aff01cb1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,6 +99,10 @@ SET(SRCS gui/inventorywindow.h gui/itemcontainer.cpp gui/itemcontainer.h + gui/itemshortcutcontainer.cpp + gui/itemshortcutcontainer.h + gui/itemshortcutwindow.cpp + gui/itemshortcutwindow.h gui/item_amount.cpp gui/item_amount.h gui/linkhandler.h @@ -290,6 +294,8 @@ SET(SRCS inventory.h item.cpp item.h + itemshortcut.cpp + itemshortcut.h joystick.cpp joystick.h keyboardconfig.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 329dbd78..dab89e54 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,6 +49,10 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \ gui/inventorywindow.h \ gui/itemcontainer.cpp \ gui/itemcontainer.h \ + gui/itemshortcutcontainer.cpp \ + gui/itemshortcutcontainer.h \ + gui/itemshortcutwindow.cpp \ + gui/itemshortcutwindow.h \ gui/item_amount.cpp \ gui/item_amount.h \ gui/linkhandler.h \ @@ -240,6 +244,8 @@ tmw_SOURCES = gui/widgets/resizegrip.cpp \ inventory.h \ item.cpp \ item.h \ + itemshortcut.cpp \ + itemshortcut.h \ joystick.cpp \ joystick.h \ keyboardconfig.cpp \ diff --git a/src/game.cpp b/src/game.cpp index 0d8cfa6c..9eadeba0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -36,7 +36,7 @@ #include "engine.h" #include "flooritemmanager.h" #include "graphics.h" -//#include "itemshortcut.h" +#include "itemshortcut.h" #include "joystick.h" #include "keyboardconfig.h" #include "localplayer.h" @@ -54,7 +54,7 @@ #include "gui/gui.h" #include "gui/help.h" #include "gui/inventorywindow.h" -//#include "gui/itemshortcutwindow.h" +#include "gui/itemshortcutwindow.h" #include "gui/menuwindow.h" #include "gui/minimap.h" #include "gui/ministatus.h" @@ -120,7 +120,7 @@ TradeWindow *tradeWindow; //BuddyWindow *buddyWindow; HelpWindow *helpWindow; DebugWindow *debugWindow; -//ItemShortcutWindow *itemShortcutWindow; +ItemShortcutWindow *itemShortcutWindow; BeingManager *beingManager = NULL; FloorItemManager *floorItemManager = NULL; @@ -201,7 +201,7 @@ void createGuiWindows(Network *network) //buddyWindow = new BuddyWindow(); helpWindow = new HelpWindow(); debugWindow = new DebugWindow(); - //itemShortcutWindow = new ItemShortcutWindow(); + itemShortcutWindow = new ItemShortcutWindow(); // Initialize window positions //chargeDialog->setPosition( @@ -214,7 +214,7 @@ void createGuiWindows(Network *network) chatWindow->setVisible(true); miniStatusWindow->setVisible(true); menuWindow->setVisible(true); - //itemShortcutWindow->setVisible(true); + itemShortcutWindow->setVisible(true); if (config.getValue("logToChat", 0)) { @@ -247,7 +247,7 @@ void destroyGuiWindows() //delete buddyWindow; delete helpWindow; delete debugWindow; - //delete itemShortcutWindow; + delete itemShortcutWindow; } Game::Game(Network *network): @@ -541,7 +541,6 @@ void Game::handleInput() { 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++) @@ -552,7 +551,6 @@ void Game::handleInput() break; } } - */ switch (tKey) { case KeyboardConfig::KEY_PICKUP: { diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index c73d25f3..ad0674f4 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -29,7 +29,7 @@ #include "../graphics.h" #include "../inventory.h" #include "../item.h" -//#include "../itemshortcut.h" +#include "../itemshortcut.h" #include "../log.h" #include "../resources/image.h" @@ -197,7 +197,7 @@ ItemContainer::mousePressed(gcn::MouseEvent &event) int my = event.getY(); int index = mx / gridWidth + ((my / gridHeight) * columns) + 2; - //itemShortcut->setItemSelected(NULL); + itemShortcut->setItemSelected(NULL); // Fix for old server, it should be: if (index >= mMaxItems) if (index > mMaxItems + 1) { @@ -206,9 +206,9 @@ ItemContainer::mousePressed(gcn::MouseEvent &event) } Item *item = mInventory->getItem(index); setSelectedItem(item); - //if (!item->isEquipment()) - //{ - // itemShortcut->setItemSelected(item); - //} + if (!item->isEquipment()) + { + itemShortcut->setItemSelected(item); + } } } diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index e4d101c8..2043b7d1 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -35,7 +35,7 @@ extern Window *inventoryWindow; extern Window *equipmentWindow; extern Window *skillDialog; extern Window *statusWindow; -//extern Window *itemShortcutWindow; +extern Window *itemShortcutWindow; namespace { struct MenuWindowListener : public gcn::ActionListener @@ -62,7 +62,7 @@ MenuWindow::MenuWindow(): "Equipment", "Inventory", "Skills", -// "Shortcut", + "Shortcut", "Setup", 0 }; @@ -107,10 +107,10 @@ void MenuWindowListener::action(const gcn::ActionEvent &event) { window = skillDialog; } - //else if (event.getId() == "Shortcut") - //{ - // window = itemShortcutWindow; - //} + else if (event.getId() == "Shortcut") + { + window = itemShortcutWindow; + } else if (event.getId() == "Setup") { window = setupWindow; diff --git a/src/main.cpp b/src/main.cpp index 4e9936e9..9e75090c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,7 +48,7 @@ #include "keyboardconfig.h" #include "game.h" #include "graphics.h" -//#include "itemshortcut.h" +#include "itemshortcut.h" #include "lockedarray.h" #include "localplayer.h" #include "log.h" @@ -308,7 +308,7 @@ void init_engine(const Options &options) graphics->_beginDraw(); // Initialize the item shortcuts. - //itemShortcut = new ItemShortcut(); + itemShortcut = new ItemShortcut(); gui = new Gui(graphics); state = UPDATE_STATE; /**< Initial game state */ @@ -337,7 +337,7 @@ void init_engine(const Options &options) void exit_engine() { // Before config.write() since it writes the shortcuts to the config - //delete itemShortcut; + delete itemShortcut; config.write(); diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index 9e18f23c..7ed7e38d 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -30,7 +30,7 @@ #include "../resources/iteminfo.h" #include "../item.h" -//#include "../itemshortcut.h" +#include "../itemshortcut.h" #include "../localplayer.h" #include "../gui/chat.h" @@ -80,7 +80,7 @@ void InventoryHandler::handleMessage(MessageIn *msg) player_node->getInvItem(index)->setEquipment(true); } } - //itemShortcut->load(); + itemShortcut->load(); break; case SMSG_PLAYER_INVENTORY_ADD: -- cgit v1.2.3-70-g09d2