From f726b7033f606f62b8a4d6ab5c8d83e50a5ef96b Mon Sep 17 00:00:00 2001 From: stpohle Date: Sun, 1 Feb 2004 23:51:10 +0000 Subject: [PATCH] pkg_fwd fixed, send also the packet if the sender is behind a firewall, also do and send_playerid fixed changed protocol --- ChangeLog | 5 ++++- TODO | 5 ++--- include/packets.h | 1 + src/debug.c | 6 +++--- src/packets.c | 12 +++++++++--- src/player.c | 3 ++- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index b03ab82..9b3953a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,13 @@ -$Id: ChangeLog,v 1.63 2004/02/01 21:50:23 stpohle Exp $ +$Id: ChangeLog,v 1.64 2004/02/01 23:51:10 stpohle Exp $ - Fixed: forgot to put the Message F4 to start the game into the playerselection screen. I put this only into the Gamescreen right before the game starts. Added even the F4 Button into the Help Screen. +- Fixed: DropItems haven't been resetted on dropping items. + + Version 0.11.1 ============== diff --git a/TODO b/TODO index c951d26..8fd5c10 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ -$Id: TODO,v 1.37 2004/01/25 02:20:56 stpohle Exp $ +$Id: TODO,v 1.38 2004/02/01 23:51:10 stpohle Exp $ -* start settings for Speed, Ticking time of the bombs. - How many bombs and so on. +* major network bug with forwarded packets. - bug: which creates just some explosions on the field. diff --git a/include/packets.h b/include/packets.h index 200378c..9378631 100644 --- a/include/packets.h +++ b/include/packets.h @@ -151,6 +151,7 @@ struct pkg_playerid { signed char pl_nr; // Player Nummer signed char gfx_nr; // number of the graphic signed char state; + signed char netflags; // network flags Sint16 points; Sint16 wins; }; diff --git a/src/debug.c b/src/debug.c index ec644cf..b020534 100644 --- a/src/debug.c +++ b/src/debug.c @@ -36,11 +36,11 @@ void d_printf (char *fmt,...) { void d_playerdetail (char *head) { int i; - + d_printf ("---------------> %s\n", head); - d_printf ("Nr Name GFX Sta Pkt Win [Addr] FireWall\n"); + d_printf ("Nr Name GFX Sta Pkt Win [Addr] net_flag\n"); for (i = 0; i < MAX_PLAYERS; i++) - d_printf ("%2d %16s %3d %3d %3d %3d [%s:%s]\n",i, players[i].name, players[i].gfx_nr, players[i].state, players[i].points, players[i].wins, players[i].net.addr.host, players[i].net.addr.port, players[i].net.flags); + d_printf ("%2d %16s %3d %3d %3d %3d [%s:%s] %d\n",i, players[i].name, players[i].gfx_nr, players[i].state, players[i].points, players[i].wins, players[i].net.addr.host, players[i].net.addr.port, players[i].net.flags); }; diff --git a/src/packets.c b/src/packets.c index 8d76e5b..2c84b80 100644 --- a/src/packets.c +++ b/src/packets.c @@ -226,7 +226,7 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr) strncpy (pl->name, p_id->name, LEN_PLAYERNAME); pl->net.timestamp = timestamp; pl->net.pingreq = pl->net.pingack + 5; - + pl->net.flags = p_id->netflags; if (p_id->host[0] != 0) { pl->net.addr.pl_nr = addr->pl_nr; strncpy (pl->net.addr.host, p_id->host, LEN_SERVERNAME); @@ -290,6 +290,7 @@ send_playerid (_net_addr * addr, char *name, char *pladdr, char *plport, strncpy (p_id.port, plport, LEN_PORT); p_id.pl_nr = pl_nr; + p_id.netflags = netflags; p_id.gfx_nr = gfx_nr; if (pl_nr != -1) { p_id.points = HTON16 (players[pl_nr].points); @@ -1443,12 +1444,17 @@ fwd_pkg (struct pkg *packet, _net_addr * addr) if (GT_MP_PTPS) /* clients don't forward anything */ return; - if (packet->h.typ <= PKG_quit) + if (packet->h.typ <= PKG_quit) { for (pl = 0; pl < MAX_PLAYERS; pl++) if ((!PS_IS_aiplayer (players[pl].state)) && PS_IS_netplayer (players[pl].state) - && (players[addr->pl_nr].net.flags & NETF_firewall) == NETF_firewall + && ((players[addr->pl_nr].net.flags & NETF_firewall) == NETF_firewall + || (players[pl].net.flags & NETF_firewall) == NETF_firewall) && pl != addr->pl_nr) send_pkg (packet, &players[pl].net.addr); + } + else + d_fatal ("fwd_pkg: not forwarding unknown packet From Player:%d (%s) Typ:%d Len:%d\n", + addr->pl_nr, players[addr->pl_nr].name, packet->h.typ, NTOH16 (packet->h.len)); }; diff --git a/src/player.c b/src/player.c index e10e5ab..a722c2d 100644 --- a/src/player.c +++ b/src/player.c @@ -1,4 +1,4 @@ -/* $Id: player.c,v 1.76 2004/02/01 17:29:35 stpohle Exp $ +/* $Id: player.c,v 1.77 2004/02/01 23:51:11 stpohle Exp $ * player.c - everything what have to do with the player */ #include @@ -902,6 +902,7 @@ void player_checkdeath (int pnr) { player->speed = bman.start_speed; player->bombs_n = bman.start_bombs; player->range = bman.start_range; + player->collect_shoes = 0; for (i = 0; i < PI_max; i++) player->ill[i].to = 0.0f; }