about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-08-30 09:16:29 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-08-30 09:16:29 +0000
commit9672fe674f6335318cf11855299679f9d94a619b (patch)
tree09470e4c0ad819ce02f96f277eadbe93aedf4e97
parent2e2d31ccc359228f0031b9fa507b33f8ba935722 (diff)
downloadzcatch-9672fe674f6335318cf11855299679f9d94a619b.tar.gz
zcatch-9672fe674f6335318cf11855299679f9d94a619b.zip
fixed so you can disconnect and reconnet without crashing
-rw-r--r--src/game/client/component.hpp3
-rw-r--r--src/game/client/components/maplayers.cpp4
-rw-r--r--src/game/client/components/motd.cpp1
3 files changed, 5 insertions, 3 deletions
diff --git a/src/game/client/component.hpp b/src/game/client/component.hpp
index 7955f845..8ba4a52b 100644
--- a/src/game/client/component.hpp
+++ b/src/game/client/component.hpp
@@ -7,9 +7,10 @@ class GAMECLIENT;
 
 class COMPONENT
 {
+protected:
+	GAMECLIENT *client;
 public:
 	~COMPONENT() {}
-	GAMECLIENT *client;
 	
 	virtual void on_statechange(int new_state, int old_state) {};
 	virtual void on_init() {};
diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp
index 8ed6264b..1c72a200 100644
--- a/src/game/client/components/maplayers.cpp
+++ b/src/game/client/components/maplayers.cpp
@@ -27,7 +27,6 @@ static void mapscreen_to_group(float center_x, float center_y, MAPITEM_GROUP *gr
 	gfx_mapscreen(points[0], points[1], points[2], points[3]);
 }
 
-
 static void envelope_eval(float time_offset, int env, float *channels)
 {
 	channels[0] = 0;
@@ -56,6 +55,9 @@ static void envelope_eval(float time_offset, int env, float *channels)
 
 void MAPLAYERS::on_render()
 {
+	if(client_state() != CLIENTSTATE_ONLINE)
+		return;
+	
 	vec2 center = gameclient.camera->center;
 	//float center_x = gameclient.camera->center.x;
 	//float center_y = gameclient.camera->center.y;
diff --git a/src/game/client/components/motd.cpp b/src/game/client/components/motd.cpp
index 9e1013b6..e5dfb507 100644
--- a/src/game/client/components/motd.cpp
+++ b/src/game/client/components/motd.cpp
@@ -4,7 +4,6 @@
 #include <game/generated/gc_data.hpp>
 
 #include <game/client/gameclient.hpp>
-//#include <game/client/gc_anim.hpp>
 #include <game/client/gc_client.hpp>
 
 #include "motd.hpp"