From e04cafe44d592f228fe123c215f8aac1c8b06bbe Mon Sep 17 00:00:00 2001 From: stpohle Date: Tue, 6 Jan 2004 04:49:36 +0000 Subject: [PATCH] mapmenu and helpmenu in the multiplayer selection screen disapeared after a OGC message came in.. even browsing was cut of. Misstake found in file ogcache-client.c the loop started the browing again. wait_for_players is now handling the sym key of the keyboard. --- src/multiwait.c | 16 ++++++++-------- src/network.c | 4 ++-- src/ogcache-client.c | 6 +++--- src/packets.c | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/multiwait.c b/src/multiwait.c index f1bc3fc..ecb0e3f 100644 --- a/src/multiwait.c +++ b/src/multiwait.c @@ -307,7 +307,7 @@ wait_for_players () bman.state = GS_startup; } - if (keys[SDLK_F8] && event.type == SDL_KEYDOWN) { + if (event.key.keysym.sym == SDLK_F8 && event.type == SDL_KEYDOWN) { /* Switch Fullscreen */ SDL_WM_ToggleFullScreen(gfx.screen); gfx.fullscreen = !gfx.fullscreen; @@ -316,7 +316,7 @@ wait_for_players () if (bman.p_nr != -1) { - if (keys[SDLK_LEFT] && (!keypressed) && players[bman.p_nr].gfx_nr == -1) { + if (event.key.keysym.sym == SDLK_LEFT && event.type == SDL_KEYDOWN && (!keypressed) && players[bman.p_nr].gfx_nr == -1) { i = 0; while (selgfx < 0 || selgfx >= MAX_PLAYERS || i != -1) { selgfx--; @@ -326,7 +326,7 @@ wait_for_players () } } - if (keys[SDLK_RIGHT] && (!keypressed) && players[bman.p_nr].gfx_nr == -1) { + if (event.key.keysym.sym == SDLK_RIGHT && event.type == SDL_KEYDOWN && (!keypressed) && players[bman.p_nr].gfx_nr == -1) { i = 0; while (selgfx < 0 || selgfx >= MAX_PLAYERS || i != -1) { selgfx++; @@ -347,7 +347,7 @@ wait_for_players () } } - if ((keys[SDLK_LCTRL] || keys[SDLK_RCTRL]) && (!keypressed)) { + if ((event.key.keysym.sym == SDLK_LCTRL || event.key.keysym.sym == SDLK_RCTRL) && event.type == SDL_KEYDOWN && (!keypressed)) { if (players[bman.p_nr].gfx_nr == -1) /* select player */ players[bman.p_nr].gfx_nr = selgfx; @@ -359,12 +359,12 @@ wait_for_players () keypressed = 1; } - if ((GT_MP_PTPM) && ready && keys[SDLK_F4] && (!keypressed)) { + if ((GT_MP_PTPM) && ready && event.key.keysym.sym == SDLK_F4 && event.type == SDL_KEYDOWN && (!keypressed)) { done = 1; bman.updatestatusbar = 1; } - if (keys[SDLK_F2] && (!keypressed)) { + if (event.key.keysym.sym == SDLK_F2 && (!keypressed)) { /* Map modification or setting display */ if (GT_MP_PTPM) { mapmenu (); @@ -392,9 +392,9 @@ wait_for_players () bman.updatestatusbar = 1; } - if (keys[SDLK_F1] && (!keypressed)) /* open help screen */ + if (event.key.keysym.sym == SDLK_F1 && event.type == SDL_KEYDOWN && (!keypressed)) /* open help screen */ network_helpscreen (); - + chat_loop (&event); } diff --git a/src/network.c b/src/network.c index 01e9f1b..38dbc9c 100644 --- a/src/network.c +++ b/src/network.c @@ -1,4 +1,4 @@ -/* $Id: network.c,v 1.52 2004/01/04 03:22:49 stpohle Exp $ */ +/* $Id: network.c,v 1.53 2004/01/06 04:49:36 stpohle Exp $ */ /* network routines. */ @@ -408,7 +408,7 @@ net_transmit_gamedata () else net_istep = 3; - while (!done && bman.state == GS_update) { + while (!done && (bman.state == GS_update || (GT_MP_PTPS && net_istep != 0))) { /* the network thing */ network_loop (); diff --git a/src/ogcache-client.c b/src/ogcache-client.c index 87507e0..0330b40 100644 --- a/src/ogcache-client.c +++ b/src/ogcache-client.c @@ -1,4 +1,4 @@ -/* $Id: ogcache-client.c,v 1.2 2004/01/03 22:32:18 stpohle Exp $ +/* $Id: ogcache-client.c,v 1.3 2004/01/06 04:49:36 stpohle Exp $ * OpenGameCache-Client: this file will hold the protocol for the gameserver communication */ @@ -241,7 +241,7 @@ int ogc_loop () { if (ogc_sock <= 0) return -1; - + len = udp_get (ogc_sock, in, BUF_SIZE, &inaddr, ogc_ai_family); if (len > 0) { /* we have got something */ @@ -249,7 +249,7 @@ int ogc_loop () { i = ogc_do_inpacket (in, len, &inaddr); } - if ((time (NULL) - ogc_lasttimeout) > 30) + if (ogc_browsing && (time (NULL) - ogc_lasttimeout) > 30) ogc_browsestart (); return i; diff --git a/src/packets.c b/src/packets.c index 090ec36..0c9b138 100644 --- a/src/packets.c +++ b/src/packets.c @@ -619,7 +619,7 @@ do_playerdata (struct pkg_playerdata *p_dat, _net_addr * addr) if (bman.state == GS_update && PS_IS_used (p_dat->state)) bman.players_nr_s++; - if (bman.state == GS_update && players[bman.p_nr].net.net_istep == 1) + if (players[bman.p_nr].net.net_istep == 1) players[bman.p_nr].net.net_status = p_dat->p_nr; } @@ -990,7 +990,7 @@ do_fieldline (struct pkg_fieldline *f_dat, _net_addr * addr) return; } - if (bman.state == GS_update && players[bman.p_nr].net.net_istep == 2) + if (players[bman.p_nr].net.net_istep == 2) players[bman.p_nr].net.net_status = f_dat->line; for (i = 0; i < MAX_FIELDSIZE_X; i++) {