|
|
@ -85,6 +85,9 @@ do_joingame (struct pkg_joingame *p_jg, _net_addr * addr) {
|
|
|
|
vsu;
|
|
|
|
vsu;
|
|
|
|
char text[255];
|
|
|
|
char text[255];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d_printf
|
|
|
|
|
|
|
|
("do_joingame (From:%s:%s Player(name:%s)\n", addr->host, addr->port, p_jg->name);
|
|
|
|
|
|
|
|
|
|
|
|
sscanf (VERSION, "%d.%d.%d", &vma, &vmi, &vsu);
|
|
|
|
sscanf (VERSION, "%d.%d.%d", &vma, &vmi, &vsu);
|
|
|
|
|
|
|
|
|
|
|
|
if (p_jg->ver_sub != vsu || p_jg->ver_major != vma || p_jg->ver_minor != vmi) {
|
|
|
|
if (p_jg->ver_sub != vsu || p_jg->ver_major != vma || p_jg->ver_minor != vmi) {
|
|
|
@ -98,9 +101,6 @@ do_joingame (struct pkg_joingame *p_jg, _net_addr * addr) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
d_printf
|
|
|
|
|
|
|
|
("do_joingame (From:%s:%s Player(name:%s)\n", addr->host, addr->port, p_jg->name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* find a free place for the player and add the player to the game*/
|
|
|
|
/* find a free place for the player and add the player to the game*/
|
|
|
|
if ((addr->pl_nr == -1) && GS_WAITRUNNING && GT_MP_PTPM) {
|
|
|
|
if ((addr->pl_nr == -1) && GS_WAITRUNNING && GT_MP_PTPM) {
|
|
|
|
/* find free player slot */
|
|
|
|
/* find free player slot */
|
|
|
@ -598,10 +598,8 @@ do_playerdata (struct pkg_playerdata *p_dat, _net_addr * addr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* set the state of the player */
|
|
|
|
/* set the state of the player */
|
|
|
|
if (p_dat->p_nr != bman.p_nr && PS_IS_used (pl->state)) {
|
|
|
|
if (p_dat->p_nr != bman.p_nr && PS_IS_used (pl->state))
|
|
|
|
pl->state |= PSF_net;
|
|
|
|
pl->state |= PSF_net;
|
|
|
|
pl->state &= (0xff - PSF_ai);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
pl->state &= (0xff - PSF_net);
|
|
|
|
pl->state &= (0xff - PSF_net);
|
|
|
|
|
|
|
|
|
|
|
@ -631,8 +629,10 @@ do_ill (struct pkg_ill *ill, _net_addr * addr)
|
|
|
|
if (ill->pl_nr < 0 || ill->pl_nr >= MAX_PLAYERS || ill->pl_nr == bman.p_nr)
|
|
|
|
if (ill->pl_nr < 0 || ill->pl_nr >= MAX_PLAYERS || ill->pl_nr == bman.p_nr)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < PI_max; i++)
|
|
|
|
for (i = 0; i < PI_max; i++) {
|
|
|
|
players[ill->pl_nr].ill[i].to = I16TOF (NTOH16 (ill->to[i]));
|
|
|
|
players[ill->pl_nr].ill[i].to = I32TOF (NTOH32 (ill->to[i]));
|
|
|
|
|
|
|
|
d_printf (" to[%d]:%f\n",i, players[ill->pl_nr].ill[i].to);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
@ -647,7 +647,7 @@ send_ill (_net_addr * addr, int p_nr, _player * pl)
|
|
|
|
|
|
|
|
|
|
|
|
ill.pl_nr = p_nr;
|
|
|
|
ill.pl_nr = p_nr;
|
|
|
|
for (i = 0; i < PI_max; i++)
|
|
|
|
for (i = 0; i < PI_max; i++)
|
|
|
|
ill.to[i] = HTON16 (FTOI16 (pl->ill[i].to));
|
|
|
|
ill.to[i] = HTON32 (FTOI32 (pl->ill[i].to));
|
|
|
|
|
|
|
|
|
|
|
|
send_pkg ((struct pkg *) &ill, addr);
|
|
|
|
send_pkg ((struct pkg *) &ill, addr);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -719,7 +719,7 @@ do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr)
|
|
|
|
if (b_dat->state == BS_off)
|
|
|
|
if (b_dat->state == BS_off)
|
|
|
|
return; // if there was a bomb let it explose don't delete the bomb
|
|
|
|
return; // if there was a bomb let it explose don't delete the bomb
|
|
|
|
|
|
|
|
|
|
|
|
d_printf ("do_bombdata [%d,%d] Player: %d Bomb: %d, ex_nr:%d\n",
|
|
|
|
d_printf ("do_bombdata [%f,%f] Player: %d Bomb: %d, ex_nr:%d\n",
|
|
|
|
I16TOF(NTOH16 (b_dat->x)), I16TOF(NTOH16 (b_dat->y)), b_dat->p_nr,
|
|
|
|
I16TOF(NTOH16 (b_dat->x)), I16TOF(NTOH16 (b_dat->y)), b_dat->p_nr,
|
|
|
|
b_dat->b_nr, NTOH32 (b_dat->ex_nr));
|
|
|
|
b_dat->b_nr, NTOH32 (b_dat->ex_nr));
|
|
|
|
|
|
|
|
|
|
|
@ -1079,6 +1079,9 @@ send_playerstatus (_net_addr * addr, int pl_nr, int net_istep, int status)
|
|
|
|
void
|
|
|
|
void
|
|
|
|
do_chat (struct pkg_chat *chat_pkg, _net_addr * addr)
|
|
|
|
do_chat (struct pkg_chat *chat_pkg, _net_addr * addr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
d_printf ("do_chat (%s:%s) %d Text:%s\n", addr->host,
|
|
|
|
|
|
|
|
addr->port, addr->pl_nr, chat_pkg->text);
|
|
|
|
|
|
|
|
|
|
|
|
chat_addline (chat_pkg->text);
|
|
|
|
chat_addline (chat_pkg->text);
|
|
|
|
|
|
|
|
|
|
|
|
if (GT_MP_PTPM && bman.notifygamemaster) /* send notification the the gamemaster */
|
|
|
|
if (GT_MP_PTPM && bman.notifygamemaster) /* send notification the the gamemaster */
|
|
|
@ -1337,7 +1340,7 @@ do_pkg (struct pkg *packet, _net_addr * addr)
|
|
|
|
if ((((packet->h.flags & PKGF_ipv6) == 0 && bman.net_ai_family != PF_INET)
|
|
|
|
if ((((packet->h.flags & PKGF_ipv6) == 0 && bman.net_ai_family != PF_INET)
|
|
|
|
|| ((packet->h.flags & PKGF_ipv6) != 0 && bman.net_ai_family == PF_INET))
|
|
|
|
|| ((packet->h.flags & PKGF_ipv6) != 0 && bman.net_ai_family == PF_INET))
|
|
|
|
&& packet->h.typ != PKG_bcmservchat) {
|
|
|
|
&& packet->h.typ != PKG_bcmservchat) {
|
|
|
|
d_printf ("-----packet comes from the wrong network type\n");
|
|
|
|
d_printf ("do_pkg: packet comes from the wrong network type\n");
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* get the addr and set the ping timeout value */
|
|
|
|
/* get the addr and set the ping timeout value */
|
|
|
@ -1352,7 +1355,7 @@ do_pkg (struct pkg *packet, _net_addr * addr)
|
|
|
|
/* check the packet with the index */
|
|
|
|
/* check the packet with the index */
|
|
|
|
if (packet->h.typ != PKG_bcmservchat && inpkg_check (packet->h.typ, NTOH16 (packet->h.id), addr) != -1) {
|
|
|
|
if (packet->h.typ != PKG_bcmservchat && inpkg_check (packet->h.typ, NTOH16 (packet->h.id), addr) != -1) {
|
|
|
|
/* we have got this packet already */
|
|
|
|
/* we have got this packet already */
|
|
|
|
d_printf ("-----packet ignored\n");
|
|
|
|
d_printf ("do_pkg: double packet ignoring\n");
|
|
|
|
if (addr->pl_nr >= 0 && addr->pl_nr < MAX_PLAYERS)
|
|
|
|
if (addr->pl_nr >= 0 && addr->pl_nr < MAX_PLAYERS)
|
|
|
|
players[addr->pl_nr].net.pkgopt.to_2sec++;
|
|
|
|
players[addr->pl_nr].net.pkgopt.to_2sec++;
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|