summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine.cpp5
-rw-r--r--src/engine.h7
-rw-r--r--src/game.cpp11
-rw-r--r--src/game.h1
-rw-r--r--src/gui/buysell.h2
-rw-r--r--src/gui/chargedialog.h2
-rw-r--r--src/gui/debugwindow.cpp10
-rw-r--r--src/gui/debugwindow.h2
-rw-r--r--src/gui/gui.h1
-rw-r--r--src/gui/ministatus.h2
-rw-r--r--src/gui/npc_text.h2
-rw-r--r--src/gui/sell.h2
-rw-r--r--src/gui/setup.h2
13 files changed, 17 insertions, 32 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 9f5106bd..2fa3257e 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -60,6 +60,7 @@ Spriteset *weaponset;
Engine::Engine():
+ mShowDebugPath(false),
mCurrentMap(NULL)
{
// Load the sprite sets
@@ -177,6 +178,8 @@ void Engine::logic()
beingIterator++;
}
}
+
+ gui->logic();
}
void Engine::draw(Graphics *graphics)
@@ -215,7 +218,7 @@ void Engine::draw(Graphics *graphics)
// Find a path from the player to the mouse, and draw it. This is for debug
// purposes.
- if (displayPathToMouse && mCurrentMap != NULL)
+ if (mShowDebugPath && mCurrentMap != NULL)
{
// Get the current mouse position
int mouseX, mouseY;
diff --git a/src/engine.h b/src/engine.h
index 25367436..8ab8fb05 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -68,7 +68,14 @@ class Engine
*/
void draw(Graphics *graphics);
+ /**
+ * Toggles whether the path debug graphics are shown
+ */
+ void toggleDebugPath() { mShowDebugPath = !mShowDebugPath; };
+
private:
+ bool mShowDebugPath;
+
Map *mCurrentMap;
Image *attackTarget;
};
diff --git a/src/game.cpp b/src/game.cpp
index 72dbb0c9..ee254d13 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -51,7 +51,6 @@
#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/minimap.h"
@@ -76,6 +75,7 @@
#include "resources/imagewriter.h"
extern Graphics *graphics;
+extern gcn::SDLInput *guiInput;
std::string map_path;
std::string tradePartnerName;
@@ -86,7 +86,6 @@ volatile int tick_time;
volatile bool action_time = false;
int server_tick;
int fps = 0, frame = 0, current_npc = 0;
-bool displayPathToMouse = false;
Uint16 startX = 0, startY = 0;
Being *autoTarget = NULL;
Engine *engine = NULL;
@@ -250,9 +249,6 @@ void createGuiWindows()
//buddyWindow->setVisible(false);
helpWindow->setVisible(false);
debugWindow->setVisible(false);
-
- // Do not focus any text field
- gui->focusNone();
}
/**
@@ -374,7 +370,6 @@ void game()
{
do_input();
engine->logic();
- gui->logic();
gameTime++;
}
@@ -625,7 +620,7 @@ void do_input()
case SDLK_f:
// Find path to mouse (debug purpose)
- displayPathToMouse = !displayPathToMouse;
+ engine->toggleDebugPath();
used = true;
break;
}
@@ -821,7 +816,7 @@ void do_parse()
Being *being;
// We need at least 2 bytes to identify a packet
- while (in_size >= 2)
+ while (packetReady())
{
MessageIn msg = get_next_message();
diff --git a/src/game.h b/src/game.h
index 92ee81a9..49696300 100644
--- a/src/game.h
+++ b/src/game.h
@@ -39,7 +39,6 @@ extern std::string tradePartnerName;
extern int fps, current_npc;
extern volatile int tick_time;
extern int server_tick;
-extern bool displayPathToMouse;
extern unsigned short startX, startY;
enum {
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index fad7e83d..a3e54df0 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -57,6 +57,4 @@ class BuySellDialog : public Window, public gcn::ActionListener
gcn::Button *cancelButton;
};
-extern BuySellDialog *buySellDialog;
-
#endif
diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h
index 4d38f0e2..d17bdeb2 100644
--- a/src/gui/chargedialog.h
+++ b/src/gui/chargedialog.h
@@ -48,6 +48,4 @@ class ChargeDialog : public Window
ProgressBar* progBar;
};
-extern ChargeDialog* chargeDialog;
-
#endif
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index eebfc29d..b629ddab 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -22,21 +22,17 @@
*/
#include "debugwindow.h"
-#include "button.h"
-#include "minimap.h"
#include <guichan/widgets/label.hpp>
#include <sstream>
+#include <SDL_mouse.h>
+
+#include "button.h"
#include "../game.h"
-#include "../graphics.h"
#include "../engine.h"
#include "../map.h"
-extern Graphics *graphics;
-extern Minimap *minimap;
-extern int frame;
-
DebugWindow::DebugWindow():
Window("Debug")
{
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 7d2ee6c1..a2480f79 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -63,6 +63,4 @@ class DebugWindow : public Window, public gcn::ActionListener
};
-extern DebugWindow *debugWindow;
-
#endif
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 83f731db..c4c47a88 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -36,7 +36,6 @@ class Graphics;
class Image;
class Item;
class PopupMenu;
-class WindowContainer;
/**
* \defgroup GUI Core GUI related classes (widgets)
diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h
index 0c6a5ef1..f10717bc 100644
--- a/src/gui/ministatus.h
+++ b/src/gui/ministatus.h
@@ -70,7 +70,5 @@ class MiniStatusWindow : public Window, public gcn::ActionListener {
gcn::Label *hpLabel, *mpLabel;
};
-extern MiniStatusWindow *miniStatusWindow;
-
#endif
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index aa6aa725..4a0e8b49 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -75,6 +75,4 @@ class NpcTextDialog : public Window, public gcn::ActionListener
gcn::ScrollArea *scrollArea;
};
-extern NpcTextDialog *npcTextDialog;
-
#endif
diff --git a/src/gui/sell.h b/src/gui/sell.h
index 9b30002a..142819b5 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -102,6 +102,4 @@ class SellDialog : public Window, public gcn::ActionListener,
int m_amountItems;
};
-extern SellDialog *sellDialog;
-
#endif
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 2acb1af2..b76b9a55 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -116,6 +116,4 @@ class Setup : public Window, public gcn::ActionListener
bool soundEnabled;
};
-extern Setup *setupWindow;
-
#endif