about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/client/client.c5
-rw-r--r--src/engine/interface.h2
-rw-r--r--src/engine/network.c7
-rw-r--r--src/engine/network.h1
-rw-r--r--src/game/client/game_client.cpp8
5 files changed, 23 insertions, 0 deletions
diff --git a/src/engine/client/client.c b/src/engine/client/client.c
index da241a72..6e1e88d6 100644
--- a/src/engine/client/client.c
+++ b/src/engine/client/client.c
@@ -305,6 +305,11 @@ void client_rcon(const char *cmd)
 	client_send_msg();
 }
 
+int client_connection_problems()
+{
+	return netclient_gotproblems(net);
+}
+
 static void client_send_input()
 {
 	int64 now = time_get();	
diff --git a/src/engine/interface.h b/src/engine/interface.h
index 7b8dd2b5..5cd8d604 100644
--- a/src/engine/interface.h
+++ b/src/engine/interface.h
@@ -804,6 +804,7 @@ float client_localtime();
 int client_state();
 const char *client_error_string();
 int *client_get_input(int tick);
+int client_connection_problems();
 
 void client_connect(const char *address);
 void client_disconnect();
@@ -812,6 +813,7 @@ void client_entergame();
 
 void client_rcon(const char *cmd);
 
+
 void client_serverbrowse_refresh(int lan);
 
 SERVER_INFO *client_serverbrowse_sorted_get(int index);
diff --git a/src/engine/network.c b/src/engine/network.c
index 202151b2..85b4604f 100644
--- a/src/engine/network.c
+++ b/src/engine/network.c
@@ -919,6 +919,13 @@ int netclient_state(NETCLIENT *c)
 	return NETSTATE_CONNECTING;
 }
 
+int netclient_gotproblems(NETCLIENT *c)
+{
+	if(time_get() - c->conn.last_recv_time > time_freq())
+		return 1;
+	return 0;
+}
+
 void netclient_stats(NETCLIENT *c, NETSTATS *stats)
 {
 	*stats = c->conn.stats;
diff --git a/src/engine/network.h b/src/engine/network.h
index 3deddcc6..338c5982 100644
--- a/src/engine/network.h
+++ b/src/engine/network.h
@@ -59,6 +59,7 @@ int netclient_send(NETCLIENT *c, NETPACKET *packet);
 int netclient_close(NETCLIENT *c);
 int netclient_update(NETCLIENT *c);
 int netclient_state(NETCLIENT *c);
+int netclient_gotproblems(NETCLIENT *c);
 void netclient_stats(NETCLIENT *c, NETSTATS *stats);
 const char *netclient_error_string(NETCLIENT *c);
 
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp
index a461fdee..f1c8e49c 100644
--- a/src/game/client/game_client.cpp
+++ b/src/game/client/game_client.cpp
@@ -2762,6 +2762,14 @@ void render_game()
 			emoticon_selector_active = false;
 		}
 	}
+	
+	if(client_connection_problems())
+	{
+		gfx_mapscreen(0, 0, 400, 300);
+		const char *text = "Connection Problems...";
+		float w = gfx_pretty_text_width(24, text, -1);
+		gfx_pretty_text(200-w/2, 50, 24, text, -1);
+	}
 
 	// render score board
 	if(inp_key_pressed(KEY_TAB) || // user requested