added connection problems sign

This commit is contained in:
Magnus Auvinen 2007-12-11 21:55:52 +00:00
parent 094a019149
commit 63e834c353
5 changed files with 23 additions and 0 deletions

View file

@ -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();

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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