packet id generator changed we count it now just up

origin
stpohle 23 years ago
parent 73bc3fb537
commit 0b5f365f20

@ -558,13 +558,13 @@ net_game_send_playermove (int p_nr, int mustsend)
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)
pl->net.pkgopt.send_to--;
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--;
}
};

@ -10,6 +10,10 @@
extern _point debug_field;
extern int debug_lastping;
static short int pkg_lastid; /* the packet id, this will only counted
up nothing more.. if we are at 0x10000
we will start at 0 */
struct _resend_cache resend_cache;
struct _inpkg_index inpkg_index[PKG_IN_INDEX_NUM];
int inpkg_index_pos = 0;
@ -908,9 +912,10 @@ inpkg_check (unsigned char typ, short int id, _net_addr * addr)
/* find packet */
for (i = 0, pos = -1; (i < PKG_IN_INDEX_NUM && pos == -1); i++)
if (inpkg_index[i].pl_nr == addr->pl_nr &&
inpkg_index[i].typ == typ && inpkg_index[i].id == id)
inpkg_index[i].typ == typ && inpkg_index[i].id == id) {
printf ("typ: %d, id: %d\n", typ, id);
pos = i;
}
if (pos == -1) {
/* packet unknown ... add to index */
if (++inpkg_index_pos >= PKG_IN_INDEX_NUM)
@ -929,7 +934,7 @@ inpkg_check (unsigned char typ, short int id, _net_addr * addr)
void
send_pkg (struct pkg *packet, _net_addr * addr)
{
packet->h.id = s_random (256);
packet->h.id = pkg_lastid++;
if (bman.net_ai_family != PF_INET)
packet->h.flags = packet->h.flags | PKGF_ipv6;
udp_send (bman.sock, (char *) packet, packet->h.len, &addr->sAddr, bman.net_ai_family);

@ -257,7 +257,7 @@ move_player ()
/* network packet send control - send data if it's time to send or if we need to */
if (bman.gametype != GT_single)
net_game_send_playermove (bman.p_nr, p->old_m == 0);
net_game_send_playermove (bman.p_nr, (p->old_m == 0));
}
/* the player just stopt moving so send data */

Loading…
Cancel
Save