summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog46
-rw-r--r--src/Makefile.am3
-rw-r--r--src/being.cpp22
-rw-r--r--src/being.h16
-rw-r--r--src/configlistener.cpp28
-rw-r--r--src/configlistener.h51
-rw-r--r--src/configuration.cpp16
-rw-r--r--src/configuration.h22
-rw-r--r--src/engine.cpp69
-rw-r--r--src/engine.h7
-rw-r--r--src/equipment.cpp3
-rw-r--r--src/equipment.h2
-rw-r--r--src/game.cpp92
-rw-r--r--src/game.h10
-rw-r--r--src/graphic/imagerect.h50
-rw-r--r--src/graphic/spriteset.cpp2
-rw-r--r--src/graphic/spriteset.h4
-rw-r--r--src/graphics.cpp10
-rw-r--r--src/graphics.h35
-rw-r--r--src/gui/box.h4
-rw-r--r--src/gui/browserbox.cpp13
-rw-r--r--src/gui/browserbox.h11
-rw-r--r--src/gui/buddywindow.h6
-rw-r--r--src/gui/button.cpp10
-rw-r--r--src/gui/button.h8
-rw-r--r--src/gui/buy.cpp19
-rw-r--r--src/gui/buy.h10
-rw-r--r--src/gui/buysell.h2
-rw-r--r--src/gui/char_select.cpp19
-rw-r--r--src/gui/char_select.h10
-rw-r--r--src/gui/char_server.cpp11
-rw-r--r--src/gui/char_server.h4
-rw-r--r--src/gui/chargedialog.cpp5
-rw-r--r--src/gui/chargedialog.h6
-rw-r--r--src/gui/chat.cpp9
-rw-r--r--src/gui/chat.h15
-rw-r--r--src/gui/chatinput.cpp1
-rw-r--r--src/gui/checkbox.cpp4
-rw-r--r--src/gui/checkbox.h8
-rw-r--r--src/gui/confirm_dialog.cpp5
-rw-r--r--src/gui/confirm_dialog.h3
-rw-r--r--src/gui/equipmentwindow.cpp10
-rw-r--r--src/gui/equipmentwindow.h3
-rw-r--r--src/gui/focushandler.h2
-rw-r--r--src/gui/gui.cpp54
-rw-r--r--src/gui/gui.h13
-rw-r--r--src/gui/help.cpp6
-rw-r--r--src/gui/help.h6
-rw-r--r--src/gui/inttextbox.cpp2
-rw-r--r--src/gui/inttextbox.h3
-rw-r--r--src/gui/inventorywindow.cpp17
-rw-r--r--src/gui/inventorywindow.h6
-rw-r--r--src/gui/item_amount.cpp9
-rw-r--r--src/gui/item_amount.h9
-rw-r--r--src/gui/itemcontainer.cpp14
-rw-r--r--src/gui/itemcontainer.h12
-rw-r--r--src/gui/listbox.cpp2
-rw-r--r--src/gui/listbox.h2
-rw-r--r--src/gui/login.cpp20
-rw-r--r--src/gui/login.h8
-rw-r--r--src/gui/minimap.cpp6
-rw-r--r--src/gui/minimap.h5
-rw-r--r--src/gui/newskill.cpp6
-rw-r--r--src/gui/newskill.h8
-rw-r--r--src/gui/npc.h9
-rw-r--r--src/gui/npc_text.h7
-rw-r--r--src/gui/ok_dialog.cpp4
-rw-r--r--src/gui/ok_dialog.h2
-rw-r--r--src/gui/passwordfield.h1
-rw-r--r--src/gui/playerbox.cpp10
-rw-r--r--src/gui/playerbox.h5
-rw-r--r--src/gui/popupmenu.cpp19
-rw-r--r--src/gui/popupmenu.h11
-rw-r--r--src/gui/progressbar.cpp6
-rw-r--r--src/gui/progressbar.h7
-rw-r--r--src/gui/radiobutton.cpp3
-rw-r--r--src/gui/radiobutton.h6
-rw-r--r--src/gui/requesttrade.cpp6
-rw-r--r--src/gui/requesttrade.h8
-rw-r--r--src/gui/scrollarea.cpp7
-rw-r--r--src/gui/scrollarea.h6
-rw-r--r--src/gui/sell.cpp18
-rw-r--r--src/gui/sell.h11
-rw-r--r--src/gui/setup.cpp17
-rw-r--r--src/gui/setup.h7
-rw-r--r--src/gui/skill.h8
-rw-r--r--src/gui/slider.cpp3
-rw-r--r--src/gui/slider.h6
-rw-r--r--src/gui/stats.cpp5
-rw-r--r--src/gui/stats.h6
-rw-r--r--src/gui/status.cpp13
-rw-r--r--src/gui/status.h10
-rw-r--r--src/gui/textbox.cpp3
-rw-r--r--src/gui/textbox.h2
-rw-r--r--src/gui/textfield.cpp6
-rw-r--r--src/gui/textfield.h5
-rw-r--r--src/gui/trade.cpp54
-rw-r--r--src/gui/trade.h13
-rw-r--r--src/gui/updatewindow.cpp29
-rw-r--r--src/gui/updatewindow.h13
-rw-r--r--src/gui/window.cpp14
-rw-r--r--src/gui/window.h12
-rw-r--r--src/gui/windowcontainer.h2
-rw-r--r--src/guichanfwd.h73
-rw-r--r--src/inventory.cpp21
-rw-r--r--src/inventory.h21
-rw-r--r--src/item.h2
-rw-r--r--src/log.cpp2
-rw-r--r--src/log.h6
-rw-r--r--src/main.cpp55
-rw-r--r--src/main.h8
-rw-r--r--src/map.cpp3
-rw-r--r--src/map.h8
-rw-r--r--src/net/protocol.cpp31
-rw-r--r--src/net/protocol.h2
-rw-r--r--src/playerinfo.h5
-rw-r--r--src/resources/buddylist.h5
-rw-r--r--src/resources/image.cpp8
-rw-r--r--src/resources/image.h3
-rw-r--r--src/resources/itemmanager.cpp12
-rw-r--r--src/resources/itemmanager.h3
-rw-r--r--src/resources/mapreader.cpp13
-rw-r--r--src/resources/mapreader.h9
-rw-r--r--src/resources/music.h4
-rw-r--r--src/resources/resource.cpp4
-rw-r--r--src/resources/resourcemanager.cpp18
-rw-r--r--src/resources/resourcemanager.h11
-rw-r--r--src/resources/soundeffect.h4
-rw-r--r--src/sound.cpp4
-rw-r--r--src/sound.h1
130 files changed, 1116 insertions, 488 deletions
diff --git a/ChangeLog b/ChangeLog
index 57fc4891..8a336938 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+2005-08-13 Björn Steinbrink <B.Steinbrink@gmx.de>
+
+ * src/Makefile.am, src/being.cpp, src/being.h, src/configlistener.cpp,
+ src/configlistener.h, src/configuration.cpp, src/configuration.h,
+ src/engine.cpp, src/engine.h, src/equipment.cpp, src/equipment.h,
+ src/game.cpp, src/game.h, src/graphics.cpp, src/graphics.h,
+ src/guichanfwd.h, src/inventory.cpp, src/inventory.h, src/item.h,
+ src/log.cpp, src/log.h, src/main.cpp, src/main.h, src/map.cpp, src/map.h,
+ src/playerinfo.h, src/sound.cpp, src/sound.h, src/graphic/imagerect.h,
+ src/graphic/spriteset.cpp, src/graphic/spriteset.h, src/gui/box.h,
+ src/gui/browserbox.cpp, src/gui/browserbox.h, src/gui/buddywindow.h,
+ src/gui/button.cpp, src/gui/button.h, src/gui/buy.cpp, src/gui/buy.h,
+ src/gui/buysell.h, src/gui/char_select.cpp, src/gui/char_select.h,
+ src/gui/char_server.cpp, src/gui/char_server.h, src/gui/chargedialog.cpp,
+ src/gui/chargedialog.h, src/gui/chat.cpp, src/gui/chat.h,
+ src/gui/chatinput.cpp, src/gui/checkbox.cpp, src/gui/checkbox.h,
+ src/gui/confirm_dialog.cpp, src/gui/confirm_dialog.h,
+ src/gui/equipmentwindow.cpp, src/gui/equipmentwindow.h,
+ src/gui/focushandler.h, src/gui/gui.cpp, src/gui/gui.h, src/gui/help.cpp,
+ src/gui/help.h, src/gui/inttextbox.cpp, src/gui/inttextbox.h,
+ src/gui/inventorywindow.cpp, src/gui/inventorywindow.h,
+ src/gui/item_amount.cpp, src/gui/item_amount.h, src/gui/itemcontainer.cpp,
+ src/gui/itemcontainer.h, src/gui/listbox.cpp, src/gui/listbox.h,
+ src/gui/login.cpp, src/gui/login.h, src/gui/minimap.cpp,
+ src/gui/minimap.h, src/gui/newskill.cpp, src/gui/newskill.h,
+ src/gui/npc.h, src/gui/npc_text.h, src/gui/ok_dialog.cpp,
+ src/gui/ok_dialog.h, src/gui/passwordfield.h, src/gui/playerbox.cpp,
+ src/gui/playerbox.h, src/gui/popupmenu.cpp, src/gui/popupmenu.h,
+ src/gui/progressbar.cpp, src/gui/progressbar.h, src/gui/radiobutton.cpp,
+ src/gui/radiobutton.h, src/gui/requesttrade.cpp, src/gui/requesttrade.h,
+ src/gui/scrollarea.cpp, src/gui/scrollarea.h, src/gui/sell.cpp,
+ src/gui/sell.h, src/gui/setup.cpp, src/gui/setup.h, src/gui/skill.h,
+ src/gui/slider.cpp, src/gui/slider.h, src/gui/stats.cpp, src/gui/stats.h,
+ src/gui/status.cpp, src/gui/status.h, src/gui/textbox.cpp,
+ src/gui/textbox.h, src/gui/textfield.cpp, src/gui/textfield.h,
+ src/gui/trade.cpp, src/gui/trade.h, src/gui/updatewindow.cpp,
+ src/gui/updatewindow.h, src/gui/window.cpp, src/gui/window.h,
+ src/gui/windowcontainer.h, src/net/protocol.cpp, src/net/protocol.h,
+ src/resources/buddylist.hm src/resources/image.cpp, src/resources/image.h,
+ src/resources/itemmanager.cpp, src/resources/itemmanager.h,
+ src/resources/mapreader.cpp, src/resources/mapreader.h,
+ src/resources/music.h, src/resources/resource.cpp,
+ src/resources/resourcemanager.cpp, src/resources/resourcemanager.h,
+ src/resources/soundeffect.h: Huge header cleanup, removing nearly all
+ #include's from headers to reduce dependencies and compile time.
+
2005-08-13 Eugenio Favalli <elvenprogrammer@gmail.com>
* src/gui/status.h, src/gui/status.cpp: Reformatted status window layout to
diff --git a/src/Makefile.am b/src/Makefile.am
index 1c98073c..d20280fa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,6 @@
bin_PROGRAMS = tmw
tmw_SOURCES = graphic/spriteset.cpp \
+ graphic/imagerect.h \
graphic/spriteset.h \
gui/browserbox.cpp \
gui/browserbox.h \
@@ -128,6 +129,8 @@ tmw_SOURCES = graphic/spriteset.cpp \
base64.h \
being.cpp \
being.h \
+ configlistener.cpp \
+ configlistener.h \
configuration.cpp \
configuration.h \
engine.cpp \
diff --git a/src/being.cpp b/src/being.cpp
index 98f19748..04a07152 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -21,18 +21,25 @@
* $Id$
*/
-#include <sstream>
+#include "being.h"
+
#include <iostream>
+#include <sstream>
-#include "being.h"
-#include "log.h"
#include "game.h"
-#include "net/protocol.h"
-#include "net/network.h"
-#include "resources/resourcemanager.h"
+#include "graphics.h"
+#include "log.h"
+#include "map.h"
+
#include "graphic/spriteset.h"
+
#include "gui/gui.h"
+#include "net/network.h"
+#include "net/protocol.h"
+
+#include "resources/resourcemanager.h"
+
extern Being* autoTarget;
extern std::map<int, Spriteset*> monsterset;
@@ -139,7 +146,7 @@ void sort() {
Being::Being():
job(0),
- x(0), y(0), direction(0),
+ x(0), y(0), direction(SOUTH),
action(0), frame(0),
speech_color(0),
walk_time(0),
@@ -250,7 +257,6 @@ void Being::nextStep()
int oldY = y;
int newX = node.x;
int newY = node.y;
- direction = 0;
if (newX > oldX) {
if (newY > oldY) direction = SE;
diff --git a/src/being.h b/src/being.h
index f1354e3a..8d945b76 100644
--- a/src/being.h
+++ b/src/being.h
@@ -27,13 +27,11 @@
#include <list>
#include <string>
-#include "graphics.h"
-#include "map.h"
-
#define NR_HAIR_STYLES 5
#define NR_HAIR_COLORS 10
class Map;
+class Graphics;
struct PATH_NODE {
/**
@@ -65,6 +63,18 @@ class Being
DEAD = 15,
};
+ enum Direction {
+ DIR_NONE = -1,
+ SOUTH = 0,
+ SW = 1,
+ WEST = 2,
+ NW = 3,
+ NORTH = 4,
+ NE = 5,
+ EAST = 6,
+ SE = 7,
+ };
+
unsigned short job; /**< Job (player job, npc, monster, ) */
unsigned short x, y; /**< Tile coordinates */
unsigned char direction; /**< Facing direction */
diff --git a/src/configlistener.cpp b/src/configlistener.cpp
new file mode 100644
index 00000000..456a6845
--- /dev/null
+++ b/src/configlistener.cpp
@@ -0,0 +1,28 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#include "configlistener.h"
+
+ConfigListener::~ConfigListener()
+{
+}
diff --git a/src/configlistener.h b/src/configlistener.h
new file mode 100644
index 00000000..a949ed0f
--- /dev/null
+++ b/src/configlistener.h
@@ -0,0 +1,51 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef _TMW_CONFIGLISTENER_H
+#define _TMW_CONFIGLISTENER_H
+
+#include <iosfwd>
+
+
+/**
+ * The listener interface for receiving notifications about changes to
+ * configuration options.
+ *
+ * \ingroup CORE
+ */
+class ConfigListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~ConfigListener();
+
+ /**
+ * Called when an option changed. The config listener will have to be
+ * registered to the option name first.
+ */
+ virtual void optionChanged(const std::string &name) = 0;
+};
+
+#endif
diff --git a/src/configuration.cpp b/src/configuration.cpp
index a127570c..6c1a57c5 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -23,16 +23,18 @@
#include "configuration.h"
-#include "log.h"
#include <math.h>
-#include <iostream>
-#include <fstream>
#include <sstream>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
#include <libxml/xmlwriter.h>
+#ifdef __DEBUG
+#include <iostream>
+#endif
+
+#include "configlistener.h"
+#include "log.h"
+
// MSVC libxml2 at the moment doesn't work right when using MinGW, missing this
// function at link time.
#ifdef WIN32
@@ -40,10 +42,6 @@
#define xmlFree(x) ;
#endif
-ConfigListener::~ConfigListener()
-{
-}
-
void Configuration::init(const std::string &filename)
{
configPath = filename;
diff --git a/src/configuration.h b/src/configuration.h
index c50e68e0..f1e47aae 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -28,27 +28,7 @@
#include <list>
#include <string>
-
-/**
- * The listener interface for receiving notifications about changes to
- * configuration options.
- *
- * \ingroup CORE
- */
-class ConfigListener
-{
- public:
- /**
- * Destructor.
- */
- virtual ~ConfigListener();
-
- /**
- * Called when an option changed. The config listener will have to be
- * registered to the option name first.
- */
- virtual void optionChanged(const std::string &name) = 0;
-};
+class ConfigListener;
/**
* INI configuration handler for reading (and writing).
diff --git a/src/engine.cpp b/src/engine.cpp
index dae8c8be..7dd70b07 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -21,38 +21,51 @@
* $Id$
*/
-#include <guichan.hpp>
-#include "game.h"
-#include "main.h"
-#include "playerinfo.h"
#include "engine.h"
-#include "log.h"
+
+#include <sstream>
+
#include "being.h"
+#include "configuration.h"
#include "floor_item.h"
+#include "game.h"
#include "graphics.h"
-#include "gui/gui.h"
-#include "gui/minimap.h"
-#include "gui/chargedialog.h"
-#include "gui/trade.h"
-#include "gui/chat.h"
-#include "gui/status.h"
+#include "log.h"
+#include "main.h"
+#include "map.h"
+#include "sound.h"
+
+#include "graphic/spriteset.h"
+
+//#include "gui/buddywindow.h"
#include "gui/buy.h"
-#include "gui/sell.h"
#include "gui/buysell.h"
+#include "gui/chargedialog.h"
+#include "gui/chat.h"
+#include "gui/equipmentwindow.h"
+#include "gui/gui.h"
+#include "gui/help.h"
#include "gui/inventorywindow.h"
-#include "gui/npc_text.h"
+#include "gui/minimap.h"
#include "gui/npc.h"
-#include "gui/stats.h"
-#include "gui/setup.h"
-#include "gui/equipmentwindow.h"
+#include "gui/npc_text.h"
#include "gui/popupmenu.h"
-//#include "gui/buddywindow.h"
-#include "gui/help.h"
-#include "resources/resourcemanager.h"
+#include "gui/sell.h"
+#include "gui/setup.h"
+#include "gui/skill.h"
+#include "gui/stats.h"
+#include "gui/status.h"
+#include "gui/trade.h"
+#include "gui/windowcontainer.h"
+
+#include "resources/image.h"
+#include "resources/iteminfo.h"
#include "resources/itemmanager.h"
+#include "resources/resourcemanager.h"
extern Being* autoTarget;
extern Graphics* graphics;
+extern Spriteset *hairset, *playerset;
char itemCurrenyQ[10] = "0";
int camera_x, camera_y;
@@ -80,6 +93,8 @@ HelpWindow *helpWindow;
PopupMenu *popupMenu;
std::map<int, Spriteset*> monsterset;
+ItemManager *itemDb; /**< Item database object */
+
char hairtable[16][4][2] = {
// S(x,y) W(x,y) N(x,y) E(x,y)
{ { 0, 0}, {-1, 2}, {-1, 2}, { 0, 2} }, // STAND
@@ -108,12 +123,13 @@ int get_x_offset(Being *being)
if (being->action == Being::WALK)
{
- if (direction != NORTH && direction != SOUTH)
+ if (direction != Being::NORTH && direction != Being::SOUTH)
{
offset = (get_elapsed_time(being->walk_time) * 32) / being->speed;
if (offset > 32) offset = 32;
- if (direction == WEST || direction == NW || direction == SW) {
+ if (direction == Being::WEST || direction == Being::NW ||
+ direction == Being::SW) {
offset = -offset;
offset += 32;
}
@@ -133,12 +149,13 @@ int get_y_offset(Being *being)
if (being->action == Being::WALK)
{
- if (direction != EAST && direction != WEST)
+ if (direction != Being::EAST && direction != Being::WEST)
{
offset = (get_elapsed_time(being->walk_time) * 32) / being->speed;
if (offset > 32) offset = 32;
- if (direction == NORTH || direction == NW || direction == NE) {
+ if (direction == Being::NORTH || direction == Being::NW ||
+ direction == Being::NE) {
offset = -offset;
offset += 32;
}
@@ -243,6 +260,10 @@ Engine::Engine():
attackTarget = resman->getImage("graphics/gui/attack_target.png");
if (!attackTarget) logger->error("Unable to load attack_target.png");
+
+ // Initialize item manager
+ itemDb = new ItemManager();
+
}
Engine::~Engine()
@@ -276,6 +297,8 @@ Engine::~Engine()
delete itemset;
attackTarget->decRef();
+
+ delete itemDb;
}
Map *Engine::getCurrentMap()
diff --git a/src/engine.h b/src/engine.h
index 00b6e4f4..725f07e9 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -24,11 +24,12 @@
#ifndef _ENGINE_H
#define _ENGINE_H
-#include "map.h"
-#include "graphic/spriteset.h"
-
extern int camera_x, camera_y;
+class Image;
+class Map;
+class Spriteset;
+
/**
* Game engine that does the main drawing.
*/
diff --git a/src/equipment.cpp b/src/equipment.cpp
index 55799b1a..24c20ea4 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -22,11 +22,12 @@
*/
#include "equipment.h"
+#include "item.h"
Equipment *Equipment::instance = 0;
Equipment::Equipment():
- arrows(NULL)
+ arrows(0)
{
for (int i = 0; i < EQUIPMENT_SIZE; i++)
{
diff --git a/src/equipment.h b/src/equipment.h
index 3198580d..4e6cd705 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -24,7 +24,7 @@
#ifndef _EQUIPMENT_H
#define _EQUIPMENT_H
-#include "item.h"
+class Item;
#define EQUIPMENT_SIZE 10
diff --git a/src/game.cpp b/src/game.cpp
index 210442f5..e70d4dee 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -22,40 +22,49 @@
*/
#include "game.h"
-#include "playerinfo.h"
-#include "floor_item.h"
-#include "main.h"
+
+#include <sstream>
+
+#include <guichan/sdl/sdlinput.hpp>
+
+#include "being.h"
+#include "configuration.h"
#include "engine.h"
+#include "equipment.h"
+#include "floor_item.h"
+#include "graphics.h"
+#include "inventory.h"
+#include "item.h"
#include "log.h"
+#include "main.h"
#include "map.h"
-#include "equipment.h"
+#include "playerinfo.h"
+#include "sound.h"
+
+#include "gui/buy.h"
+#include "gui/buysell.h"
#include "gui/chat.h"
+#include "gui/confirm_dialog.h"
+#include "gui/equipmentwindow.h"
#include "gui/gui.h"
+#include "gui/help.h"
#include "gui/inventorywindow.h"
-#include "gui/shop.h"
#include "gui/npc.h"
-#include "gui/stats.h"
-#include "gui/setup.h"
-#include "gui/equipmentwindow.h"
-#include "gui/popupmenu.h"
#include "gui/npc_text.h"
-#include "gui/trade.h"
-#include "gui/status.h"
-#include "gui/buy.h"
-#include "gui/sell.h"
-#include "gui/buysell.h"
#include "gui/ok_dialog.h"
-#include "gui/confirm_dialog.h"
+#include "gui/popupmenu.h"
#include "gui/requesttrade.h"
-#include "gui/help.h"
-#include "gui/browserbox.h"
-#include "net/protocol.h"
+#include "gui/sell.h"
+#include "gui/setup.h"
+#include "gui/stats.h"
+#include "gui/status.h"
+#include "gui/trade.h"
+
#include "net/network.h"
+#include "net/protocol.h"
+
#include "resources/mapreader.h"
-#include <SDL.h>
-#include <math.h>
-#include <sstream>
extern Graphics *graphics;
@@ -78,7 +87,6 @@ SDL_Joystick *joypad = NULL; /**< Joypad object */
OkDialog *deathNotice = NULL;
ConfirmDialog *exitConfirm = NULL;
-Being *target = NULL;
Inventory *inventory = NULL;
const int EMOTION_TIME = 150; /**< Duration of emotion icon */
@@ -397,14 +405,15 @@ void do_input()
if (!id) {
switch (player_node->direction)
{
- case NORTH: y--; break;
- case SOUTH: y++; break;
- case WEST: x--; break;
- case EAST: x++; break;
- case NW: x--; y--; break;
- case NE: x++; y--; break;
- case SW: x--; y++; break;
- case SE: x++; y++; break;
+ case Being::NORTH: y--; break;
+ case Being::SOUTH: y++; break;
+ case Being::WEST: x--; break;
+ case Being::EAST: x++; break;
+ case Being::NW: x--; y--; break;
+ case Being::NE: x++; y--; break;
+ case Being::SW: x--; y++; break;
+ case Being::SE: x++; y++; break;
+ default: break;
}
id = find_floor_item_by_cor(x, y);
}
@@ -599,7 +608,8 @@ void do_input()
*/
int dx = mx - player_node->x;
int dy = my - player_node->y;
- if (sqrt(dx*dx + dy*dy) < 2)
+ // "sqrt(dx*dx + dy*dy) < 2" is equal to "dx*dx + dy*dy < 4"
+ if ((dx*dx + dy*dy) < 4)
{
WFIFOW(0) = net_w_value(0x009f);
WFIFOL(2) = net_l_value(floorItemId);
@@ -675,60 +685,60 @@ void do_input()
int y = player_node->y;
int xDirection = 0;
int yDirection = 0;
- int Direction = DIR_NONE;
+ Being::Direction Direction = Being::DIR_NONE;
// Translate pressed keys to movement and direction
if (keys[SDLK_UP] || keys[SDLK_KP8] || joy[JOY_UP])
{
yDirection = -1;
if (player_node->action != Being::WALK)
- Direction = NORTH;
+ Direction = Being::NORTH;
}
if (keys[SDLK_DOWN] || keys[SDLK_KP2] || joy[JOY_DOWN])
{
yDirection = 1;
if (player_node->action != Being::WALK)
- Direction = SOUTH;
+ Direction = Being::SOUTH;
}
if (keys[SDLK_LEFT] || keys[SDLK_KP4] || joy[JOY_LEFT])
{
xDirection = -1;
if (player_node->action != Being::WALK)
- Direction = WEST;
+ Direction = Being::WEST;
}
if (keys[SDLK_RIGHT] || keys[SDLK_KP6] || joy[JOY_RIGHT])
{
xDirection = 1;
if (player_node->action != Being::WALK)
- Direction = EAST;
+ Direction = Being::EAST;
}
if (keys[SDLK_KP1]) // Bottom Left
{
xDirection = -1;
yDirection = 1;
if (player_node->action != Being::WALK)
- Direction = SW;
+ Direction = Being::SW;
}
if (keys[SDLK_KP3]) // Bottom Right
{
xDirection = 1;
yDirection = 1;
if (player_node->action != Being::WALK)
- Direction = SE;
+ Direction = Being::SE;
}
if (keys[SDLK_KP7]) // Top Left
{
xDirection = -1;
yDirection = -1;
if (player_node->action != Being::WALK)
- Direction = NW;
+ Direction = Being::NW;
}
if (keys[SDLK_KP9]) // Top Right
{
xDirection = 1;
yDirection = -1;
if (player_node->action != Being::WALK)
- Direction = NE;
+ Direction = Being::NE;
}
Map *tiledMap = engine->getCurrentMap();
@@ -757,7 +767,7 @@ void do_input()
walk(x + xDirection, y + yDirection, Direction);
player_node->setDestination(x + xDirection, y + yDirection);
}
- else if (Direction != DIR_NONE)
+ else if (Direction != Being::DIR_NONE)
{
// Update the player direction to where he wants to walk
// Warning: Not communicated to the server yet
diff --git a/src/game.h b/src/game.h
index a3941c89..0be487e0 100644
--- a/src/game.h
+++ b/src/game.h
@@ -30,16 +30,6 @@
#define LOCK 254
#define IDLE 255
-#define DIR_NONE -1
-#define SOUTH 0
-#define SW 1
-#define WEST 2
-#define NW 3
-#define NORTH 4
-#define NE 5
-#define EAST 6
-#define SE 7
-
extern char map_path[480];
extern char tradePartnerName[24];
extern int fps, frame, current_npc;
diff --git a/src/graphic/imagerect.h b/src/graphic/imagerect.h
new file mode 100644
index 00000000..be63d4ac
--- /dev/null
+++ b/src/graphic/imagerect.h
@@ -0,0 +1,50 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef _TMW_IMAGERECT_H
+#define _TMW_IMAGERECT_H
+
+class Image;
+
+/**
+ * 9 images defining a rectangle. 4 corners, 4 sides and a middle area. The
+ * topology is as follows:
+ *
+ * <pre>
+ * !-----!-----------------!-----!
+ * ! 0 ! 1 ! 2 !
+ * !-----!-----------------!-----!
+ * ! 3 ! 4 ! 5 !
+ * !-----!-----------------!-----!
+ * ! 6 ! 7 ! 8 !
+ * !-----!-----------------!-----!
+ * </pre>
+ *
+ * Sections 0, 2, 6 and 8 will remain as is. 1, 3, 4, 5 and 7 will be
+ * repeated to fit the size of the widget.
+ */
+struct ImageRect {
+ Image *grid[9];
+};
+
+#endif
diff --git a/src/graphic/spriteset.cpp b/src/graphic/spriteset.cpp
index 31e84e9d..e0a1ef36 100644
--- a/src/graphic/spriteset.cpp
+++ b/src/graphic/spriteset.cpp
@@ -23,6 +23,8 @@
#include "spriteset.h"
+#include "../resources/image.h"
+
Spriteset::Spriteset(Image *img, int width, int height)
{
int x, y;
diff --git a/src/graphic/spriteset.h b/src/graphic/spriteset.h
index 6132330d..2f4e50ca 100644
--- a/src/graphic/spriteset.h
+++ b/src/graphic/spriteset.h
@@ -25,7 +25,9 @@
#define _TMW_SPRITESET_H
#include <vector>
-#include "../resources/image.h"
+
+class Image;
+
/**
* Stores a complete set of sprites.
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 21797f55..5c7e01b3 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -22,9 +22,15 @@
*/
#include "graphics.h"
-#include "resources/resourcemanager.h"
-#include "main.h"
+
+#include <guichan/imagefont.hpp>
+
#include "log.h"
+#include "main.h"
+
+#include "graphic/imagerect.h"
+
+#include "resources/image.h"
extern volatile int framesToDraw;
diff --git a/src/graphics.h b/src/graphics.h
index 4e2b6c7e..46dfef89 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -24,36 +24,17 @@
#ifndef _GRAPHICS_H
#define _GRAPHICS_H
-#include <guichan/sdl.hpp>
-#include <SDL.h>
+#include <guichan/sdl/sdlgraphics.hpp>
#ifdef USE_OPENGL
-#include <guichan/opengl.hpp>
-#include <SDL_opengl.h>
+#include <guichan/opengl/openglgraphics.hpp>
#endif
-#include <guichan/imagefont.hpp>
-#include <guichan/rectangle.hpp>
-#include "resources/image.h"
-/**
- * 9 images defining a rectangle. 4 corners, 4 sides and a middle area. The
- * topology is as follows:
- *
- * <pre>
- * !-----!-----------------!-----!
- * ! 0 ! 1 ! 2 !
- * !-----!-----------------!-----!
- * ! 3 ! 4 ! 5 !
- * !-----!-----------------!-----!
- * ! 6 ! 7 ! 8 !
- * !-----!-----------------!-----!
- * </pre>
- *
- * Sections 0, 2, 6 and 8 will remain as is. 1, 3, 4, 5 and 7 will be
- * repeated to fit the size of the widget.
- */
-struct ImageRect {
- Image *grid[9];
-};
+#include "guichanfwd.h"
+
+class Image;
+class ImageRect;
+
+class SDL_Surface;
/**
* A central point of control for graphics.
diff --git a/src/gui/box.h b/src/gui/box.h
index d65a6ac3..dccbfc78 100644
--- a/src/gui/box.h
+++ b/src/gui/box.h
@@ -25,7 +25,9 @@
#ifndef BOX_H
#define BOX_H
-#include <guichan.hpp>
+#include <guichan/widgets/container.hpp>
+
+#include "../guichanfwd.h"
class Box : public gcn::Container
{
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 504fb987..e00494cd 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -21,11 +21,14 @@
* $Id$
*/
-#include <guichan.hpp>
-#include "../graphics.h"
+#include <guichan/imagefont.hpp>
+
#include "../main.h"
+#ifdef USE_OPENGL
#include "../resources/resourcemanager.h"
+#endif
#include "browserbox.h"
+#include "linkhandler.h"
#include "gui.h"
int BrowserBox::instances = 0;
@@ -44,6 +47,7 @@ BrowserBox::BrowserBox(unsigned int mode):
if (instances == 0)
{
+#ifdef USE_OPENGL
if (useOpenGL) {
browserFont = new gcn::ImageFont(
ResourceManager::getInstance()->getRealPath(
@@ -51,8 +55,9 @@ BrowserBox::BrowserBox(unsigned int mode):
" abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567"
"89:@!\"$%&/=?^+*#[]{}()<>_;'.,\\|-~`");
- }
- else {
+ } else
+#endif
+ {
browserFont = gui->getFont();
}
}
diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h
index d9c88b14..3a829381 100644
--- a/src/gui/browserbox.h
+++ b/src/gui/browserbox.h
@@ -24,8 +24,15 @@
#ifndef __TMW_BROWSERBOX_H__
#define __TMW_BROWSERBOX_H__
-#include <guichan.hpp>
-#include "linkhandler.h"
+#include <iosfwd>
+#include <vector>
+
+#include <guichan/widget.hpp>
+#include <guichan/mouselistener.hpp>
+
+#include "../guichanfwd.h"
+
+class LinkHandler;
struct BROWSER_LINK {
int x1, x2, y1, y2; /**< Where link is placed */
diff --git a/src/gui/buddywindow.h b/src/gui/buddywindow.h
index 02f0bd77..4468f74e 100644
--- a/src/gui/buddywindow.h
+++ b/src/gui/buddywindow.h
@@ -24,8 +24,12 @@
#ifndef _TMW_BUDDYWINDOW_H
#define _TMW_BUDDYWINDOW_H
-#include <guichan.hpp>
+#include <guichan/widgets/button.hpp>
+#include <guichan/widgets/listbox.hpp>
+#include <guichan/widgets/scrollarea.hpp>
+
#include "window.h"
+
#include "../resources/buddylist.h"
/**
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index 0fe207c7..680a9152 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -22,6 +22,16 @@
*/
#include "button.h"
+
+#include <guichan/exception.hpp>
+#include <guichan/graphics.hpp>
+#include <guichan/imagefont.hpp>
+
+#include "../graphics.h"
+
+#include "../graphic/imagerect.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
ImageRect Button::button[4];
diff --git a/src/gui/button.h b/src/gui/button.h
index c3be49f2..8873358d 100644
--- a/src/gui/button.h
+++ b/src/gui/button.h
@@ -24,9 +24,11 @@
#ifndef _TMW_BUTTON_H
#define _TMW_BUTTON_H
-#include <guichan.hpp>
-#include <string>
-#include "../graphics.h"
+#include <iosfwd>
+
+#include <guichan/widgets/button.hpp>
+
+class ImageRect;
/**
* Button widget. Same as the Guichan button but with custom look.
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index ecb1343e..9d7cd7b2 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -22,16 +22,25 @@
*/
#include "buy.h"
+
+#include <assert.h>
+#include <sstream>
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
-#include "slider.h"
-#include "scrollarea.h"
#include "listbox.h"
-#include "../resources/itemmanager.h"
+#include "scrollarea.h"
+#include "shop.h"
+#include "slider.h"
+
#include "../game.h"
+
+#include "../resources/iteminfo.h"
+#include "../resources/itemmanager.h"
+
#include "../net/network.h"
-#include <sstream>
-#include <assert.h>
BuyDialog::BuyDialog():
Window("Buy"),
diff --git a/src/gui/buy.h b/src/gui/buy.h
index 50c92acd..92221a45 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -24,10 +24,16 @@
#ifndef _TMW_BUY_H
#define _TMW_BUY_H
+#include <vector>
+
+#include <guichan/actionlistener.hpp>
+#include <guichan/listmodel.hpp>
+
#include "window.h"
-#include "shop.h"
-#include <vector>
+#include "../guichanfwd.h"
+
+struct ITEM_SHOP;
/**
* The buy dialog.
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index dcba4ac0..4ff4f768 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -24,6 +24,8 @@
#ifndef _TMW_BUYSELL_H
#define _TMW_BUYSELL_H
+#include <guichan/widgets/button.hpp>
+
#include "window.h"
/**
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index c2bba9bc..245d11c7 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -22,14 +22,27 @@
*/
#include "char_select.h"
-#include "textfield.h"
+
+#include <sstream>
+
+#include <guichan/sdl/sdlinput.hpp>
+
#include "button.h"
+#include "gui.h"
#include "ok_dialog.h"
-#include "../main.h"
+#include "playerbox.h"
+#include "textfield.h"
+#include "windowcontainer.h"
+
+#include "../being.h"
#include "../game.h"
+#include "../graphics.h"
#include "../log.h"
+#include "../main.h"
+#include "../playerinfo.h"
+
+#include "../net/network.h"
#include "../net/protocol.h"
-#include <sstream>
CharSelectDialog::CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m):
ConfirmDialog(m,
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 5cdb0712..b229a04c 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -24,11 +24,13 @@
#ifndef _CHAR_SELECT_H
#define _CHAR_SELECT_H
-#include "../playerinfo.h"
-#include "../net/network.h"
-#include "gui.h"
#include "confirm_dialog.h"
-#include "playerbox.h"
+#include "window.h"
+
+#include "../guichanfwd.h"
+
+class PlayerBox;
+struct PLAYER_INFO;
/**
* Character selection dialog.
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 01b39135..2f86590e 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -22,16 +22,23 @@
*/
#include "char_server.h"
+
+#include <guichan/sdl/sdlinput.hpp>
+
#include "button.h"
-#include "scrollarea.h"
+#include "gui.h"
#include "listbox.h"
#include "ok_dialog.h"
+#include "scrollarea.h"
+
+#include "../graphics.h"
#include "../log.h"
#include "../main.h"
#include "../playerinfo.h"
#include "../serverinfo.h"
+
#include "../net/network.h"
-#include "gui.h"
+
char server[30];
int showServerList = 1;
diff --git a/src/gui/char_server.h b/src/gui/char_server.h
index bd41a479..2457634d 100644
--- a/src/gui/char_server.h
+++ b/src/gui/char_server.h
@@ -24,8 +24,12 @@
#ifndef _CHAR_SEL_SERVER_H
#define _CHAR_SEL_SERVER_H
+#include <guichan/listmodel.hpp>
+
#include "window.h"
+#include "../guichanfwd.h"
+
/**
* The list model for the server list.
diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp
index 25f4297e..5a475d72 100644
--- a/src/gui/chargedialog.cpp
+++ b/src/gui/chargedialog.cpp
@@ -25,11 +25,14 @@
*/
#include "chargedialog.h"
+
+#include "progressbar.h"
+
#include "../playerinfo.h"
ChargeDialog::ChargeDialog():
Window("")
-{
+{
setContentSize(180,70);
progBar = new ProgressBar(0.0f,20,40,140,25,128,128,128);
add(progBar);
diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h
index 92eb1dd4..de1169b0 100644
--- a/src/gui/chargedialog.h
+++ b/src/gui/chargedialog.h
@@ -23,10 +23,10 @@
#ifndef _TMW_CHARGE_H
#define _TMW_CHARGE_H
-#include <guichan.hpp>
#include "window.h"
-#include "progressbar.h"
-
+
+class ProgressBar;
+
#define CHARGE_TIME 1000 // time in milliseconds it takes to charge up an attack
/**
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 1a7eca65..16a1b662 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -22,14 +22,15 @@
*/
#include "chat.h"
-#include "textfield.h"
-#include "textbox.h"
+
+#include "browserbox.h"
#include "chatinput.h"
#include "gui.h"
+#include "scrollarea.h"
+
#include "../playerinfo.h"
+
#include "../net/network.h"
-#include <iostream>
-#include <guichan.hpp>
ChatWindow::ChatWindow(const std::string &logfile):
Window("")
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 34e9c027..248aabc6 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -24,15 +24,16 @@
#ifndef _TMW_CHAT_H
#define _TMW_CHAT_H
-#include <guichan.hpp>
-#include <guichan/key.hpp>
-#include "window.h"
-#include "scrollarea.h"
-#include "browserbox.h"
-#include <SDL.h>
+#include <fstream>
#include <list>
#include <string>
-#include <fstream>
+
+#include "window.h"
+
+#include "../guichanfwd.h"
+
+class BrowserBox;
+class ScrollArea;
#define BY_GM 0 // those should be self-explanatory =)
#define BY_PLAYER 1
diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp
index 028b7151..52e91f3a 100644
--- a/src/gui/chatinput.cpp
+++ b/src/gui/chatinput.cpp
@@ -22,7 +22,6 @@
*/
#include "chatinput.h"
-#include "../graphics.h"
ChatInput::ChatInput()
{
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp
index 052957ec..ce7762d9 100644
--- a/src/gui/checkbox.cpp
+++ b/src/gui/checkbox.cpp
@@ -22,9 +22,11 @@
*/
#include "checkbox.h"
+
#include "../graphics.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
-#include <guichan.hpp>
int CheckBox::instances = 0;
Image *CheckBox::checkBoxNormal;
diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h
index 947e6432..468a7f38 100644
--- a/src/gui/checkbox.h
+++ b/src/gui/checkbox.h
@@ -24,9 +24,11 @@
#ifndef _TMW_CHECKBOX_H
#define _TMW_CHECKBOX_H
-#include <guichan.hpp>
-#include <string>
-#include "../resources/image.h"
+#include <iosfwd>
+
+#include <guichan/widgets/checkbox.hpp>
+
+class Image;
/**
* Check box widget. Same as the Guichan check box but with custom look.
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp
index 61c4b009..75553f58 100644
--- a/src/gui/confirm_dialog.cpp
+++ b/src/gui/confirm_dialog.cpp
@@ -22,7 +22,12 @@
*/
#include "confirm_dialog.h"
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
+#include "windowcontainer.h"
+
ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
gcn::ActionListener *listener):
diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h
index 3e24b0e2..cec13cc5 100644
--- a/src/gui/confirm_dialog.h
+++ b/src/gui/confirm_dialog.h
@@ -26,6 +26,9 @@
#include "window.h"
+#include "../guichanfwd.h"
+
+
/**
* An option dialog.
*
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 8410750c..0aeb58e4 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -21,12 +21,18 @@
* $Id$
*/
-#include <guichan.hpp>
#include "equipmentwindow.h"
+
#include "../equipment.h"
+#include "../graphics.h"
+#include "../item.h"
#include "../log.h"
-#include "../resources/resourcemanager.h"
+
+#include "../graphic/spriteset.h"
+
#include "../resources/image.h"
+#include "../resources/iteminfo.h"
+#include "../resources/resourcemanager.h"
#include <sstream>
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index 2767a558..66ee420f 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -24,9 +24,10 @@
#ifndef _TMW_EQUIPMENT_H
#define _TMW_EQUIPMENT_H
-#include "../graphic/spriteset.h"
#include "window.h"
+class Spriteset;
+
/**
* Equipment dialog.
*
diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h
index 39eda8bb..82476d17 100644
--- a/src/gui/focushandler.h
+++ b/src/gui/focushandler.h
@@ -24,7 +24,7 @@
#ifndef _TMW_FOCUSHANDLER_H
#define _TMW_FOCUSHANDLER_H
-#include <guichan.hpp>
+#include <guichan/focushandler.hpp>
/**
* The focus handler. This focus handler does exactly the same as the Guichan
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index bd6a9ba4..95cd85d7 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -22,14 +22,33 @@
*/
#include "gui.h"
+
+#include <guichan/exception.hpp>
+#include <guichan/imagefont.hpp>
+
+#ifdef USE_OPENGL
+#include <guichan/opengl/openglimageloader.hpp>
+#endif
+
+#include <guichan/sdl/sdlimageloader.hpp>
+#include <guichan/sdl/sdlinput.hpp>
+
+#include "focushandler.h"
#include "window.h"
#include "windowcontainer.h"
-#include "focushandler.h"
-#include "../net/protocol.h"
-#include "../main.h"
+
+#include "../being.h"
+#include "../configuration.h"
#include "../engine.h"
#include "../game.h"
+#include "../graphics.h"
#include "../log.h"
+#include "../main.h"
+#include "../map.h"
+
+#include "../net/protocol.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
extern Being* autoTarget;
@@ -52,35 +71,30 @@ Gui::Gui(Graphics *graphics):
mMouseCursor(NULL),
mCustomCursor(false)
{
- // Set graphics
guiGraphics = graphics;
//setGraphics(graphics);
- if (useOpenGL) {
#ifdef USE_OPENGL
+ if (useOpenGL) {
+ // Set graphics
setGraphics((gcn::OpenGLGraphics*)graphics);
+
+ // Set image loader
+ mHostImageLoader = new gcn::SDLImageLoader();
+ mImageLoader = new gcn::OpenGLImageLoader(mHostImageLoader);
+ } else
#endif
- }
- else {
+ {
+ // Set graphics
setGraphics((gcn::SDLGraphics*)graphics);
+
+ // Set image loader
+ mImageLoader = new gcn::SDLImageLoader();
}
// Set input
guiInput = new gcn::SDLInput();
setInput(guiInput);
- // Set image loader
-#ifdef USE_OPENGL
- if (useOpenGL) {
- mHostImageLoader = new gcn::SDLImageLoader();
- mImageLoader = new gcn::OpenGLImageLoader(mHostImageLoader);
- }
- else {
- mImageLoader = new gcn::SDLImageLoader();
- }
-#else
- mImageLoader = new gcn::SDLImageLoader();
-#endif
-
gcn::Image::setImageLoader(mImageLoader);
// Set focus handler
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 02ea7caa..1075910e 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -24,11 +24,14 @@
#ifndef _TMW_GUI
#define _TMW_GUI
-#include <guichan.hpp>
-#include <guichan/sdl.hpp>
-#include "windowcontainer.h"
-#include "../graphics.h"
-#include "../configuration.h"
+#include <guichan/gui.hpp>
+
+#include "../configlistener.h"
+#include "../guichanfwd.h"
+
+class Graphics;
+class Image;
+class WindowContainer;
/**
* \defgroup GUI Core GUI related classes (widgets)
diff --git a/src/gui/help.cpp b/src/gui/help.cpp
index 3ff8f0f4..29a2d24b 100644
--- a/src/gui/help.cpp
+++ b/src/gui/help.cpp
@@ -22,10 +22,14 @@
*/
#include "help.h"
-#include "scrollarea.h"
+
#include "button.h"
+#include "browserbox.h"
+#include "scrollarea.h"
#include "textbox.h"
+
#include "../log.h"
+
#include "../resources/resourcemanager.h"
HelpWindow::HelpWindow():
diff --git a/src/gui/help.h b/src/gui/help.h
index 21e27c34..d2bada56 100644
--- a/src/gui/help.h
+++ b/src/gui/help.h
@@ -24,10 +24,12 @@
#ifndef _TMW_HELP_H
#define _TMW_HELP_H
-#include <guichan.hpp>
#include "window.h"
#include "linkhandler.h"
-#include "browserbox.h"
+
+#include "../guichanfwd.h"
+
+class BrowserBox;
/**
* The help dialog.
diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp
index 16650799..781fb580 100644
--- a/src/gui/inttextbox.cpp
+++ b/src/gui/inttextbox.cpp
@@ -23,6 +23,8 @@
#include "inttextbox.h"
+#include <sstream>
+
IntTextBox::IntTextBox():
value(0)
{
diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h
index c9eec49e..e3517c62 100644
--- a/src/gui/inttextbox.h
+++ b/src/gui/inttextbox.h
@@ -24,9 +24,6 @@
#ifndef INTTEXTBOX_H
#define INTTEXTBOX_H
-#include <iostream>
-#include <sstream>
-#include <guichan.hpp>
#include "textbox.h"
/**
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 28dbd35e..81b4b7b6 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -22,13 +22,20 @@
*/
#include "inventorywindow.h"
-#include "popupmenu.h"
-#include "../playerinfo.h"
-#include "../inventory.h"
+
+#include <string>
+
#include "button.h"
-#include "scrollarea.h"
#include "item_amount.h"
-#include <string>
+#include "itemcontainer.h"
+#include "popupmenu.h"
+#include "scrollarea.h"
+
+#include "../inventory.h"
+#include "../item.h"
+#include "../playerinfo.h"
+
+#include "resources/iteminfo.h"
InventoryWindow::InventoryWindow():
Window("Inventory")
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index cb7f08f5..7d86d1aa 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -24,9 +24,13 @@
#ifndef _TMW_INVENTORYWINDOW_H
#define _TMW_INVENTORYWINDOW_H
-#include "itemcontainer.h"
#include "window.h"
+#include "../guichanfwd.h"
+
+class Item;
+class ItemContainer;
+
/**
* Inventory dialog.
*
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index e67992ea..a6ca9437 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -22,10 +22,15 @@
*/
#include "item_amount.h"
-#include "inventorywindow.h"
-#include "trade.h"
+
#include "button.h"
+#include "inttextbox.h"
+#include "inventorywindow.h"
#include "slider.h"
+#include "trade.h"
+
+#include "../inventory.h"
+#include "../item.h"
ItemAmountWindow::ItemAmountWindow(int usage, Window *parent):
Window("Select amount of items to drop.", true, parent)
diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h
index add2a66c..5e485b6e 100644
--- a/src/gui/item_amount.h
+++ b/src/gui/item_amount.h
@@ -24,10 +24,13 @@
#ifndef _TMW_ITEM_AMOUNT_WINDOW_H
#define _TMW_ITEM_AMOUNT_WINDOW_H
+#include <iosfwd>
+
#include "window.h"
-#include "inttextbox.h"
-#include <string>
-#include <sstream>
+
+#include "../guichanfwd.h"
+
+class IntTextBox;
#define AMOUNT_TRADE_ADD 1
#define AMOUNT_ITEM_DROP 2
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index a4e7a7d0..e2eb6085 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -22,11 +22,19 @@
*/
#include "itemcontainer.h"
-#include "../main.h"
-#include "../log.h"
+
+#include <sstream>
+
#include "../graphics.h"
+#include "../inventory.h"
+#include "../item.h"
+#include "../log.h"
+
+#include "../graphic/spriteset.h"
+
+#include "../resources/image.h"
+#include "../resources/iteminfo.h"
#include "../resources/resourcemanager.h"
-#include <sstream>
ItemContainer::ItemContainer(Inventory *inventory):
inventory(inventory)
diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h
index 6c1834ef..9cd92812 100644
--- a/src/gui/itemcontainer.h
+++ b/src/gui/itemcontainer.h
@@ -24,13 +24,13 @@
#ifndef _TMW_ITEMCONTAINER_H__
#define _TMW_ITEMCONTAINER_H__
-#include <iostream>
-#include <guichan.hpp>
+#include <guichan/mouselistener.hpp>
+#include <guichan/widget.hpp>
-#include "../item.h"
-#include "../inventory.h"
-#include "../resources/image.h"
-#include "../graphic/spriteset.h"
+class Image;
+class Inventory;
+class Item;
+class Spriteset;
/**
* An item container. Used to show items in inventory and trade dialog.
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 0dd9203c..1e266fb8 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -22,8 +22,6 @@
*/
#include "listbox.h"
-#include "../graphics.h"
-#include "../main.h"
ListBox::ListBox():
gcn::ListBox()
diff --git a/src/gui/listbox.h b/src/gui/listbox.h
index 2238bffb..23b81a57 100644
--- a/src/gui/listbox.h
+++ b/src/gui/listbox.h
@@ -24,7 +24,7 @@
#ifndef __TMW_LISTBOX_H__
#define __TMW_LISTBOX_H__
-#include <guichan.hpp>
+#include <guichan/widgets/listbox.hpp>
/**
* A list box, meant to be used inside a scroll area. Same as the Guichan list
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 38bcf6b3..09e9c925 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -22,17 +22,27 @@
*/
#include "login.h"
+
+#include <string>
+
+#include <guichan/sdl/sdlinput.hpp>
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
#include "checkbox.h"
-#include "textfield.h"
-#include "passwordfield.h"
-#include "ok_dialog.h"
#include "gui.h"
+#include "ok_dialog.h"
+#include "passwordfield.h"
+#include "textfield.h"
+
+#include "../configuration.h"
+#include "../graphics.h"
+#include "../log.h"
#include "../main.h"
#include "../serverinfo.h"
-#include "../log.h"
+
#include "../net/network.h"
-#include <string>
LoginDialog::LoginDialog():
Window("Login")
diff --git a/src/gui/login.h b/src/gui/login.h
index dba74856..1ddb927f 100644
--- a/src/gui/login.h
+++ b/src/gui/login.h
@@ -24,10 +24,14 @@
#ifndef _TMW_LOGIN_H
#define _TMW_LOGIN_H
-#include <guichan.hpp>
-#include <string>
+#include <iosfwd>
+
+#include <guichan/actionlistener.hpp>
+
#include "window.h"
+#include "../guichanfwd.h"
+
/**
* The login dialog.
*
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index b4ef3491..7b2367c0 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -22,8 +22,12 @@
*/
#include "minimap.h"
+
#include "../being.h"
-#include "../main.h"
+#include "../graphics.h"
+#include "../map.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
Minimap::Minimap():
diff --git a/src/gui/minimap.h b/src/gui/minimap.h
index 20063d15..aa9649f6 100644
--- a/src/gui/minimap.h
+++ b/src/gui/minimap.h
@@ -25,8 +25,9 @@
#define _TMW_MINIMAP_H
#include "window.h"
-#include "../map.h"
-#include "../resources/image.h"
+
+class Map;
+class Image;
/**
* Minimap dialog.
diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp
index 800c4a28..12c87b36 100644
--- a/src/gui/newskill.cpp
+++ b/src/gui/newskill.cpp
@@ -26,7 +26,13 @@
*/
#include "newskill.h"
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
+#include "progressbar.h"
+
+#include "../graphics.h"
char *skill_name[] = {
// 0-99
diff --git a/src/gui/newskill.h b/src/gui/newskill.h
index db15958b..cdd82ad2 100644
--- a/src/gui/newskill.h
+++ b/src/gui/newskill.h
@@ -24,10 +24,12 @@
#ifndef _TMW_NSKILL_H
#define _TMW_NSKILL_H
-#include <guichan.hpp>
#include "window.h"
-#include "progressbar.h"
-
+
+#include "../guichanfwd.h"
+
+class ProgressBar;
+
#define N_SKILL 100 // skill count constant
#define N_SKILL_CAT 9 // skill category count
#define N_SKILL_CAT_SIZE 10 // skill category maximum size
diff --git a/src/gui/npc.h b/src/gui/npc.h
index afe56805..8b694341 100644
--- a/src/gui/npc.h
+++ b/src/gui/npc.h
@@ -24,11 +24,16 @@
#ifndef _TMW_NPC_H
#define _TMW_NPC_H
-#include <guichan.hpp>
+#include <iosfwd>
#include <vector>
-#include <string>
+
+#include <guichan/actionlistener.hpp>
+#include <guichan/listmodel.hpp>
+
#include "window.h"
+#include "../guichanfwd.h"
+
/**
* The npc list dialog.
*
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index e3f16293..2930a00a 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -24,11 +24,12 @@
#ifndef _TMW_NPC_TEXT_H
#define _TMW_NPC_TEXT_H
-#include <guichan.hpp>
-#include <vector>
-#include <string>
+#include <iosfwd>
+
#include "window.h"
+#include "../guichanfwd.h"
+
/**
* The npc text dialog.
*
diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp
index 8b7ef6d4..fd0408ac 100644
--- a/src/gui/ok_dialog.cpp
+++ b/src/gui/ok_dialog.cpp
@@ -22,7 +22,11 @@
*/
#include "ok_dialog.h"
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
+#include "windowcontainer.h"
OkDialog::OkDialog(const std::string &title, const std::string &msg,
gcn::ActionListener *listener):
diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h
index 1287bc7f..1db3dd4e 100644
--- a/src/gui/ok_dialog.h
+++ b/src/gui/ok_dialog.h
@@ -26,6 +26,8 @@
#include "window.h"
+#include "../guichanfwd.h"
+
/**
* An 'Ok' button dialog.
*
diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h
index 05643f2f..15ca85c9 100644
--- a/src/gui/passwordfield.h
+++ b/src/gui/passwordfield.h
@@ -24,7 +24,6 @@
#ifndef __PASSWORDFIELD_H__
#define __PASSWORDFIELD_H__
-#include <guichan.hpp>
#include "textfield.h"
/**
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 3b23f3f2..169c37fc 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -22,10 +22,18 @@
*/
#include "playerbox.h"
-#include "../main.h"
+
#include "../being.h"
+#include "../graphics.h"
+
+#include "../graphic/imagerect.h"
+#include "../graphic/spriteset.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
+extern Spriteset *hairset, *playerset;
+
int PlayerBox::instances = 0;
ImageRect PlayerBox::background;
diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h
index 39fa39b4..0f1a653f 100644
--- a/src/gui/playerbox.h
+++ b/src/gui/playerbox.h
@@ -24,8 +24,9 @@
#ifndef __TMW_PLAYERBOX_H__
#define __TMW_PLAYERBOX_H__
-#include <guichan.hpp>
-#include "../graphics.h"
+#include <guichan/widgets/scrollarea.hpp>
+
+class ImageRect;
/**
* A box showing a player. Draws the various hair styles a player can have
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index bd178ce1..17ca9edb 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -21,18 +21,29 @@
* $Id$
*/
+#include "popupmenu.h"
+
#include <assert.h>
+#include <iostream>
-#include "popupmenu.h"
+#include <guichan/focushandler.hpp>
+
+#include "browserbox.h"
#include "gui.h"
#include "inventorywindow.h"
#include "item_amount.h"
-#include "../graphics.h"
+
+#include "../being.h"
+#include "../floor_item.h"
#include "../game.h"
+#include "../graphics.h"
+#include "../inventory.h"
+#include "../item.h"
+
#include "../net/network.h"
+
+#include "../resources/iteminfo.h"
#include "../resources/itemmanager.h"
-#include "../item.h"
-#include "../inventory.h"
PopupMenu::PopupMenu():
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index f1bebabc..0ba9f485 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -24,13 +24,14 @@
#ifndef _TMW_POPUP_MENU_H
#define _TMW_POPUP_MENU_H
-#include <guichan.hpp>
#include "window.h"
#include "linkhandler.h"
-#include "browserbox.h"
-#include "../being.h"
-#include "../item.h"
-#include "../floor_item.h"
+
+class Being;
+class BrowserBox;
+class FloorItem;
+class Item;
+
/**
* Window showing popup menu.
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 505262b6..26933e22 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -22,8 +22,12 @@
*/
#include "progressbar.h"
+
#include "../graphics.h"
-#include "../main.h"
+
+#include "../graphic/imagerect.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
ImageRect ProgressBar::mBorder;
diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h
index 9b0a1041..fe9e7085 100644
--- a/src/gui/progressbar.h
+++ b/src/gui/progressbar.h
@@ -24,9 +24,10 @@
#ifndef _TMW_PROGRESSBAR_H
#define _TMW_PROGRESSBAR_H
-#include <guichan.hpp>
-#include "../graphics.h"
-#include "../resources/image.h"
+#include <guichan/widget.hpp>
+
+class ImageRect;
+
/**
* A progress bar.
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index 7eae469f..d3358604 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -22,7 +22,10 @@
*/
#include "radiobutton.h"
+
#include "../graphics.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
int RadioButton::instances = 0;
diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h
index 2249059d..4f868fdb 100644
--- a/src/gui/radiobutton.h
+++ b/src/gui/radiobutton.h
@@ -24,8 +24,10 @@
#ifndef _TMW_RADIOBUTTON_H
#define _TMW_RADIOBUTTON_H
-#include <guichan.hpp>
-#include "../resources/image.h"
+#include <guichan/widgets/radiobutton.hpp>
+
+class Image;
+
/*
* Guichan based RadioButton with custom look
diff --git a/src/gui/requesttrade.cpp b/src/gui/requesttrade.cpp
index 4d9fe919..35654562 100644
--- a/src/gui/requesttrade.cpp
+++ b/src/gui/requesttrade.cpp
@@ -22,7 +22,13 @@
*/
#include "requesttrade.h"
+
+#include <sstream>
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
+
#include "../net/network.h"
bool requestTradeDialogOpen = false;
diff --git a/src/gui/requesttrade.h b/src/gui/requesttrade.h
index 3ec36f6a..b6783331 100644
--- a/src/gui/requesttrade.h
+++ b/src/gui/requesttrade.h
@@ -24,12 +24,12 @@
#ifndef _TMW_REQUESTTRADE_H
#define _TMW_REQUESTTRADE_H
-#include <guichan.hpp>
-#include <vector>
-#include <string>
-#include <sstream>
+#include <iosfwd>
+
#include "window.h"
+#include "../guichanfwd.h"
+
extern bool requestTradeDialogOpen;
/**
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index 05fb49ce..6bc428e2 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -22,7 +22,12 @@
*/
#include "scrollarea.h"
-#include "../main.h"
+
+#include "../graphics.h"
+
+#include "../graphic/imagerect.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
int ScrollArea::instances = 0;
diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h
index 54f41690..f2e00466 100644
--- a/src/gui/scrollarea.h
+++ b/src/gui/scrollarea.h
@@ -24,8 +24,10 @@
#ifndef __TMW_SCROLLAREA_H__
#define __TMW_SCROLLAREA_H__
-#include <guichan.hpp>
-#include "../graphics.h"
+#include <guichan/widgets/scrollarea.hpp>
+
+class Image;
+class ImageRect;
/**
* A scroll area.
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index ed7658f2..920d90f6 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -22,16 +22,26 @@
*/
#include "sell.h"
+
+#include <assert.h>
+#include <sstream>
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
-#include "slider.h"
-#include "scrollarea.h"
#include "listbox.h"
+#include "scrollarea.h"
+#include "shop.h"
+#include "slider.h"
+
#include "../game.h"
#include "../inventory.h"
+#include "../item.h"
+
+#include "../resources/iteminfo.h"
+
#include "../net/network.h"
-#include <sstream>
-#include <assert.h>
SellDialog::SellDialog():
Window("Sell")
diff --git a/src/gui/sell.h b/src/gui/sell.h
index e96eb712..9d1325a0 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -24,10 +24,17 @@
#ifndef _TMW_SELL_H
#define _TMW_SELL_H
+#include <vector>
+
+#include <guichan/actionlistener.hpp>
+#include <guichan/listmodel.hpp>
+
#include "window.h"
-#include "shop.h"
-#include <vector>
+#include "../guichanfwd.h"
+
+struct ITEM_SHOP;
+
/**
* The sell dialog.
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index ad38bae3..fa58d03b 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -22,16 +22,25 @@
*/
#include "setup.h"
-#include "gui.h"
+
+#include <iostream>
+#include <sstream>
+
+#include <guichan/widgets/label.hpp>
+
#include "button.h"
#include "checkbox.h"
-#include "scrollarea.h"
+#include "gui.h"
#include "listbox.h"
-#include "slider.h"
#include "ok_dialog.h"
+#include "scrollarea.h"
+#include "slider.h"
+
+#include "../configuration.h"
+#include "../graphics.h"
#include "../log.h"
#include "../main.h"
-#include <sstream>
+#include "../sound.h"
#define SETUP_WIDTH 240
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 70491957..cfe709dc 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -24,8 +24,14 @@
#ifndef _TMW_SETUP_H
#define _TMW_SETUP_H
+#include <vector>
+
+#include <guichan/listmodel.hpp>
+
#include "window.h"
+#include "../guichanfwd.h"
+
/**
* The list model for mode list.
*
@@ -104,7 +110,6 @@ class Setup : public Window, public gcn::ActionListener
*/
void
action(const std::string& eventId);
-
};
extern Setup *setupWindow;
diff --git a/src/gui/skill.h b/src/gui/skill.h
index 7bff96cf..ffbea16f 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -24,7 +24,13 @@
#ifndef _TMW_SKILL_H
#define _TMW_SKILL_H
-#include <guichan.hpp>
+#include <vector>
+
+#include <guichan/widgets/button.hpp>
+#include <guichan/widgets/label.hpp>
+#include <guichan/widgets/listbox.hpp>
+#include <guichan/widgets/scrollarea.hpp>
+
#include "window.h"
struct SKILL {
diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp
index 2d4e6c78..088b2794 100644
--- a/src/gui/slider.cpp
+++ b/src/gui/slider.cpp
@@ -22,7 +22,10 @@
*/
#include "slider.h"
+
#include "../graphics.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
Image *Slider::hStart, *Slider::hMid, *Slider::hEnd, *Slider::hGrip;
diff --git a/src/gui/slider.h b/src/gui/slider.h
index dcfc8005..dc38b738 100644
--- a/src/gui/slider.h
+++ b/src/gui/slider.h
@@ -24,8 +24,10 @@
#ifndef _TMW_SLIDER_H
#define _TMW_SLIDER_H
-#include <guichan.hpp>
-#include "../resources/image.h"
+#include <guichan/widgets/slider.hpp>
+
+class Image;
+
/**
* Slider widget. Same as the Guichan slider but with custom look.
diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp
index 2282301c..3948d25e 100644
--- a/src/gui/stats.cpp
+++ b/src/gui/stats.cpp
@@ -22,8 +22,13 @@
*/
#include "stats.h"
+
+#include <sstream>
+
#include "button.h"
+
#include "../playerinfo.h"
+
#include "../net/network.h"
StatsWindow::StatsWindow():
diff --git a/src/gui/stats.h b/src/gui/stats.h
index 03c4cda4..54bd892b 100644
--- a/src/gui/stats.h
+++ b/src/gui/stats.h
@@ -24,9 +24,11 @@
#ifndef _TMW_STATS_WINDOW_H
#define _TMW_STATS_WINDOW_H
+#include <iosfwd>
+
#include "window.h"
-#include <string>
-#include <sstream>
+
+#include "../guichanfwd.h"
/**
* Window showing player stats.
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 941e9a01..67ca4458 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -22,13 +22,18 @@
*/
#include "status.h"
-#include "stats.h"
-#include "inventorywindow.h"
-#include "setup.h"
-#include "equipmentwindow.h"
+
#include "button.h"
+#include "equipmentwindow.h"
+#include "inventorywindow.h"
+#include "progressbar.h"
+#include "skill.h"
+#include "stats.h"
+
#include "../playerinfo.h"
+extern Window *setupWindow;
+
#define WIN_BORDER 5
#define CONTROLS_SEPARATOR 4
diff --git a/src/gui/status.h b/src/gui/status.h
index 02bd0a2f..7ef57ed9 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -24,10 +24,14 @@
#ifndef _TMW_STATS_H
#define _TMW_STATS_H
-#include <string>
+#include <iosfwd>
#include "window.h"
-#include "progressbar.h"
+
+#include "../guichanfwd.h"
+
+class ProgressBar;
+
/**
* The player status dialog.
@@ -62,7 +66,7 @@ class StatusWindow : public Window, public gcn::ActionListener {
gcn::Label *expLabel, *jobExpLabel;
ProgressBar *healthBar, *manaBar;
ProgressBar *xpBar, *jobXpBar;
- gcn::Button *statsButton, *skillsButton, *inventoryButton, *setupButton, *equipmentButton;
+ gcn::Button *statsButton, *skillsButton, *inventoryButton, *setupButton, *equipmentButton;
};
extern StatusWindow *statusWindow;
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index 06ee3598..315e0c0b 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -22,8 +22,11 @@
*/
#include "textbox.h"
+
#include <sstream>
+#include <guichan/basiccontainer.hpp>
+
TextBox::TextBox():
gcn::TextBox()
{
diff --git a/src/gui/textbox.h b/src/gui/textbox.h
index 5c315d15..54523281 100644
--- a/src/gui/textbox.h
+++ b/src/gui/textbox.h
@@ -24,7 +24,7 @@
#ifndef __TMW_TEXTBOX_H__
#define __TMW_TEXTBOX_H__
-#include <guichan.hpp>
+#include <guichan/widgets/textbox.hpp>
/**
* A text box, meant to be used inside a scroll area. Same as the Guichan text
diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp
index 9470fd54..94ab856e 100644
--- a/src/gui/textfield.cpp
+++ b/src/gui/textfield.cpp
@@ -22,6 +22,12 @@
*/
#include "textfield.h"
+
+#include "../graphics.h"
+
+#include "../graphic/imagerect.h"
+
+#include "../resources/image.h"
#include "../resources/resourcemanager.h"
int TextField::instances = 0;
diff --git a/src/gui/textfield.h b/src/gui/textfield.h
index 6105e2f8..1ed802d7 100644
--- a/src/gui/textfield.h
+++ b/src/gui/textfield.h
@@ -24,9 +24,10 @@
#ifndef __TMW_TEXTFIELD_H__
#define __TMW_TEXTFIELD_H__
-#include <guichan.hpp>
+#include <guichan/widgets/textfield.hpp>
+
+class ImageRect;
-#include "../graphics.h"
/**
* A text field.
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 87328f0c..0afa4a21 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -22,15 +22,25 @@
*/
#include "trade.h"
+
+#include <sstream>
+
+#include <guichan/widgets/label.hpp>
+
+#include "button.h"
#include "chat.h"
#include "inventorywindow.h"
#include "item_amount.h"
-#include "button.h"
+#include "itemcontainer.h"
#include "scrollarea.h"
#include "textfield.h"
+
+#include "../inventory.h"
+#include "../item.h"
+
#include "../net/network.h"
-#include "../equipment.h"
-#include <sstream>
+
+#include "../resources/iteminfo.h"
TradeWindow::TradeWindow():
Window("Trade: You")
@@ -42,21 +52,24 @@ TradeWindow::TradeWindow():
cancelButton = new Button("Cancel");
tradeButton = new Button("Trade");
- myItemContainer = new ItemContainer(&myInventory);
+ myInventory = new Inventory();
+ partnerInventory = new Inventory();
+
+ myItemContainer = new ItemContainer(myInventory);
myItemContainer->setPosition(2, 2);
myScroll = new ScrollArea(myItemContainer);
myScroll->setPosition(8, 8);
- partnerItemContainer = new ItemContainer(&partnerInventory);
+ partnerItemContainer = new ItemContainer(partnerInventory);
partnerItemContainer->setPosition(2, 58);
partnerScroll = new ScrollArea(partnerItemContainer);
partnerScroll->setPosition(8, 64);
-
+
moneyLabel = new gcn::Label("You get: 0z");
moneyField = new TextField();
-
+
addButton->setEventId("add");
okButton->setEventId("ok");
cancelButton->setEventId("cancel");
@@ -131,6 +144,9 @@ TradeWindow::~TradeWindow()
delete itemDescriptionLabel;
delete moneyField;
delete moneyLabel;
+
+ delete myInventory;
+ delete partnerInventory;
}
void TradeWindow::addMoney(int amount)
@@ -145,43 +161,43 @@ void TradeWindow::addItem(int id, bool own, int quantity,
bool equipment)
{
if (own) {
- myInventory.addItem(id, quantity, equipment);
+ myInventory->addItem(id, quantity, equipment);
} else {
- partnerInventory.addItem(id, quantity, equipment);
+ partnerInventory->addItem(id, quantity, equipment);
}
}
void TradeWindow::removeItem(int id, bool own)
{
if (own) {
- myInventory.removeItem(id);
+ myInventory->removeItem(id);
} else {
- partnerInventory.removeItem(id);
+ partnerInventory->removeItem(id);
}
}
void TradeWindow::changeQuantity(int index, bool own, int quantity)
{
if (own) {
- myInventory.getItem(index)->setQuantity(quantity);
+ myInventory->getItem(index)->setQuantity(quantity);
} else {
- partnerInventory.getItem(index)->setQuantity(quantity);
+ partnerInventory->getItem(index)->setQuantity(quantity);
}
}
void TradeWindow::increaseQuantity(int index, bool own, int quantity)
{
if (own) {
- myInventory.getItem(index)->increaseQuantity(quantity);
+ myInventory->getItem(index)->increaseQuantity(quantity);
} else {
- partnerInventory.getItem(index)->increaseQuantity(quantity);
+ partnerInventory->getItem(index)->increaseQuantity(quantity);
}
}
void TradeWindow::reset()
{
- myInventory.resetItems();
- partnerInventory.resetItems();
+ myInventory->resetItems();
+ partnerInventory->resetItems();
tradeButton->setEnabled(false);
okButton->setEnabled(true);
ok_other = false;
@@ -274,11 +290,11 @@ void TradeWindow::action(const std::string &eventId)
return;
}
- if (myInventory.getFreeSlot() < 1) {
+ if (myInventory->getFreeSlot() < 1) {
return;
}
- if (myInventory.contains(item)) {
+ if (myInventory->contains(item)) {
chatWindow->chat_log("Failed adding item. You can not "
"overlap one kind of item on the window.", BY_SERVER);
return;
diff --git a/src/gui/trade.h b/src/gui/trade.h
index b767d47b..44815d66 100644
--- a/src/gui/trade.h
+++ b/src/gui/trade.h
@@ -24,9 +24,14 @@
#ifndef _TMW_TRADE_H
#define _TMW_TRADE_H
-#include "itemcontainer.h"
#include "window.h"
-#include "scrollarea.h"
+
+#include "../guichanfwd.h"
+
+class Inventory;
+class Item;
+class ItemContainer;
+class ScrollArea;
/**
* Trade dialog.
@@ -101,8 +106,8 @@ class TradeWindow : public Window, gcn::ActionListener
*/
void action(const std::string& eventId);
- Inventory myInventory;
- Inventory partnerInventory;
+ Inventory *myInventory;
+ Inventory *partnerInventory;
ItemContainer *myItemContainer;
ItemContainer *partnerItemContainer;
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 4295b8cf..480372d3 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -22,16 +22,31 @@
*/
#include "updatewindow.h"
-#include "ok_dialog.h"
+
+#include <cstdio>
+#include <iostream>
+#include <sstream>
+#include <SDL_thread.h>
+
+#include <curl/curl.h>
+
+#include <guichan/sdl/sdlinput.hpp>
+
+#include <guichan/widgets/label.hpp>
+
+#include "browserbox.h"
+#include "button.h"
#include "gui.h"
-#include "../main.h"
+#include "ok_dialog.h"
+#include "progressbar.h"
+#include "scrollarea.h"
+
+#include "../configuration.h"
+#include "../graphics.h"
#include "../log.h"
+#include "../main.h"
+
#include "../resources/resourcemanager.h"
-#include <curl/curl.h>
-#include <sstream>
-#include <iostream>
-#include <cstdio>
-#include <SDL_thread.h>
UpdaterWindow::UpdaterWindow():
diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h
index b1d58a78..95c4f9d6 100644
--- a/src/gui/updatewindow.h
+++ b/src/gui/updatewindow.h
@@ -25,11 +25,14 @@
#define _UPDATERWINDOW_H
#include "window.h"
-#include "vbox.h"
-#include "progressbar.h"
-#include "button.h"
-#include "browserbox.h"
-#include "scrollarea.h"
+
+#include "../guichanfwd.h"
+
+class BrowserBox;
+class Button;
+class ProgressBar;
+class ScrollArea;
+class VBox;
/**
* Update progress window GUI
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 0228e183..2ded3858 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -22,10 +22,20 @@
*/
#include "window.h"
+
+#include <guichan/exception.hpp>
+
#include "gui.h"
-#include "../resources/resourcemanager.h"
+#include "windowcontainer.h"
+
+#include "../configuration.h"
+#include "../graphics.h"
#include "../log.h"
-#include "../main.h"
+
+#include "../graphic/imagerect.h"
+
+#include "../resources/image.h"
+#include "../resources/resourcemanager.h"
WindowContainer *Window::windowContainer = NULL;
int Window::instances = 0;
diff --git a/src/gui/window.h b/src/gui/window.h
index 7441c804..731b7e9d 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -24,10 +24,14 @@
#ifndef _TMW_WINDOW_H__
#define _TMW_WINDOW_H__
-#include <guichan.hpp>
-#include "windowcontainer.h"
-#include "../graphics.h"
-#include "../configuration.h"
+#include <guichan/widgets/window.hpp>
+
+#include "../configlistener.h"
+#include "../guichanfwd.h"
+
+class ImageRect;
+class WindowContainer;
+
/**
* A window. This window can be dragged around and has a title bar.
diff --git a/src/gui/windowcontainer.h b/src/gui/windowcontainer.h
index c2cf59fd..f41a4a33 100644
--- a/src/gui/windowcontainer.h
+++ b/src/gui/windowcontainer.h
@@ -24,7 +24,7 @@
#ifndef _TMW_WINDOWCONTAINER_H_
#define _TMW_WINDOWCONTAINER_H_
-#include <guichan.hpp>
+#include <guichan/widgets/container.hpp>
class Window;
diff --git a/src/guichanfwd.h b/src/guichanfwd.h
new file mode 100644
index 00000000..981d6878
--- /dev/null
+++ b/src/guichanfwd.h
@@ -0,0 +1,73 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef _TMW_GUICHANFWD_H
+#define _TMW_GUICHANFWD_H
+
+namespace gcn {
+ class ActionListener;
+ class AllegroGraphics;
+ class AllegroImageLoader;
+ class AllegroInput;
+ class BasicContainer;
+ class Button;
+ class CheckBox;
+ class ClipRectangle;
+ class Color;
+ class Container;
+ class DefaultFont;
+ class DropDown;
+ class Exception;
+ class FocusHandler;
+ class Font;
+ class Graphics;
+ class Gui;
+ class Icon;
+ class Image;
+ class ImageFont;
+ class ImageLoader;
+ class Input;
+ class Key;
+ class KeyInput;
+ class KeyListener;
+ class Label;
+ class ListBox;
+ class ListModel;
+ class MouseInput;
+ class MouseListener;
+ class OpenGLGraphics;
+ class OpenGLImageLoader;
+ class RadioButton;
+ class Rectangle;
+ class ScrollArea;
+ class SDLGraphics;
+ class SDLImageLoader;
+ class SDLInput;
+ class Slider;
+ class TextBox;
+ class TextField;
+ class Widget;
+ class Window;
+};
+
+#endif
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 30763622..9e3ad375 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -24,10 +24,12 @@
#include "inventory.h"
#include "equipment.h"
+#include "item.h"
#include "net/network.h"
Inventory::Inventory()
{
+ items = new Item[INVENTORY_SIZE];
for (int i = 0; i < INVENTORY_SIZE; i++) {
items[i].setInvIndex(i);
}
@@ -35,8 +37,27 @@ Inventory::Inventory()
Inventory::~Inventory()
{
+ delete [] items;
}
+Item* Inventory::getItem(int index)
+{
+ return &items[index];
+}
+
+void Inventory::addItem(int id, int quantity, bool equipment)
+{
+ addItem(getFreeSlot(), id, quantity, equipment);
+}
+
+void Inventory::addItem(int index, int id, int quantity, bool equipment)
+{
+ items[index].setId(id);
+ items[index].increaseQuantity(quantity);
+ items[index].setEquipment(equipment);
+}
+
+
void Inventory::resetItems()
{
for (int i = 0; i < INVENTORY_SIZE; i++) {
diff --git a/src/inventory.h b/src/inventory.h
index c31f4fd4..461a4a50 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -24,7 +24,7 @@
#ifndef _INVENTORY_H
#define _INVENTORY_H
-#include "item.h"
+class Item;
#define INVENTORY_SIZE 100
@@ -94,26 +94,9 @@ class Inventory
int getLastUsedSlot();
protected:
- Item items[INVENTORY_SIZE]; /**< The holder of items */
+ Item *items; /**< The holder of items */
};
-inline Item* Inventory::getItem(int index)
-{
- return &items[index];
-}
-
-inline void Inventory::addItem(int id, int quantity, bool equipment)
-{
- addItem(getFreeSlot(), id, quantity, equipment);
-}
-
-inline void Inventory::addItem(int index, int id, int quantity, bool equipment)
-{
- items[index].setId(id);
- items[index].increaseQuantity(quantity);
- items[index].setEquipment(equipment);
-}
-
extern Inventory *inventory;
#endif
diff --git a/src/item.h b/src/item.h
index 3b51874d..0a5fc31e 100644
--- a/src/item.h
+++ b/src/item.h
@@ -24,7 +24,7 @@
#ifndef _ITEM_H
#define _ITEM_H
-#include "resources/iteminfo.h"
+class ItemInfo;
class Item
{
diff --git a/src/log.cpp b/src/log.cpp
index 0ce91d2e..07c12516 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -24,6 +24,8 @@
#include <windows.h>
#endif
+#include <stdarg.h>
+#include <iostream>
#include <sstream>
diff --git a/src/log.h b/src/log.h
index 72caad11..9f6988c0 100644
--- a/src/log.h
+++ b/src/log.h
@@ -22,11 +22,7 @@
#ifndef _LOG_H
#define _LOG_H
-#include <stdlib.h>
-#include <stdarg.h>
-#include <time.h>
-#include <string>
-#include <iostream>
+#include <iosfwd>
#include <fstream>
/**
diff --git a/src/main.cpp b/src/main.cpp
index df03908f..bbddce5f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -21,39 +21,43 @@
* $Id$
*/
-#include <guichan.hpp>
#include "main.h"
+
+#include <iostream>
+#include <physfs.h>
+#include <SDL_image.h>
+
+#include <guichan/sdl/sdlinput.hpp>
+
+#include <libxml/parser.h>
+
+#ifdef __USE_UNIX98
+#include <errno.h>
+#include <sys/stat.h>
+#endif
+
+#include "configuration.h"
#include "game.h"
+#include "graphics.h"
#include "log.h"
-#include "serverinfo.h"
-#include "gui/login.h"
+#include "playerinfo.h"
+#include "sound.h"
+
+#include "graphic/spriteset.h"
+
#include "gui/char_server.h"
#include "gui/char_select.h"
+#include "gui/gui.h"
+#include "gui/login.h"
#include "gui/ok_dialog.h"
#include "gui/updatewindow.h"
-#include "sound.h"
-#include "graphics.h"
-#include "resources/resourcemanager.h"
-#include "resources/itemmanager.h"
+
#include "net/protocol.h"
-#include <iostream>
-#include <cstdio>
-#include <guichan.hpp>
-#include <physfs.h>
-#include <libxml/xmlversion.h>
-#include <libxml/parser.h>
-#include <curl/curl.h>
-#include <SDL.h>
-#include <SDL_thread.h>
-#include <SDL_image.h>
+#include "resources/image.h"
+#include "resources/resourcemanager.h"
-#ifdef __USE_UNIX98
-#include <sys/stat.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <errno.h>
-#endif
+struct SERVER_INFO;
// Account infos
int account_ID, session_ID1, session_ID2;
@@ -80,7 +84,6 @@ Music *bgm;
Configuration config; /**< Xml file configuration reader */
Logger *logger; /**< Log object */
-ItemManager *itemDb; /**< Item database object */
/**
* Allows the next frame to be drawn (part of framerate limiting)
@@ -245,9 +248,6 @@ void init_engine()
// Initialize for drawing
graphics->_beginDraw();
- // Initialize item manager
- itemDb = new ItemManager();
-
login_wallpaper = resman->getImage(
"graphics/images/login_wallpaper.png");
Image *playerImg = resman->getImage(
@@ -295,7 +295,6 @@ void exit_engine()
config.write();
delete gui;
delete graphics;
- delete itemDb;
// Shutdown libxml
xmlCleanupParser();
diff --git a/src/main.h b/src/main.h
index 8f29602c..e4244fbc 100644
--- a/src/main.h
+++ b/src/main.h
@@ -24,11 +24,8 @@
#ifndef _TMW_MAIN_H
#define _TMW_MAIN_H
-#include "graphic/spriteset.h"
-#include "resources/image.h"
-#include "sound.h"
-#include <stdio.h>
-#include <memory>
+class Image;
+class Sound;
#ifndef TMW_DATADIR
#define TMW_DATADIR ""
@@ -58,7 +55,6 @@ enum {
#define LEN_PASSWORD 25
extern Image *login_wallpaper;
-extern Spriteset *hairset, *playerset;
extern char username[25];
extern char password[25];
extern int map_address, char_ID;
diff --git a/src/map.cpp b/src/map.cpp
index 9e3aedda..47630450 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -23,6 +23,9 @@
#include "map.h"
+#include "being.h"
+#include "graphics.h"
+
#include <queue>
MetaTile::MetaTile():
diff --git a/src/map.h b/src/map.h
index bb49fca7..c808bc90 100644
--- a/src/map.h
+++ b/src/map.h
@@ -24,10 +24,12 @@
#ifndef _TMW_MAP_H
#define _TMW_MAP_H
-#include "being.h"
-#include "graphics.h"
-#include "resources/image.h"
#include <list>
+#include <map>
+
+class Being;
+class Graphics;
+class Image;
struct PATH_NODE;
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index 53a0d2c8..e30e9d4e 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -21,13 +21,7 @@
* $Id$
*/
-#include <guichan.hpp>
-#include "../main.h"
-#include "../game.h"
-#include "../playerinfo.h"
-#include "../log.h"
#include "protocol.h"
-#include "network.h"
#ifdef WIN32
#include <windows.h>
@@ -35,6 +29,15 @@
#include "win2linux.h"
#endif
+#include "network.h"
+
+#include "../being.h"
+#include "../game.h"
+#include "../log.h"
+#include "../main.h"
+#include "../playerinfo.h"
+#include "../sound.h"
+
short packet_lengths[] = {
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -232,19 +235,19 @@ Being* attack(unsigned short x, unsigned short y, unsigned char direction)
switch (direction)
{
- case SOUTH:
+ case Being::SOUTH:
target = findNode(x, y + 1, Being::MONSTER);
break;
- case WEST:
+ case Being::WEST:
target = findNode(x - 1, y, Being::MONSTER);
break;
- case NORTH:
+ case Being::NORTH:
target = findNode(x, y - 1, Being::MONSTER);
break;
- case EAST:
+ case Being::EAST:
target = findNode(x + 1, y, Being::MONSTER);
break;
}
@@ -264,16 +267,16 @@ void attack(Being *target)
if (abs(dist_y) >= abs(dist_x))
{
if (dist_y > 0)
- player_node->direction = SOUTH;
+ player_node->direction = Being::SOUTH;
else
- player_node->direction = NORTH;
+ player_node->direction = Being::NORTH;
}
else
{
if (dist_x > 0)
- player_node->direction = EAST;
+ player_node->direction = Being::EAST;
else
- player_node->direction = WEST;
+ player_node->direction = Being::WEST;
}
// Implement charging attacks here
diff --git a/src/net/protocol.h b/src/net/protocol.h
index 002b4b2f..3fa039ba 100644
--- a/src/net/protocol.h
+++ b/src/net/protocol.h
@@ -24,7 +24,7 @@
#ifndef _TMW_PROTOCOL_H
#define _TMW_PROTOCOL_H
-#include "../being.h"
+class Being;
// Packets from server to client
#define SMSG_LOGIN_SUCCESS 0x0073 /**< Logged in, starting location */
diff --git a/src/playerinfo.h b/src/playerinfo.h
index 0a6e15e3..1e769404 100644
--- a/src/playerinfo.h
+++ b/src/playerinfo.h
@@ -24,9 +24,10 @@
#ifndef _TMW_PLAYERINFO_H
#define _TMW_PLAYERINFO_H
+#include <vector>
#include "gui/skill.h"
-typedef struct {
+struct PLAYER_INFO {
int id;
float lastAttackTime; // used to synchronize the charge dialog
char name[24];
@@ -42,7 +43,7 @@ typedef struct {
std::vector<SKILL> m_Skill; // array of N_SKILLS skills
// gets the requested skills level from char_info
int GetSkill(int n_ID, int n_XP=2, int n_base = false); // implemented in the body (main.cpp)
-} PLAYER_INFO;
+};
extern PLAYER_INFO *char_info;
diff --git a/src/resources/buddylist.h b/src/resources/buddylist.h
index 5f082ba7..33c85723 100644
--- a/src/resources/buddylist.h
+++ b/src/resources/buddylist.h
@@ -24,9 +24,10 @@
#ifndef _TMW_BUDDYLIST_H
#define _TMW_BUDDYLIST_H
-#include <guichan.hpp>
+#include <iosfwd>
#include <list>
-#include <string>
+
+#include <guichan/listmodel.hpp>
class BuddyList : public gcn::ListModel {
public:
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 38ed994b..9dafc64c 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -21,12 +21,14 @@
* $Id$
*/
-#include "../main.h"
-#include "../log.h"
#include "image.h"
-#include <iostream>
+
#include <SDL_image.h>
+#include "../log.h"
+#include "../main.h"
+
+
Image::Image(SDL_Surface *image):
image(image)
{
diff --git a/src/resources/image.h b/src/resources/image.h
index a12572bb..7d1fe3c4 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -24,12 +24,13 @@
#ifndef _TMW_IMAGE_H
#define _TMW_IMAGE_H
-#include "resource.h"
#include <SDL.h>
#ifdef USE_OPENGL
#include <SDL_opengl.h>
#endif
+#include "resource.h"
+
/**
* Defines a class for loading and storing images.
*/
diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp
index f5abb5cb..ef2d573b 100644
--- a/src/resources/itemmanager.cpp
+++ b/src/resources/itemmanager.cpp
@@ -20,16 +20,17 @@
*
* $Id$
*/
-
-#include <guichan.hpp>
-
-#include <libxml/tree.h>
-#include <iostream>
#include "itemmanager.h"
+
+#include <libxml/tree.h>
+
#include "resourcemanager.h"
+
#include "../log.h"
+#include "resources/iteminfo.h"
+
// MSVC libxml2 at the moment doesn't work right when using MinGW, missing this
// function at link time.
#ifdef WIN32
@@ -37,6 +38,7 @@
#define xmlFree(x) ;
#endif
+
ItemManager::ItemManager()
{
ResourceManager *resman = ResourceManager::getInstance();
diff --git a/src/resources/itemmanager.h b/src/resources/itemmanager.h
index 7cc26a25..ed4889a6 100644
--- a/src/resources/itemmanager.h
+++ b/src/resources/itemmanager.h
@@ -24,10 +24,9 @@
#ifndef _TMW_ITEM_MANAGER_H
#define _TMW_ITEM_MANAGER_H
-#include <string>
#include <map>
-#include "iteminfo.h"
+class ItemInfo;
/**
* Defines a class to load items database.
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 5d15fd08..2b8c7ab6 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -21,16 +21,19 @@
* $Id$
*/
-#include "../log.h"
#include "mapreader.h"
+
+#include <cassert>
+#include <zlib.h>
+
#include "resourcemanager.h"
-#include "../graphic/spriteset.h"
+
#include "../base64.h"
+#include "../log.h"
+#include "../map.h"
-#include <cassert>
+#include "../graphic/spriteset.h"
-#include <zlib.h>
-#include <iostream>
const unsigned int DEFAULT_TILE_WIDTH = 32;
const unsigned int DEFAULT_TILE_HEIGHT = 32;
diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h
index be38afeb..f37a67c3 100644
--- a/src/resources/mapreader.h
+++ b/src/resources/mapreader.h
@@ -24,11 +24,14 @@
#ifndef _INCLUDED_MAPREADER_H
#define _INCLUDED_MAPREADER_H
-#include "../map.h"
-#include "../graphic/spriteset.h"
-#include <libxml/tree.h>
#include <vector>
+#include <libxml/tree.h>
+
+#include "../graphic/spriteset.h"
+
+class Map;
+
/**
* A tileset, which is basically just a spriteset but it stores a firstgid.
*/
diff --git a/src/resources/music.h b/src/resources/music.h
index 68f285e4..b8d493e2 100644
--- a/src/resources/music.h
+++ b/src/resources/music.h
@@ -24,10 +24,10 @@
#ifndef _TMW_MUSIC_H
#define _TMW_MUSIC_H
-#include "resource.h"
-#include <SDL.h>
#include <SDL_mixer.h>
+#include "resource.h"
+
/**
* Defines a class for loading and storing music.
*/
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index 30e93f76..e13ec359 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -22,10 +22,12 @@
*/
#include "resource.h"
-#include "resourcemanager.h"
#include <cassert>
+#include "resourcemanager.h"
+
+
Resource::Resource():
mRefCount(0)
{
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index d185b99a..8f26cf5c 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -21,25 +21,23 @@
* $Id$
*/
-#include <guichan.hpp>
-#include "../main.h"
#include "resourcemanager.h"
-#include "../log.h"
-#include "../configuration.h"
-#include <iostream>
-#include <sstream>
-#include <physfs.h>
#include <cassert>
+#include <physfs.h>
#ifdef WIN32
#include <io.h>
#include <direct.h>
-#else
-#include <unistd.h>
-#include <dirent.h>
#endif
+#include "image.h"
+#include "music.h"
+#include "soundeffect.h"
+
+#include "../log.h"
+
+
ResourceManager *ResourceManager::instance = NULL;
ResourceManager::ResourceManager()
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index fa7d9610..a5a01987 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -24,13 +24,14 @@
#ifndef _TMW_RESOURCE_MANAGER_H
#define _TMW_RESOURCE_MANAGER_H
+#include <iosfwd>
#include <map>
-#include <string>
#include <vector>
-#include "resource.h"
-#include "image.h"
-#include "music.h"
-#include "soundeffect.h"
+
+class Resource;
+class Image;
+class Music;
+class SoundEffect;
/**
* A class for loading and managing resources.
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index 2e56df9b..69d9823d 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -24,10 +24,10 @@
#ifndef _TMW_SOUND_EFFECT_H
#define _TMW_SOUND_EFFECT_H
-#include "resource.h"
-#include <SDL.h>
#include <SDL_mixer.h>
+#include "resource.h"
+
/**
* Defines a class for loading and storing sound effects.
*/
diff --git a/src/sound.cpp b/src/sound.cpp
index bb51577e..d562a688 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -22,8 +22,12 @@
*/
#include "sound.h"
+
+#include <SDL.h>
+
#include "log.h"
#include "resources/resourcemanager.h"
+#include "resources/soundeffect.h"
Sound::Sound():
installed(false),
diff --git a/src/sound.h b/src/sound.h
index 52a7b9f7..36185f01 100644
--- a/src/sound.h
+++ b/src/sound.h
@@ -24,7 +24,6 @@
#ifndef _TMW_SOUND_H
#define _TMW_SOUND_H
-#include <SDL.h>
#include <SDL_mixer.h>
/** Sound engine