summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog23
-rw-r--r--src/game.cpp11
-rw-r--r--src/gui/chat.cpp2
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/gccontainer.cpp14
-rw-r--r--src/gui/gccontainer.h8
-rw-r--r--src/gui/guildwindow.cpp2
-rw-r--r--src/gui/guildwindow.h4
-rw-r--r--src/gui/itemshortcutcontainer.cpp4
-rw-r--r--src/gui/window.cpp23
-rw-r--r--src/gui/window.h8
-rw-r--r--src/localplayer.cpp6
-rw-r--r--src/log.h6
-rw-r--r--src/resources/imageset.cpp2
14 files changed, 69 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f5ed720..63963641 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -456,6 +456,16 @@
as messages from server. Made messages from unknown beings display as
from "Unknown" instead of "John Doe".
+2008-05-08 Dennis Friis <peavey@placid.dk>
+
+ * src/game.cpp: Make F8 toggle shortcut window as suggested by And1
+ and fate.
+
+2008-05-06 Dennis Friis <peavey@placid.dk>
+
+ * src/gui/itemshortcutcontainer.cpp: Dont allow dragging of empty
+ placeholders.
+
2008-05-05 Bjørn Lindeijer <bjorn@lindeijer.nl>
* src/gui/chat.h, src/gui/chat.cpp: Only update the size of chat
@@ -463,6 +473,19 @@
2008-04-29 Bjørn Lindeijer <bjorn@lindeijer.nl>
+ * src/game.cpp, src/gui/chat.h, src/gui/chat.cpp: Fixed issue with
+ determining whether chat input is focused (method no longer virtual).
+ * src/gui/itemshortcutcontainer.cpp: Fixed sometimes rendering with
+ the wrong font.
+ * src/gui/window.h, src/gui/window.cpp: Fixed warnings about hiding
+ virtual method, Window now always deletes its children (the option not
+ to do so was never used anyway).
+ * src/gui/gccontainer.h, src/gui/gccontainer.cpp: Removed unused
+ option from GCContainer to not delete a child, fixing warnings about
+ hiding virtual method gcn::Container::add.
+ * src/log.h, src/resources/imageset.cpp: When compiling with GCC, use
+ the printf format attribute for the log method so that the compiler
+ checks the type of its parameters.
* src/localplayer.cpp, src/gui/changeemaildialog.h, src/localplayer.h:
Name structs with capital, just like classes.
diff --git a/src/game.cpp b/src/game.cpp
index 6ae1a0f4..80d5610f 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -516,14 +516,14 @@ void Game::handleInput()
case SDLK_F5: requestedWindow = skillDialog; break;
case SDLK_F6: requestedWindow = minimap; break;
case SDLK_F7: requestedWindow = chatWindow; break;
- //case SDLK_F8: requestedWindow = buddyWindow; break;
+ case SDLK_F8: requestedWindow = itemShortcutWindow; break;
case SDLK_F9: requestedWindow = setupWindow; break;
case SDLK_F10: requestedWindow = debugWindow; break;
//case SDLK_F11: requestedWindow = newSkillWindow; break;
case SDLK_RETURN:
// Input chat window
- if (chatWindow->isFocused() ||
+ if (chatWindow->isInputFocused() ||
deathNotice != NULL ||
weightNotice != NULL)
{
@@ -572,7 +572,8 @@ void Game::handleInput()
break;
}
- if (keyboard.isEnabled() && !chatWindow->isFocused() && !guildWindow->isFocused())
+ if (keyboard.isEnabled() && !chatWindow->isInputFocused()
+ && !guildWindow->isWindowFocused())
{
const int tKey = keyboard.getKeyIndex(event.key.keysym.sym);
// Checks if any item shortcut is pressed.
@@ -634,7 +635,7 @@ void Game::handleInput()
case KeyboardConfig::KEY_HIDE_WINDOWS:
// Hide certain windows
- if (!chatWindow->isFocused())
+ if (!chatWindow->isInputFocused())
{
statusWindow->setVisible(false);
inventoryWindow->setVisible(false);
@@ -759,7 +760,7 @@ void Game::handleInput()
}
// Moving player around
if (player_node->mAction != Being::DEAD &&
- !chatWindow->isFocused())
+ !chatWindow->isInputFocused())
{
// Get the state of the keyboard keys
keyboard.refreshActiveKeys();
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index b7c63247..bda31427 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -297,7 +297,7 @@ ChatWindow::requestChatFocus()
}
bool
-ChatWindow::isFocused()
+ChatWindow::isInputFocused()
{
return mChatInput->isFocused();
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 3923e097..f7af6480 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -110,7 +110,7 @@ class ChatWindow : public Window,
/**
* Checks whether ChatWindow is Focused or not.
*/
- bool isFocused();
+ bool isInputFocused();
/**
* Determines whether the message is a command or message, then
diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp
index c22ddfc9..1edb4daf 100644
--- a/src/gui/gccontainer.cpp
+++ b/src/gui/gccontainer.cpp
@@ -37,21 +37,15 @@ GCContainer::~GCContainer()
mDeathList.clear();
}
-void GCContainer::add(gcn::Widget *w, bool delChild)
+void GCContainer::add(gcn::Widget *w)
{
- if (delChild) {
- mDeathList.push_back(w);
- }
-
+ mDeathList.push_back(w);
Container::add(w);
}
-void GCContainer::add(gcn::Widget *w, int x, int y, bool delChild)
+void GCContainer::add(gcn::Widget *w, int x, int y)
{
- if (delChild) {
- mDeathList.push_back(w);
- }
-
+ mDeathList.push_back(w);
Container::add(w, x, y);
}
diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h
index e27eaa96..8b8a7ffe 100644
--- a/src/gui/gccontainer.h
+++ b/src/gui/gccontainer.h
@@ -28,14 +28,18 @@
#include <guichan/widgets/container.hpp>
+/**
+ * A garbage collecting container. Childs added to this container are
+ * automatically deleted when the container is deleted.
+ */
class GCContainer : public gcn::Container
{
public:
virtual ~GCContainer();
- virtual void add(gcn::Widget *w, bool delChild = true);
+ virtual void add(gcn::Widget *w);
- virtual void add(gcn::Widget *w, int x, int y, bool delChild = true);
+ virtual void add(gcn::Widget *w, int x, int y);
virtual void death(const gcn::Event &event);
diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp
index a2b8243c..a50bd219 100644
--- a/src/gui/guildwindow.cpp
+++ b/src/gui/guildwindow.cpp
@@ -208,7 +208,7 @@ void GuildWindow::setTab(const std::string &guildName)
mGuildButton[2]->setEnabled(true);
}
-bool GuildWindow::isFocused()
+bool GuildWindow::isWindowFocused()
{
return mFocus;
}
diff --git a/src/gui/guildwindow.h b/src/gui/guildwindow.h
index c2ac2b4d..e1bd99d7 100644
--- a/src/gui/guildwindow.h
+++ b/src/gui/guildwindow.h
@@ -87,9 +87,9 @@ public:
void updateTab();
/**
- * Check if the window is in focus
+ * Check if the window is in focus.
*/
- bool isFocused();
+ bool isWindowFocused();
/**
* Create a dialog for accepting an invite
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index a54e3678..23b41650 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -76,6 +76,8 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics)
{
Graphics *g = static_cast<Graphics*>(graphics);
+ graphics->setFont(getFont());
+
for (int i = 0; i < mMaxItems; i++)
{
const int itemX = (i % mGridWidth) * mBoxWidth;
@@ -149,6 +151,8 @@ ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event)
if (index == -1) {
return;
}
+ if (itemShortcut->getItem(index) < 0)
+ return;
Item *item = player_node->searchForItem(itemShortcut->getItem(index));
if (item)
{
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 24c9f850..2bce49b2 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -306,14 +306,7 @@ bool Window::isSticky()
void Window::setVisible(bool visible)
{
- if (isSticky())
- {
- gcn::Window::setVisible(true);
- }
- else
- {
- gcn::Window::setVisible(visible);
- }
+ gcn::Window::setVisible(isSticky() || visible);
}
void Window::scheduleDelete()
@@ -576,24 +569,22 @@ void Window::setGuiAlpha()
mAlphaChanged = false;
}
-void Window::loadSkin(const std::string filename)
+void Window::loadSkin(const std::string &fileName)
{
- const std::string windowId = Window::getId();
-
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *resman = ResourceManager::getInstance();
- logger->log("Loading Window Skin '%s'.", filename.c_str());
- logger->log("Loading Window ID '%d'.", windowId.c_str());
+ logger->log("Loading Window Skin '%s'.", fileName.c_str());
+ logger->log("Loading Window ID '%s'.", Window::getId().c_str());
- if(filename == "")
+ if (fileName == "")
logger->error("Window::loadSkin(): Invalid File Name.");
// TODO:
// If there is an error loading the specified file, we should try to revert
// to a 'default' skin file. Only if the 'default' skin file can't be loaded
// should we have a terminating error.
- XML::Document doc(filename);
+ XML::Document doc(fileName);
xmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset"))
diff --git a/src/gui/window.h b/src/gui/window.h
index bdd737af..44982500 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -251,10 +251,10 @@ class Window : public gcn::Window, gcn::WidgetListener
*/
ContainerPlacer getPlacer(int x, int y);
- /**
- * Loads a window skin
- */
- void loadSkin(const std::string filename);
+ /**
+ * Loads a window skin
+ */
+ void loadSkin(const std::string &fileName);
private:
/**
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index fe3f1f45..6c802c5c 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -197,8 +197,10 @@ Item* LocalPlayer::searchForItem(int itemId)
{
for (int i = 0; i < INVENTORY_SIZE; i++)
{
- if (itemId == mInventory->getItem(i)->getId()) {
- return mInventory->getItem(i);
+ if (Item *item = mInventory->getItem(i)) {
+ if (item->getId() == itemId) {
+ return item;
+ }
}
}
return NULL;
diff --git a/src/log.h b/src/log.h
index 5abf46a5..30078e35 100644
--- a/src/log.h
+++ b/src/log.h
@@ -61,7 +61,11 @@ class Logger
/**
* Enters a message in the log. The message will be timestamped.
*/
- void log(const char *log_text, ...);
+ void log(const char *log_text, ...)
+#ifdef __GNUC__
+ __attribute__((__format__(__printf__, 2, 3)))
+#endif
+ ;
/**
* Log an error and quit. The error will pop-up on Windows and Mac, and
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index 04faf0a3..ba612103 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -52,7 +52,7 @@ ImageSet::get(size_type i) const
{
if (i >= mImages.size())
{
- logger->log("Warning: Sprite #%i does not exist in this image set", i);
+ logger->log("Warning: No sprite %d in this image set", (int) i);
return NULL;
}
else