network problem with player who got on client side reborn fixed. do_playerdata and do_playerid fixed

origin
stpohle 21 years ago
parent 100c634f44
commit a98791b800

@ -1,14 +1,23 @@
$Id: ChangeLog,v 1.102 2005/04/08 00:18:24 stpohle Exp $ $Id: ChangeLog,v 1.103 2005/04/11 22:21:11 stpohle Exp $
Version 0.11.6.2
- Client network player could die two times in a game.
After receiving the playerdata packet from a client did the
server first the player_set_gfx routine first. Which send a
playerid packet with a alife player back.
Changed: player_set_gfx routine will be called after setting
the state of a player.
Also do_playerid will check if the game is not running
or the player is still alife to set this value.
- Dedicated server support (only testing).
- Fixed do_quit and send_quit.
- Fixed number of players in running games was always
set to 0.
Version 0.11.6.1 Version 0.11.6.1
================
- Display the number of players for each listed network game. - Display the number of players for each listed network game.
- Ghost Player added. - Ghost Player added.
- Playername will not overlapped by the player gfx anymore. - Playername will not overlapped by the player gfx anymore.
- Added menuswitch to enable/disable broadcast requests. - Added menuswitch to enable/disable broadcast requests.

@ -309,8 +309,8 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
int i; int i;
d_printf d_printf
("do_playerid (From:%s:%s pl_nr=%d) Player(name:%s [%s:%s], pl_nr:%d)\n", ("do_playerid (From:%s:%s pl_nr=%d) Player(name:%s [%s:%s], pl_nr:%d state:%d,%d)\n",
addr->host, addr->port, addr->pl_nr, p_id->name, p_id->host, p_id->port, p_id->pl_nr); addr->host, addr->port, addr->pl_nr, p_id->name, p_id->host, p_id->port, p_id->pl_nr, p_id->state, PS_IS_alife (p_id->state));
/* /*
* check if we have to send the whole playerlist to a client * check if we have to send the whole playerlist to a client
@ -373,7 +373,13 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
* work around for some hardware routers */ * work around for some hardware routers */
send_contest (&players[bman.p_servnr].net.addr, bman.p_nr, -1, 1); send_contest (&players[bman.p_servnr].net.addr, bman.p_nr, -1, 1);
} }
/* to make sure that in games the client won't reborn without a reason */
if (bman.state != GS_running || PS_IS_alife (pl->state) == 1)
pl->state = p_id->state; pl->state = p_id->state;
else
pl->state = p_id->state & (0xFF - PSF_alife);
if (p_id->pl_nr != bman.p_nr && PS_IS_used (pl->state)) if (p_id->pl_nr != bman.p_nr && PS_IS_used (pl->state))
pl->state |= PSF_net; pl->state |= PSF_net;
else else
@ -827,11 +833,10 @@ do_playerdata (struct pkg_playerdata *p_dat, _net_addr * addr)
if (p_dat->p_nr < 0 || p_dat->p_nr >= MAX_PLAYERS) if (p_dat->p_nr < 0 || p_dat->p_nr >= MAX_PLAYERS)
return; return;
d_printf ("do_playerdata (From: %d) p_nr: %d\n", addr->pl_nr, p_dat->p_nr); printf ("do_playerdata (From: %d) p_nr: %d --> state alife? %d new %d\n", addr->pl_nr, p_dat->p_nr, PS_IS_alife(players[p_dat->p_nr].state) , PS_IS_alife(p_dat->state));
bman.updatestatusbar = 1; // force an update bman.updatestatusbar = 1; // force an update
pl = &players[p_dat->p_nr]; pl = &players[p_dat->p_nr];
player_set_gfx (pl, p_dat->gfx_nr);
if (bman.state == GS_running && bman.p_nr != p_dat->p_nr) { if (bman.state == GS_running && bman.p_nr != p_dat->p_nr) {
pl->points = NTOH16 (p_dat->points); pl->points = NTOH16 (p_dat->points);
@ -885,6 +890,8 @@ do_playerdata (struct pkg_playerdata *p_dat, _net_addr * addr)
if (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; players[bman.p_nr].net.net_status = p_dat->p_nr;
player_set_gfx (pl, p_dat->gfx_nr);
} }

@ -1,4 +1,4 @@
/* $Id: player.c,v 1.100 2005/04/09 18:22:41 stpohle Exp $ /* $Id: player.c,v 1.101 2005/04/11 22:21:14 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>
@ -551,7 +551,7 @@ player_died (_player * player, signed char dead_by, int network)
return; return;
// player die ! // player die !
d_printf ("player_died (%10s) current state: %d\n", player->name, player->state); d_printf ("player_died (pl_nr:%d : %10s) current state: %d\n", player - players, player->name, player->state);
bman.updatestatusbar = 1; // force an update bman.updatestatusbar = 1; // force an update
if (PS_IS_alife (player->state) && dead_by >= 0 && dead_by < MAX_PLAYERS) if (PS_IS_alife (player->state) && dead_by >= 0 && dead_by < MAX_PLAYERS)
@ -922,7 +922,7 @@ void player_checkdeath (int pnr) {
/* if the player is respawning check for finish of the animation /* if the player is respawning check for finish of the animation
* reset some data of the player and force update of the status bar */ * reset some data of the player and force update of the status bar */
if (PS_IS_respawn (player->state) && player->frame >= 2*gfx.respawn.frames) { if (bman.gametype == GT_deathmatch && PS_IS_respawn (player->state) && player->frame >= 2*gfx.respawn.frames) {
d_printf ("Respawn completed for player %s\n", player->name); d_printf ("Respawn completed for player %s\n", player->name);
player->frame = 0; player->frame = 0;
player->state &= (0xFF - PSF_respawn); player->state &= (0xFF - PSF_respawn);

Loading…
Cancel
Save