pkg_fwd fixed, send also the packet if the sender is behind a firewall, also do and send_playerid fixed changed protocol

origin
stpohle 22 years ago
parent 175a40fb58
commit f726b7033f

@ -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 - Fixed: forgot to put the Message F4 to start the game
into the playerselection screen. I put this only into the into the playerselection screen. I put this only into the
Gamescreen right before the game starts. Added even the Gamescreen right before the game starts. Added even the
F4 Button into the Help Screen. F4 Button into the Help Screen.
- Fixed: DropItems haven't been resetted on dropping items.
Version 0.11.1 Version 0.11.1
============== ==============

@ -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. * major network bug with forwarded packets.
How many bombs and so on.
- bug: which creates just some explosions on the field. - bug: which creates just some explosions on the field.

@ -151,6 +151,7 @@ struct pkg_playerid {
signed char pl_nr; // Player Nummer signed char pl_nr; // Player Nummer
signed char gfx_nr; // number of the graphic signed char gfx_nr; // number of the graphic
signed char state; signed char state;
signed char netflags; // network flags
Sint16 points; Sint16 points;
Sint16 wins; Sint16 wins;
}; };

@ -36,11 +36,11 @@ void d_printf (char *fmt,...) {
void d_playerdetail (char *head) { void d_playerdetail (char *head) {
int i; int i;
d_printf ("---------------> %s\n", head); 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++) 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);
}; };

@ -226,7 +226,7 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
strncpy (pl->name, p_id->name, LEN_PLAYERNAME); strncpy (pl->name, p_id->name, LEN_PLAYERNAME);
pl->net.timestamp = timestamp; pl->net.timestamp = timestamp;
pl->net.pingreq = pl->net.pingack + 5; pl->net.pingreq = pl->net.pingack + 5;
pl->net.flags = p_id->netflags;
if (p_id->host[0] != 0) { if (p_id->host[0] != 0) {
pl->net.addr.pl_nr = addr->pl_nr; pl->net.addr.pl_nr = addr->pl_nr;
strncpy (pl->net.addr.host, p_id->host, LEN_SERVERNAME); 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); strncpy (p_id.port, plport, LEN_PORT);
p_id.pl_nr = pl_nr; p_id.pl_nr = pl_nr;
p_id.netflags = netflags;
p_id.gfx_nr = gfx_nr; p_id.gfx_nr = gfx_nr;
if (pl_nr != -1) { if (pl_nr != -1) {
p_id.points = HTON16 (players[pl_nr].points); 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 */ if (GT_MP_PTPS) /* clients don't forward anything */
return; return;
if (packet->h.typ <= PKG_quit) if (packet->h.typ <= PKG_quit) {
for (pl = 0; pl < MAX_PLAYERS; pl++) for (pl = 0; pl < MAX_PLAYERS; pl++)
if ((!PS_IS_aiplayer (players[pl].state)) && PS_IS_netplayer (players[pl].state) 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) && pl != addr->pl_nr)
send_pkg (packet, &players[pl].net.addr); 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));
}; };

@ -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 */ * player.c - everything what have to do with the player */
#include <SDL.h> #include <SDL.h>
@ -902,6 +902,7 @@ void player_checkdeath (int pnr) {
player->speed = bman.start_speed; player->speed = bman.start_speed;
player->bombs_n = bman.start_bombs; player->bombs_n = bman.start_bombs;
player->range = bman.start_range; player->range = bman.start_range;
player->collect_shoes = 0;
for (i = 0; i < PI_max; i++) for (i = 0; i < PI_max; i++)
player->ill[i].to = 0.0f; player->ill[i].to = 0.0f;
} }

Loading…
Cancel
Save