fixed problems in the last network part change

origin
stpohle 23 years ago
parent a802f95cdc
commit 73bc3fb537

@ -82,9 +82,11 @@ game_draw_info ()
for (x = 0; x < bman.fieldsize.x; x++)
draw_stone (x, bman.fieldsize.y-1);
sprintf (text, "Net Option: ");
sprintf (text, "Net Option: [");
for (i = 0 ; i < MAX_PLAYERS; i++)
sprintf (text, " %3d ", bman.players[i].net.pkgopt.send_set);
sprintf (text, "%s%3d ", text, bman.players[i].net.pkgopt.send_set);
text[strlen(text)+1] = 0;
text[strlen(text)] = ']';
draw_text (0, gfx.res.y - gfx.font.size.y, text, 1);
gfx_AddUpdateRect (0, gfx.res.y - gfx.font.size.y, gfx.res.x, gfx.font.size.y);

@ -549,15 +549,24 @@ net_game_send_player (int p_nr)
void
net_game_send_playermove (int p_nr)
net_game_send_playermove (int p_nr, int mustsend)
{
int p;
_player *pl;
for (p = 0; p < MAX_PLAYERS; p++)
if (PS_IS_used (bman.players[p].state) && p != bman.p_nr)
send_playermove (&bman.players[p].net.addr, p_nr, &bman.players[p_nr]);
};
if (PS_IS_used (bman.players[p].state) && p != bman.p_nr) {
pl = &bman.players[p_nr];
if (pl->net.pkgopt.send_to == 0 || mustsend)
send_playermove (&bman.players[p].net.addr, p_nr, pl);
/* network packet send control */
if (pl->net.pkgopt.send_to <= 0 || pl->net.pkgopt.send_to > pl->net.pkgopt.send_set)
pl->net.pkgopt.send_to = pl->net.pkgopt.send_set;
pl->net.pkgopt.send_to--;
}
};
void
net_game_send_bomb (int p, int b)

@ -70,7 +70,7 @@ extern int network_loop ();
extern void net_change_playerid (int pl_nr, unsigned char senddata);
extern void net_new_gamedata ();
extern void net_game_send_player (int p_nr);
extern void net_game_send_playermove (int p_nr);
extern void net_game_send_playermove (int p_nr, int mustsend);
extern void net_game_send_bomb (int p, int b);
extern void net_game_send_field (int x, int y);
extern void net_game_fillsockaddr ();

@ -256,18 +256,13 @@ move_player ()
}
/* network packet send control - send data if it's time to send or if we need to */
if (bman.gametype != GT_single && (p->net.pkgopt.send_to == 0 || p->old_m == 0))
net_game_send_playermove (bman.p_nr);
/* network packet send control */
if (p->net.pkgopt.send_to <= 0 || p->net.pkgopt.send_to > p->net.pkgopt.send_set)
p->net.pkgopt.send_to = p->net.pkgopt.send_set;
p->net.pkgopt.send_to--;
if (bman.gametype != GT_single)
net_game_send_playermove (bman.p_nr, p->old_m == 0);
}
/* the player just stopt moving so send data */
if (bman.gametype != GT_single && p->m == 0 && p->old_m != 0)
net_game_send_playermove (bman.p_nr);
net_game_send_playermove (bman.p_nr, 1);
p->old_m = p->m; // save the old state
p->m = 0;

Loading…
Cancel
Save