summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-25 23:04:58 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-25 23:04:58 +0200
commita36909f5c3408153c9b5f9477adde9b27d8c7482 (patch)
tree0acd7721cd2bb2b27878d20027d0510458581515 /src/gui/viewport.cpp
parent4e18e7619e9a8c909dea3374a2a7aa39befe0c16 (diff)
downloadmana-client-a36909f5c3408153c9b5f9477adde9b27d8c7482.tar.gz
mana-client-a36909f5c3408153c9b5f9477adde9b27d8c7482.tar.bz2
mana-client-a36909f5c3408153c9b5f9477adde9b27d8c7482.tar.xz
mana-client-a36909f5c3408153c9b5f9477adde9b27d8c7482.zip
Handle map not found gracefully
Instead of shutting down, the client will now draw a gray background. This allows the player to still contact a GM in order to be helped out of the situation. It also helps me warp out of the non-existing map I accidentally warped myself onto. ;)
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp51
1 files changed, 29 insertions, 22 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 2c3f4007..d954b99f 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -19,26 +19,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "ministatus.h"
-#include "popupmenu.h"
-#include "viewport.h"
-
-#include "../beingmanager.h"
-#include "../configuration.h"
-#include "../flooritemmanager.h"
-#include "../game.h"
-#include "../graphics.h"
-#include "../keyboardconfig.h"
-#include "../localplayer.h"
-#include "../map.h"
-#include "../monster.h"
-#include "../npc.h"
-#include "../textmanager.h"
-
-#include "../resources/monsterinfo.h"
-#include "../resources/resourcemanager.h"
-
-#include "../utils/stringutils.h"
+#include "gui/viewport.h"
+
+#include "gui/gui.h"
+#include "gui/ministatus.h"
+#include "gui/popupmenu.h"
+
+#include "beingmanager.h"
+#include "configuration.h"
+#include "flooritemmanager.h"
+#include "game.h"
+#include "graphics.h"
+#include "keyboardconfig.h"
+#include "localplayer.h"
+#include "map.h"
+#include "monster.h"
+#include "npc.h"
+#include "textmanager.h"
+
+#include "resources/monsterinfo.h"
+#include "resources/resourcemanager.h"
+
+#include "utils/stringutils.h"
extern volatile int tick_time;
@@ -94,7 +96,12 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
static int lastTick = tick_time;
if (!mMap || !player_node)
+ {
+ gcnGraphics->setColor(gcn::Color(64, 64, 64));
+ gcnGraphics->fillRectangle(
+ gcn::Rectangle(0, 0, getWidth(), getHeight()));
return;
+ }
Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
@@ -233,11 +240,11 @@ void Viewport::logic()
{
WindowContainer::logic();
+ Uint8 button = SDL_GetMouseState(&mMouseX, &mMouseY);
+
if (!mMap || !player_node)
return;
- Uint8 button = SDL_GetMouseState(&mMouseX, &mMouseY);
-
if (mPlayerFollowMouse && button & SDL_BUTTON(1) &&
#ifdef TMWSERV_SUPPORT
get_elapsed_time(mLocalWalkTime) >= walkingMouseDelay)