diff options
Diffstat (limited to 'src')
92 files changed, 253 insertions, 219 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 74b1383f..6851a7e7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -144,6 +144,8 @@ tmw_SOURCES = graphic/spriteset.cpp \ main.h \ map.cpp\ map.h \ + playerinfo.h \ + serverinfo.h \ sound.cpp \ sound.h diff --git a/src/being.cpp b/src/being.cpp index 9b936803..d6d16b21 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -21,7 +21,10 @@ * $Id$ */ +#include <sstream> + #include "being.h" +#include "log.h" #include "game.h" #include "engine.h" #include "net/protocol.h" @@ -29,6 +32,8 @@ #include "resources/resourcemanager.h" #include "gui/gui.h" +extern Being* autoTarget; + Being *player_node = NULL; std::list<Being*> beings; diff --git a/src/configuration.cpp b/src/configuration.cpp index e3552a5a..a127570c 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -24,7 +24,6 @@ #include "configuration.h" #include "log.h" -#include "main.h" #include <math.h> #include <iostream> diff --git a/src/configuration.h b/src/configuration.h index f76f0837..c50e68e0 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -116,4 +116,6 @@ class Configuration std::string configPath; /**< Location of config file */ }; +extern Configuration config; + #endif diff --git a/src/engine.cpp b/src/engine.cpp index f6e06c41..6de307c8 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -21,19 +21,36 @@ * $Id$ */ +#include "game.h" +#include "main.h" +#include "playerinfo.h" #include "engine.h" -#include "graphics.h" +#include "log.h" +#include "being.h" +#include "floor_item.h" #include "gui/gui.h" -#include "gui/textfield.h" #include "gui/minimap.h" #include "gui/chargedialog.h" -#include "gui/itemcontainer.h" #include "gui/trade.h" +#include "gui/chat.h" +#include "gui/status.h" +#include "gui/buy.h" +#include "gui/sell.h" +#include "gui/buysell.h" +#include "gui/inventory.h" +#include "gui/npc_text.h" +#include "gui/npc.h" +#include "gui/stats.h" +#include "gui/setup.h" +#include "gui/equipment.h" +#include "gui/popupmenu.h" //#include "gui/buddywindow.h" #include "gui/help.h" -#include "main.h" -#include "being.h" -#include "floor_item.h" +#include "resources/resourcemanager.h" +#include "resources/itemmanager.h" + +extern Being* autoTarget; +extern Graphics* graphics; char itemCurrenyQ[10] = "0"; int map_x, map_y, camera_x, camera_y; diff --git a/src/engine.h b/src/engine.h index 5fbf234e..11cf55cd 100644 --- a/src/engine.h +++ b/src/engine.h @@ -24,50 +24,11 @@ #ifndef _ENGINE_H #define _ENGINE_H -#include "gui/npc.h" -#include "gui/npc_text.h" -#include "gui/buy.h" -#include "gui/sell.h" -#include "gui/buysell.h" -//#include "gui/buddywindow.h" -#include "gui/chat.h" -#include "gui/inventory.h" -#include "gui/shop.h" -#include "gui/inventory.h" -#include "gui/status.h" -#include "gui/stats.h" -#include "gui/skill.h" -#include "gui/newskill.h" -#include "gui/setup.h" -#include "gui/equipment.h" -#include "gui/chargedialog.h" -#include "gui/trade.h" -#include "gui/help.h" -#include "gui/popupmenu.h" -#include "resources/resourcemanager.h" #include "map.h" #include "graphic/spriteset.h" extern int map_x, map_y, camera_x, camera_y; -extern ChatWindow *chatWindow; -extern StatusWindow *statusWindow; -extern BuyDialog *buyDialog; -extern SellDialog *sellDialog; -extern BuySellDialog *buySellDialog; -extern InventoryWindow *inventoryWindow; -extern NpcListDialog *npcListDialog; -extern NpcTextDialog *npcTextDialog; -extern SkillDialog *skillDialog; -//extern NewSkillDialog *newSkillWindow; -extern StatsWindow *statsWindow; -extern Setup *setupWindow; -extern EquipmentWindow *equipmentWindow; -extern ChargeDialog* chargeDialog; -extern TradeWindow *tradeWindow; -//extern BuddyWindow *buddyWindow; -extern HelpWindow *helpWindow; -extern PopupMenu *popupMenu; extern std::map<int, Spriteset*> monsterset; char get_x_offset(char, char); char get_y_offset(char, char); @@ -114,4 +75,6 @@ class Engine Image *attackTarget; }; +extern Engine *engine; + #endif diff --git a/src/floor_item.cpp b/src/floor_item.cpp index 5aacfeb8..486720e3 100755 --- a/src/floor_item.cpp +++ b/src/floor_item.cpp @@ -22,7 +22,6 @@ */ #include "floor_item.h" -#include "game.h" std::list<FloorItem*> floorItems; diff --git a/src/floor_item.h b/src/floor_item.h index 1f0baa6b..80be9c78 100755 --- a/src/floor_item.h +++ b/src/floor_item.h @@ -24,7 +24,6 @@ #ifndef _TMW_FLOORITEM_H #define _TMW_FLOORITEM_H -#include "net/protocol.h" #include <list> class FloorItem { diff --git a/src/game.cpp b/src/game.cpp index bde34a7c..883fdcd5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -21,31 +21,43 @@ * $Id$ */ -#include "engine.h" +#include "game.h" +#include "playerinfo.h" #include "floor_item.h" -#include "graphics.h" -#include "log.h" #include "main.h" +#include "engine.h" +#include "log.h" #include "map.h" -#include "sound.h" #include "gui/chat.h" #include "gui/gui.h" #include "gui/inventory.h" #include "gui/shop.h" #include "gui/npc.h" #include "gui/stats.h" +#include "gui/setup.h" +#include "gui/equipment.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/requesttrade.h" #include "gui/help.h" #include "gui/browserbox.h" #include "net/protocol.h" +#include "net/network.h" #include "resources/mapreader.h" #include <SDL.h> #include <math.h> #include <sstream> +extern Graphics *graphics; + char map_path[480]; bool refresh_beings = false; @@ -125,6 +137,8 @@ int get_elapsed_time(int start_time) } } +void do_init(); + void game() { engine = new Engine(); @@ -24,13 +24,6 @@ #ifndef _TMW_GAME_H #define _TMW_GAME_H -#include "main.h" -#include "being.h" -#include "engine.h" -#include "./gui/gui.h" -#include "./gui/skill.h" -#include <stdio.h> - #define SPEECH_TIME 80 #define SPEECH_MAX_TIME 100 @@ -64,8 +57,6 @@ extern volatile int tick_time; extern int server_tick; extern bool displayPathToMouse; extern int startX, startY; -extern Being* autoTarget; -extern Engine *engine; /** * Main game loop @@ -73,11 +64,6 @@ extern Engine *engine; void game(); /** - * Initialize game engine - */ -void do_init(); - -/** * Check user input */ void do_input(); diff --git a/src/graphic/spriteset.h b/src/graphic/spriteset.h index 42d6a82a..6132330d 100644 --- a/src/graphic/spriteset.h +++ b/src/graphic/spriteset.h @@ -24,10 +24,7 @@ #ifndef _TMW_SPRITESET_H #define _TMW_SPRITESET_H -#include <string> #include <vector> -#include <iostream> -#include "../log.h" #include "../resources/image.h" /** diff --git a/src/graphics.cpp b/src/graphics.cpp index 37e37a79..42c9bddc 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -22,9 +22,11 @@ */ #include "graphics.h" -#include "log.h" #include "resources/resourcemanager.h" #include "main.h" +#include "log.h" + +extern volatile int framesToDraw; SDL_Surface *screen; diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index a2b93c9d..23ed6c5c 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -22,8 +22,9 @@ */ #include "browserbox.h" +#ifndef USE_OPENGL #include "gui.h" -#include "../main.h" +#endif int BrowserBox::instances = 0; gcn::ImageFont* BrowserBox::browserFont; diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h index 81771289..d9c88b14 100644 --- a/src/gui/browserbox.h +++ b/src/gui/browserbox.h @@ -25,7 +25,6 @@ #define __TMW_BROWSERBOX_H__ #include <guichan.hpp> -#include "window.h" #include "linkhandler.h" struct BROWSER_LINK { diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index d291650d..8d1986d5 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -26,6 +26,7 @@ #include "slider.h" #include "scrollarea.h" #include "listbox.h" +#include "../resources/itemmanager.h" #include "../game.h" #include "../net/network.h" diff --git a/src/gui/buy.h b/src/gui/buy.h index 693ddffa..6ca66c7a 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -101,4 +101,6 @@ class BuyDialog : public Window, public gcn::ActionListener, int money; }; +extern BuyDialog *buyDialog; + #endif diff --git a/src/gui/buysell.h b/src/gui/buysell.h index ab2583cd..dcba4ac0 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -58,4 +58,6 @@ class BuySellDialog : public Window, public gcn::ActionListener gcn::Button *cancelButton; }; +extern BuySellDialog *buySellDialog; + #endif diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index ebe1a3c8..e4db6fab 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -21,15 +21,14 @@ * $Id$ */ -#include "../main.h" #include "char_select.h" #include "textfield.h" #include "button.h" #include "ok_dialog.h" -#include "../being.h" -#include "../graphics.h" +#include "../main.h" +#include "../game.h" +#include "../log.h" #include "../net/protocol.h" -#include "../resources/resourcemanager.h" #include <sstream> CharSelectDialog::CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m): diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 8cc57e77..5cdb0712 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -24,7 +24,7 @@ #ifndef _CHAR_SELECT_H #define _CHAR_SELECT_H -#include "../main.h" +#include "../playerinfo.h" #include "../net/network.h" #include "gui.h" #include "confirm_dialog.h" diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 8674b6d4..bc53b3d3 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -22,12 +22,16 @@ */ #include "char_server.h" -#include "../graphics.h" #include "button.h" -#include "window.h" #include "scrollarea.h" #include "listbox.h" #include "ok_dialog.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 b6fd9f27..42627b9c 100644 --- a/src/gui/char_server.h +++ b/src/gui/char_server.h @@ -24,9 +24,6 @@ #ifndef _CHAR_SEL_SERVER_H #define _CHAR_SEL_SERVER_H -#include "../main.h" -#include "../net/network.h" -#include "gui.h" #include "window.h" diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp index b5ffce44..726e73ff 100644 --- a/src/gui/chargedialog.cpp +++ b/src/gui/chargedialog.cpp @@ -25,11 +25,7 @@ */ #include "chargedialog.h" -#include "listbox.h" -#include "scrollarea.h" -#include "button.h" -#include "../main.h" -#include <time.h> +#include "../playerinfo.h" ChargeDialog::ChargeDialog(): Window("") diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h index 6615fff6..e544a602 100644 --- a/src/gui/chargedialog.h +++ b/src/gui/chargedialog.h @@ -54,4 +54,6 @@ class ChargeDialog : public Window, public gcn::ActionListener void draw(gcn::Graphics *graphics); }; +extern ChargeDialog* chargeDialog; + #endif diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index b3e072a2..ce5593f9 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -26,9 +26,10 @@ #include "textbox.h" #include "chatinput.h" #include "gui.h" -#include "../graphics.h" -#include "../main.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 f459b804..28c3ab0c 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -26,8 +26,6 @@ #include <guichan.hpp> #include <guichan/key.hpp> -#include "../resources/image.h" -#include "../net/network.h" #include "window.h" #include "scrollarea.h" #include "browserbox.h" @@ -213,5 +211,7 @@ class ChatWindow : public Window, public gcn::ActionListener, std::list<std::string>::iterator curHist; /**< History iterator */ }; +extern ChatWindow *chatWindow; + #endif diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp index 52e91f3a..028b7151 100644 --- a/src/gui/chatinput.cpp +++ b/src/gui/chatinput.cpp @@ -22,6 +22,7 @@ */ #include "chatinput.h" +#include "../graphics.h" ChatInput::ChatInput() { diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index ab867b0f..9fb79060 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -22,8 +22,9 @@ */ #include "checkbox.h" +#include "graphics.h" #include "../resources/resourcemanager.h" -#include "../graphics.h" +#include <guichan.hpp> int CheckBox::instances = 0; Image *CheckBox::checkBoxNormal; diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h index fcbd9b0f..3e24b0e2 100644 --- a/src/gui/confirm_dialog.h +++ b/src/gui/confirm_dialog.h @@ -24,7 +24,6 @@ #ifndef _TMW_OPTION_DIALOG_H #define _TMW_OPTION_DIALOG_H -#include "gui.h" #include "window.h" /** diff --git a/src/gui/equipment.cpp b/src/gui/equipment.cpp index b954eec7..b9cfd0c6 100644 --- a/src/gui/equipment.cpp +++ b/src/gui/equipment.cpp @@ -21,10 +21,10 @@ * $Id$ */ -#include "../main.h" -#include "../graphics.h" #include "equipment.h" +#include "../log.h" #include "../resources/resourcemanager.h" +#include "../resources/itemmanager.h" #include "../resources/image.h" #include <sstream> diff --git a/src/gui/equipment.h b/src/gui/equipment.h index 2de0af03..87f543ca 100644 --- a/src/gui/equipment.h +++ b/src/gui/equipment.h @@ -25,7 +25,6 @@ #define _TMW_EQUIPMENT_H #include "../graphic/spriteset.h" -#include "gui.h" #include "window.h" typedef struct { @@ -82,4 +81,6 @@ class EquipmentWindow : public Window, gcn::ActionListener { }; +extern EquipmentWindow *equipmentWindow; + #endif diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0ed123e3..7643c01f 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -25,10 +25,13 @@ #include "window.h" #include "windowcontainer.h" #include "focushandler.h" -#include "../engine.h" #include "../net/protocol.h" #include "../main.h" +#include "../engine.h" #include "../game.h" +#include "../log.h" + +extern Being* autoTarget; // Guichan stuff Gui *gui; diff --git a/src/gui/help.cpp b/src/gui/help.cpp index 5a5f42cc..cff36da8 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -25,7 +25,7 @@ #include "scrollarea.h" #include "button.h" #include "textbox.h" -#include "../main.h" +#include "../log.h" #include "../resources/resourcemanager.h" HelpWindow::HelpWindow(): diff --git a/src/gui/help.h b/src/gui/help.h index 3c5d95a1..21e27c34 100644 --- a/src/gui/help.h +++ b/src/gui/help.h @@ -69,4 +69,6 @@ class HelpWindow : public Window, public LinkHandler, gcn::ScrollArea *scrollArea; }; +extern HelpWindow *helpWindow; + #endif diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 9d2669e5..73bf67f5 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -21,16 +21,14 @@ * $Id$ */ -#include "../main.h" -#include "../graphics.h" +#include "../playerinfo.h" #include "inventory.h" -#include "../resources/resourcemanager.h" -#include "../resources/image.h" +#include "equipment.h" #include "button.h" #include "scrollarea.h" -#include "../being.h" -#include "../engine.h" +#include "../net/network.h" #include "item_amount.h" +#include "../resources/itemmanager.h" #include <string> InventoryWindow::InventoryWindow(): diff --git a/src/gui/inventory.h b/src/gui/inventory.h index a035ee50..4fcc6870 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -24,11 +24,7 @@ #ifndef _TMW_INVENTORY_H #define _TMW_INVENTORY_H -#include "../log.h" -#include "../net/network.h" -#include "../graphic/spriteset.h" #include "itemcontainer.h" -#include "gui.h" #include "window.h" /** @@ -109,4 +105,6 @@ class InventoryWindow : public Window, gcn::ActionListener gcn::Label *weightLabel; }; +extern InventoryWindow *inventoryWindow; + #endif diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index 2afacb05..036fdc15 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -22,9 +22,9 @@ */ #include "item_amount.h" +#include "inventory.h" +#include "trade.h" #include "button.h" -#include "../engine.h" -#include "../main.h" ItemAmountWindow::ItemAmountWindow(int usage, Window *parent): Window("Select amount of items to drop.", true, parent) diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index f66a6eff..3fbad89a 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -21,9 +21,12 @@ * $Id$ */ -#include "../main.h" #include "itemcontainer.h" +#include "../main.h" +#include "../log.h" +#include "../graphics.h" #include "../resources/resourcemanager.h" +#include "../resources/itemmanager.h" #include <sstream> ItemContainer::ItemContainer() diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index fd38e818..a0e3b79a 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -26,7 +26,6 @@ #include <iostream> #include <guichan.hpp> -#include "../graphics.h" #include "../resources/image.h" #include "../graphic/spriteset.h" diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 6c610e1d..9f3b230e 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -22,14 +22,15 @@ */ #include "login.h" -#include "gui.h" #include "button.h" #include "checkbox.h" #include "textfield.h" #include "passwordfield.h" #include "ok_dialog.h" -#include "../graphics.h" +#include "gui.h" #include "../main.h" +#include "../serverinfo.h" +#include "../log.h" #include "../net/network.h" #include <string> diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 58e8df80..8ce7ffd7 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -24,7 +24,6 @@ #include "minimap.h" #include "../being.h" #include "../resources/resourcemanager.h" -#include "../graphics.h" Minimap::Minimap(): Window("Map"), diff --git a/src/gui/minimap.h b/src/gui/minimap.h index 3710332c..20063d15 100644 --- a/src/gui/minimap.h +++ b/src/gui/minimap.h @@ -24,9 +24,9 @@ #ifndef _TMW_MINIMAP_H #define _TMW_MINIMAP_H -#include "../map.h" -#include "gui.h" #include "window.h" +#include "../map.h" +#include "../resources/image.h" /** * Minimap dialog. diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp index 5849e020..800c4a28 100644 --- a/src/gui/newskill.cpp +++ b/src/gui/newskill.cpp @@ -26,10 +26,7 @@ */ #include "newskill.h" -#include "listbox.h" -#include "scrollarea.h" #include "button.h" -#include "../main.h" char *skill_name[] = { // 0-99 diff --git a/src/gui/npc.h b/src/gui/npc.h index 5bede528..afe56805 100644 --- a/src/gui/npc.h +++ b/src/gui/npc.h @@ -86,4 +86,6 @@ class NpcListDialog : public Window, public gcn::ActionListener, std::vector<std::string> items; }; +extern NpcListDialog *npcListDialog; + #endif diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index bae47ce8..e3f16293 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -75,4 +75,6 @@ class NpcTextDialog : public Window, public gcn::ActionListener gcn::ScrollArea *scrollArea; }; +extern NpcTextDialog *npcTextDialog; + #endif diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h index bb1a4e58..1287bc7f 100644 --- a/src/gui/ok_dialog.h +++ b/src/gui/ok_dialog.h @@ -24,7 +24,6 @@ #ifndef _OK_DIALOG_H #define _OK_DIALOG_H -#include "gui.h" #include "window.h" /** diff --git a/src/gui/passwordfield.cpp b/src/gui/passwordfield.cpp index aa5c3141..29ddb86b 100644 --- a/src/gui/passwordfield.cpp +++ b/src/gui/passwordfield.cpp @@ -22,7 +22,6 @@ */ #include "passwordfield.h" -#include "gui.h" PasswordField::PasswordField(const std::string& text): diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index 9514d335..c62596fc 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -22,9 +22,8 @@ */ #include "playerbox.h" -#include "gui.h" -#include "../being.h" #include "../main.h" +#include "../being.h" #include "../resources/resourcemanager.h" int PlayerBox::instances = 0; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 3c3b26b7..36c246a6 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -23,8 +23,10 @@ #include "popupmenu.h" #include "../graphics.h" -#include "../engine.h" #include "../game.h" +#include "../engine.h" +#include "../net/network.h" +#include "../resources/itemmanager.h" #include <iostream> PopupMenu::PopupMenu(): diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 77c8931a..c21d4758 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -75,4 +75,6 @@ class PopupMenu : public Window, public LinkHandler FloorItem* floorItem; }; +extern PopupMenu *popupMenu; + #endif diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index d939b3b5..47225acd 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -22,7 +22,7 @@ */ #include "progressbar.h" -#include "gui.h" +#include "../graphics.h" #include "../resources/resourcemanager.h" ProgressBar::ProgressBar(float progress, int x, int y, int width, int height, diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index f03c333f..4b3a439e 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -22,6 +22,7 @@ */ #include "radiobutton.h" +#include "../graphics.h" #include "../resources/resourcemanager.h" int RadioButton::instances = 0; diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h index 343854d2..2249059d 100644 --- a/src/gui/radiobutton.h +++ b/src/gui/radiobutton.h @@ -24,7 +24,7 @@ #ifndef _TMW_RADIOBUTTON_H #define _TMW_RADIOBUTTON_H -#include "gui.h" +#include <guichan.hpp> #include "../resources/image.h" /* diff --git a/src/gui/requesttrade.cpp b/src/gui/requesttrade.cpp index 66ca6480..ce6ccb56 100644 --- a/src/gui/requesttrade.cpp +++ b/src/gui/requesttrade.cpp @@ -23,7 +23,6 @@ #include "requesttrade.h" #include "button.h" -#include "../game.h" #include "../net/network.h" RequestTradeDialog::RequestTradeDialog(const char *name): diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 319025a0..03234dca 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -22,9 +22,7 @@ */ #include "scrollarea.h" -#include "gui.h" #include "../resources/resourcemanager.h" -#include "../main.h" int ScrollArea::instances = 0; ImageRect ScrollArea::background; diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index 66ec1542..20de2255 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -26,7 +26,6 @@ #include <guichan.hpp> #include "../graphics.h" -#include "../configuration.h" /** * A scroll area. diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 95c4a2dc..5693e091 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -22,14 +22,14 @@ */ #include "sell.h" +#include "inventory.h" #include "button.h" #include "slider.h" #include "scrollarea.h" #include "listbox.h" -#include "../graphics.h" #include "../game.h" -#include "../engine.h" #include "../net/network.h" +#include "../resources/itemmanager.h" #include <sstream> diff --git a/src/gui/sell.h b/src/gui/sell.h index 17763bf6..48617d17 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -89,4 +89,6 @@ class SellDialog : public Window, public gcn::ActionListener, int maxItems; }; +extern SellDialog *sellDialog; + #endif diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index b839c459..a1c1f500 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -26,9 +26,9 @@ #include "checkbox.h" #include "scrollarea.h" #include "listbox.h" -#include "radiobutton.h" #include "slider.h" #include "ok_dialog.h" +#include "../log.h" #include "../main.h" #include <sstream> diff --git a/src/gui/setup.h b/src/gui/setup.h index 2adc9708..30eda305 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -25,7 +25,6 @@ #define _TMW_SETUP_H #include "window.h" -#include "../sound.h" /** * The list model for mode list. @@ -99,4 +98,6 @@ class Setup : public Window, public gcn::ActionListener { }; +extern Setup *setupWindow; + #endif diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index e511a24e..b4315d3e 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -25,7 +25,7 @@ #include "listbox.h" #include "scrollarea.h" #include "button.h" -#include "../main.h" +#include "../playerinfo.h" #include "../net/network.h" char *skill_db[] = { diff --git a/src/gui/skill.h b/src/gui/skill.h index 0a87afed..7bff96cf 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -73,4 +73,6 @@ class SkillDialog : public Window, public gcn::ActionListener, void setSkill(int id, int lv, int sp); }; +extern SkillDialog *skillDialog; + #endif diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp index 1a4482a5..6bbe1bed 100644 --- a/src/gui/slider.cpp +++ b/src/gui/slider.cpp @@ -22,8 +22,8 @@ */ #include "slider.h" -#include "../resources/resourcemanager.h" #include "../graphics.h" +#include "../resources/resourcemanager.h" Image *Slider::hStart, *Slider::hMid, *Slider::hEnd, *Slider::hGrip; Image *Slider::vStart, *Slider::vMid, *Slider::vEnd, *Slider::vGrip; diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index 9b134876..2282301c 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -23,7 +23,7 @@ #include "stats.h" #include "button.h" -#include "../main.h" +#include "../playerinfo.h" #include "../net/network.h" StatsWindow::StatsWindow(): diff --git a/src/gui/stats.h b/src/gui/stats.h index 82bff443..03c4cda4 100644 --- a/src/gui/stats.h +++ b/src/gui/stats.h @@ -72,4 +72,6 @@ class StatsWindow : public Window, public gcn::ActionListener { gcn::Button *statsButton[6]; }; +extern StatsWindow *statsWindow; + #endif /* _TMW_STATS_WINDOW_H */ diff --git a/src/gui/status.cpp b/src/gui/status.cpp index b571c724..a8f13660 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -22,9 +22,12 @@ */ #include "status.h" -#include "../main.h" +#include "stats.h" +#include "inventory.h" +#include "setup.h" +#include "equipment.h" #include "button.h" -#include "../engine.h" +#include "../playerinfo.h" #define WIN_BORDER 5 #define CONTROLS_SEPARATOR 4 diff --git a/src/gui/status.h b/src/gui/status.h index 0caf588d..ebc9a041 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -65,4 +65,6 @@ class StatusWindow : public Window, public gcn::ActionListener { gcn::Button *statsButton, *skillsButton, *inventoryButton, *setupButton, *equipmentButton; }; +extern StatusWindow *statusWindow; + #endif diff --git a/src/gui/textfield.h b/src/gui/textfield.h index 808b73ab..6105e2f8 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -25,6 +25,7 @@ #define __TMW_TEXTFIELD_H__ #include <guichan.hpp> + #include "../graphics.h" /** diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 925c9950..4516400f 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -21,17 +21,16 @@ * $Id $ */ -#include "../main.h" -#include "../graphics.h" #include "trade.h" +#include "equipment.h" +#include "inventory.h" +#include "chat.h" #include "item_amount.h" -#include "../resources/resourcemanager.h" -#include "../resources/image.h" #include "button.h" #include "scrollarea.h" #include "textfield.h" -#include "../being.h" -#include "../engine.h" +#include "../net/network.h" +#include "../resources/itemmanager.h" #include <sstream> TradeWindow::TradeWindow(): diff --git a/src/gui/trade.h b/src/gui/trade.h index 5d82f875..5b824548 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -24,11 +24,7 @@ #ifndef _TMW_TRADE_H #define _TMW_TRADE_H -#include "../log.h" -#include "../net/network.h" -#include "../graphic/spriteset.h" #include "itemcontainer.h" -#include "gui.h" #include "window.h" #include "scrollarea.h" @@ -118,4 +114,6 @@ class TradeWindow : public Window, gcn::ActionListener bool ok_other, ok_me; }; +extern TradeWindow *tradeWindow; + #endif diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 8432b65e..b602c053 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.h @@ -24,7 +24,6 @@ #ifndef _UPDATERWINDOW_H #define _UPDATERWINDOW_H -#include "gui.h" #include "window.h" #include "vbox.h" #include "progressbar.h" diff --git a/src/gui/window.h b/src/gui/window.h index 3c9201ce..0a089b49 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -24,10 +24,8 @@ #ifndef _TMW_WINDOW_H__ #define _TMW_WINDOW_H__ -#include <iostream> #include <guichan.hpp> #include "windowcontainer.h" -#include "../resources/image.h" #include "../graphics.h" #include "../configuration.h" diff --git a/src/gui/windowcontainer.cpp b/src/gui/windowcontainer.cpp index 9fd9b002..899a5463 100644 --- a/src/gui/windowcontainer.cpp +++ b/src/gui/windowcontainer.cpp @@ -23,7 +23,6 @@ #include <iostream> #include "windowcontainer.h" -#include "window.h" WindowContainer::WindowContainer() { @@ -60,4 +60,6 @@ class Logger std::ofstream logFile; }; +extern Logger *logger; + #endif diff --git a/src/main.cpp b/src/main.cpp index 14191c0a..d13f80e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,10 @@ */ #include "main.h" +#include "game.h" +#include "log.h" +#include "serverinfo.h" +#include "gui/login.h" #include "gui/char_server.h" #include "gui/char_select.h" #include "gui/ok_dialog.h" @@ -29,6 +33,7 @@ #include "sound.h" #include "graphics.h" #include "resources/resourcemanager.h" +#include "resources/itemmanager.h" #include "net/protocol.h" #include <iostream> @@ -24,16 +24,8 @@ #ifndef _TMW_MAIN_H #define _TMW_MAIN_H -#include "gui/gui.h" -#include "gui/login.h" -#include "gui/skill.h" #include "graphic/spriteset.h" #include "resources/image.h" -#include "resources/itemmanager.h" -#include "configuration.h" -#include "game.h" -#include "log.h" -#include "map.h" #include "sound.h" #include <stdio.h> #include <memory> @@ -68,35 +60,9 @@ enum { #define N_SKILLS 100 // skill count constant value #define XP_CONSTANT 1.2 // the exponent which determines skill exp curve -typedef struct { - int address; - short port; - char name[20]; - short online_users; -} SERVER_INFO; - -typedef struct { - int id; - float lastAttackTime; // used to synchronize the charge dialog - char name[24]; - short hp, max_hp, sp, max_sp, lv; - short statsPointsToAttribute; - int xp, xpForNextLevel, gp, job_xp, jobXpForNextLevel, job_lv; - short statp, skill_point, hair_color, hair_style; - char STR, AGI, VIT, INT, DEX, LUK; - char STRUp, AGIUp, VITUp, INTUp, DEXUp, LUKUp; - int totalWeight, maxWeight; - short weapon; - // skill list declaration - 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 Image *login_wallpaper; extern Spriteset *hairset, *playerset; -extern Graphics *graphics; extern char username[25]; extern char password[25]; extern int map_address, char_ID; @@ -104,16 +70,10 @@ extern short map_port; extern char map_name[16]; extern int account_ID, session_ID1, session_ID2; extern char sex, n_server, n_character; -extern SERVER_INFO *server_info; -extern PLAYER_INFO *char_info; extern unsigned char state; -extern Configuration config; extern Sound sound; -extern Logger *logger; extern int screenW, screenH, bitDepth, displayFlags; extern bool useOpenGL; -extern ItemManager *itemDb; extern char *homeDir; -extern volatile int framesToDraw; #endif diff --git a/src/map.cpp b/src/map.cpp index 6e4bf62d..5970d5a9 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -21,13 +21,7 @@ * $Id$ */ -#include "main.h" #include "map.h" -#include "log.h" -#include "resources/resourcemanager.h" -#include "resources/mapreader.h" -#include "graphic/spriteset.h" -#include "net/network.h" #include <queue> diff --git a/src/net/network.cpp b/src/net/network.cpp index fa009341..b0d27be9 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -21,7 +21,7 @@ * $Id$ */ -#include "../main.h" +#include "../log.h" #include "network.h" #ifndef WIN32 #include <unistd.h> diff --git a/src/net/network.h b/src/net/network.h index 61fb5133..cc5e542f 100644 --- a/src/net/network.h +++ b/src/net/network.h @@ -31,7 +31,6 @@ #endif #include <stdio.h> -#include "../log.h" #ifdef MACOSX #include "win2mac.h" diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp index eac679bc..483544dd 100644 --- a/src/net/protocol.cpp +++ b/src/net/protocol.cpp @@ -22,8 +22,9 @@ */ #include "../main.h" -#include "../being.h" #include "../game.h" +#include "../playerinfo.h" +#include "../log.h" #include "protocol.h" #include "network.h" diff --git a/src/playerinfo.h b/src/playerinfo.h new file mode 100644 index 00000000..0a6e15e3 --- /dev/null +++ b/src/playerinfo.h @@ -0,0 +1,49 @@ +/* + * 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_PLAYERINFO_H +#define _TMW_PLAYERINFO_H + +#include "gui/skill.h" + +typedef struct { + int id; + float lastAttackTime; // used to synchronize the charge dialog + char name[24]; + short hp, max_hp, sp, max_sp, lv; + short statsPointsToAttribute; + int xp, xpForNextLevel, gp, job_xp, jobXpForNextLevel, job_lv; + short statp, skill_point, hair_color, hair_style; + char STR, AGI, VIT, INT, DEX, LUK; + char STRUp, AGIUp, VITUp, INTUp, DEXUp, LUKUp; + int totalWeight, maxWeight; + short weapon; + // skill list declaration + 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; + +#endif diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 1abad8ec..2a0482d9 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -21,13 +21,10 @@ * $Id$ */ -#include "../main.h" -#include "../graphics.h" -#include "image.h" #include "../log.h" +#include "image.h" #include <iostream> #include <SDL_image.h> -#include "resourcemanager.h" #ifndef USE_OPENGL Image::Image(SDL_Surface *image): diff --git a/src/resources/image.h b/src/resources/image.h index b41876d2..7fe83a66 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -29,7 +29,6 @@ #ifdef USE_OPENGL #include <SDL_opengl.h> #endif -#include <string> /** diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp index b0f88011..f5abb5cb 100644 --- a/src/resources/itemmanager.cpp +++ b/src/resources/itemmanager.cpp @@ -23,13 +23,11 @@ #include <guichan.hpp> -#include <libxml/parser.h> #include <libxml/tree.h> #include <iostream> #include "itemmanager.h" #include "resourcemanager.h" -#include "../main.h" #include "../log.h" // MSVC libxml2 at the moment doesn't work right when using MinGW, missing this diff --git a/src/resources/itemmanager.h b/src/resources/itemmanager.h index 8b8c437f..7cc26a25 100644 --- a/src/resources/itemmanager.h +++ b/src/resources/itemmanager.h @@ -53,4 +53,6 @@ class ItemManager ItemInfo *unknown; }; +extern ItemManager *itemDb; + #endif diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index dd95d611..5d15fd08 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -21,9 +21,8 @@ * $Id$ */ -#include "../main.h" -#include "mapreader.h" #include "../log.h" +#include "mapreader.h" #include "resourcemanager.h" #include "../graphic/spriteset.h" #include "../base64.h" diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 241945f1..d0faac6d 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.h @@ -26,7 +26,6 @@ #include "../map.h" #include "../graphic/spriteset.h" -#include <libxml/parser.h> #include <libxml/tree.h> #include <vector> diff --git a/src/resources/music.cpp b/src/resources/music.cpp index 6b41dd76..9cc848ad 100644 --- a/src/resources/music.cpp +++ b/src/resources/music.cpp @@ -22,7 +22,6 @@ */ #include "music.h" -#include "resourcemanager.h" Music::Music(Mix_Chunk *music): music(music) diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 8b846ffb..70247a12 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -21,7 +21,6 @@ * $Id$ */ -#include "../main.h" #include "resourcemanager.h" #include "../log.h" #include <iostream> diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp index ba0af415..30d405d3 100644 --- a/src/resources/soundeffect.cpp +++ b/src/resources/soundeffect.cpp @@ -22,7 +22,6 @@ */ #include "soundeffect.h" -#include "resourcemanager.h" SoundEffect::SoundEffect(Mix_Chunk *soundEffect): soundEffect(soundEffect) diff --git a/src/serverinfo.h b/src/serverinfo.h new file mode 100644 index 00000000..be3fccaa --- /dev/null +++ b/src/serverinfo.h @@ -0,0 +1,36 @@ +/* + * 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_SERVERINFO_H +#define _TMW_SERVERINFO_H + +typedef struct { + int address; + short port; + char name[20]; + short online_users; +} SERVER_INFO; + +extern SERVER_INFO *server_info; + +#endif diff --git a/src/sound.cpp b/src/sound.cpp index b44ba077..bb51577e 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -23,7 +23,7 @@ #include "sound.h" #include "log.h" -#include "main.h" +#include "resources/resourcemanager.h" Sound::Sound(): installed(false), diff --git a/src/sound.h b/src/sound.h index 401a90f4..8055881d 100644 --- a/src/sound.h +++ b/src/sound.h @@ -28,8 +28,6 @@ #include <SDL.h> #include <SDL_mixer.h> -#include "resources/resourcemanager.h" - /** Sound engine * * \ingroup CORE |