diff --git a/src/network.c b/src/network.c index 9dedca6..7d34025 100644 --- a/src/network.c +++ b/src/network.c @@ -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--; } }; diff --git a/src/packets.c b/src/packets.c index 7219af8..8116f9e 100644 --- a/src/packets.c +++ b/src/packets.c @@ -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); diff --git a/src/player.c b/src/player.c index d3cce5a..225c4fa 100644 --- a/src/player.c +++ b/src/player.c @@ -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 */