summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--data/graphics/gui/CMakeLists.txt2
-rw-r--r--data/graphics/gui/Makefile.am2
-rw-r--r--src/game.cpp3
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/itemshortcutwindow.h2
-rw-r--r--src/gui/menuwindow.cpp7
-rw-r--r--src/itemshortcut.cpp10
-rw-r--r--src/itemshortcut.h5
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/main.cpp5
-rw-r--r--src/net/inventoryhandler.cpp1
12 files changed, 32 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 5dd93d53..b20f6283 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
* src/gui/itemshortcutcontainer.h: Fixed compiler warning.
* src/CMakeLists.txt, src/Makefile.am: Updated source lists.
+ * data/graphics/gui/CMakeLists.txt, data/graphics/gui/Makefile.am:
+ Added close button and item shortcut backgrounds to files that will be
+ installed.
2007-08-22 Philipp Sehmisch <tmw@crushnet.org>
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt
index 5a5c8334..2ef4b460 100644
--- a/data/graphics/gui/CMakeLists.txt
+++ b/data/graphics/gui/CMakeLists.txt
@@ -7,6 +7,7 @@ SET (FILES
buttonhi.png
buttonpress.png
checkbox.png
+ close_button.png
deepbox.png
fixedfont.png
hits_blue.png
@@ -18,6 +19,7 @@ SET (FILES
hscroll_right_default.png
hscroll_right_highlight.png
hscroll_right_pressed.png
+ item_shortcut_bgr.png
mouse.png
menuitemD.png
menuitemF.png
diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am
index 8cd42d27..6b82843d 100644
--- a/data/graphics/gui/Makefile.am
+++ b/data/graphics/gui/Makefile.am
@@ -10,6 +10,7 @@ gui_DATA = \
buttonhi.png \
buttonpress.png \
checkbox.png \
+ close_button.png \
deepbox.png \
fixedfont.png \
hits_blue.png \
@@ -21,6 +22,7 @@ gui_DATA = \
hscroll_right_default.png \
hscroll_right_highlight.png \
hscroll_right_pressed.png \
+ item_shortcut_bgr.png \
mouse.png \
menuitemD.png \
menuitemF.png \
diff --git a/src/game.cpp b/src/game.cpp
index ec0f7d24..4478adad 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -199,6 +199,7 @@ void createGuiWindows(Network *network)
helpWindow = new HelpWindow();
debugWindow = new DebugWindow();
itemShortcutWindow = new ItemShortcutWindow();
+
// Initialize window positions
//chargeDialog->setPosition(
// graphics->getWidth() - 5 - chargeDialog->getWidth(),
@@ -522,7 +523,7 @@ void Game::handleInput()
{
if (tKey == i) {
itemShortcut->useItem(
- i - KeyboardConfig::KEY_SHORTCUT_0);
+ i - KeyboardConfig::KEY_SHORTCUT_0);
break;
}
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 3e7541cf..bcb4ac0a 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -208,7 +208,7 @@ Gui::draw()
Uint8 button = SDL_GetMouseState(&mouseX, &mouseY);
if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1)) &&
- mCustomCursor)
+ mCustomCursor)
{
static_cast<Graphics*>(mGraphics)->drawImage(
mMouseCursor->get(mCursorType),
diff --git a/src/gui/itemshortcutwindow.h b/src/gui/itemshortcutwindow.h
index 54611efe..16a06b55 100644
--- a/src/gui/itemshortcutwindow.h
+++ b/src/gui/itemshortcutwindow.h
@@ -65,5 +65,7 @@ class ItemShortcutWindow : public Window
gcn::ScrollArea *mInvenScroll;
};
+
extern ItemShortcutWindow *itemShortcutWindow;
+
#endif
diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp
index c7505bae..e6b35f5a 100644
--- a/src/gui/menuwindow.cpp
+++ b/src/gui/menuwindow.cpp
@@ -118,9 +118,12 @@ void MenuWindowListener::action(const gcn::ActionEvent &event)
{
window = setupWindow;
}
- if (window) {
+
+ if (window)
+ {
window->setVisible(!window->isVisible());
- if (window->isVisible()) {
+ if (window->isVisible())
+ {
window->requestMoveToTop();
}
}
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 53d121f6..c212d506 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -45,9 +45,9 @@ ItemShortcut::~ItemShortcut()
void ItemShortcut::load()
{
- for(int i = 0; i < SHORTCUT_ITEMS; i++)
+ for (int i = 0; i < SHORTCUT_ITEMS; i++)
{
- int itemId = (int) config.getValue("itemShortcut"+toString(i), -1.0);
+ int itemId = (int) config.getValue("itemShortcut" + toString(i), -1);
if (itemId != -1)
{
@@ -62,15 +62,15 @@ void ItemShortcut::load()
void ItemShortcut::save()
{
- for(int i = 0; i < SHORTCUT_ITEMS; i++)
+ for (int i = 0; i < SHORTCUT_ITEMS; i++)
{
if (mItems[i])
{
- config.setValue("shortcut"+toString(i), mItems[i]->getId());
+ config.setValue("shortcut" + toString(i), mItems[i]->getId());
}
else
{
- config.setValue("shortcut"+toString(i), -1);
+ config.setValue("shortcut" + toString(i), -1);
}
}
}
diff --git a/src/itemshortcut.h b/src/itemshortcut.h
index 23835c3b..d211c7f3 100644
--- a/src/itemshortcut.h
+++ b/src/itemshortcut.h
@@ -32,7 +32,8 @@
*/
typedef Item* ItemPtr;
-class ItemShortcut {
+class ItemShortcut
+{
public:
/**
* Constructor.
@@ -123,5 +124,7 @@ class ItemShortcut {
ItemPtr mItemSelected; /**< the item held by cursor */
};
+
extern ItemShortcut *itemShortcut;
+
#endif
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 96f3f8c3..940934b8 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -130,7 +130,7 @@ Item* LocalPlayer::getInvItem(int index)
Item* LocalPlayer::searchForItem(int itemId)
{
- for(int i = 0; i < INVENTORY_SIZE; i++)
+ for (int i = 0; i < INVENTORY_SIZE; i++)
{
if (itemId == mInventory->getItem(i)->getId()) {
return mInventory->getItem(i);
diff --git a/src/main.cpp b/src/main.cpp
index 5b7737d9..e179fd32 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -301,6 +301,7 @@ void init_engine(const Options &options)
bpp << " video mode: " << SDL_GetError() << std::endl;
exit(1);
}
+
// Initialize for drawing
graphics->_beginDraw();
@@ -324,14 +325,16 @@ void init_engine(const Options &options)
logger->log("Warning: %s", err);
}
- //Initialize keyboard
+ // Initialize keyboard
keyboard.init();
}
/** Clear the engine */
void exit_engine()
{
+ // Before config.write() since it writes the shortcuts to the config
delete itemShortcut;
+
config.write();
delete gui;
diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp
index 400c570d..7ed7e38d 100644
--- a/src/net/inventoryhandler.cpp
+++ b/src/net/inventoryhandler.cpp
@@ -73,6 +73,7 @@ void InventoryHandler::handleMessage(MessageIn *msg)
msg->skip(8); // card (4 shorts)
player_node->addInvItem(index, itemId, amount, false);
+
// Trick because arrows are not considered equipment
if (itemId == 1199 || itemId == 529)
{