Rearranged code to check for netgame-closed flag and refuse-players flag so they are updated correctly if another part of the code changes the menu item without activating it

This commit is contained in:
zicodxx 2011-05-20 11:48:20 +02:00
parent b2bd51d870
commit 2f098796e0
3 changed files with 15 additions and 30 deletions

View file

@ -3,6 +3,7 @@ D2X-Rebirth Changelog
20110520
--------
INSTALL.txt, RELEASE-NOTES.txt: Updated docs and fixed some typos
main/net_ipx.c, main/net_udp.c: Rearranged code to check for netgame-closed flag and refuse-players flag so they are updated correctly if another part of the code changes the menu item without activating it
20110519
--------

View file

@ -1056,7 +1056,6 @@ net_ipx_disconnect_player(int playernum)
void
net_ipx_new_player(IPX_sequence_packet *their)
{
int objnum;
int pnum;
uint server;
@ -1065,8 +1064,6 @@ net_ipx_new_player(IPX_sequence_packet *their)
Assert(pnum >= 0);
Assert(pnum < MaxNumNetPlayers);
objnum = Players[pnum].objnum;
if (Newdemo_state == ND_STATE_RECORDING) {
int new_player;
@ -2886,9 +2883,6 @@ int net_ipx_game_param_handler( newmenu *menu, d_event *event, param_opt *opt )
Netgame.levelnum = atoi(slevel);
}
if (citem == opt->refuse)
Netgame.RefusePlayers=menus[opt->refuse].value;
if (citem == opt->maxnet)
{
sprintf( menus[opt->maxnet].text, "Maximum players: %d", menus[opt->maxnet].value+2 );
@ -2924,13 +2918,11 @@ int net_ipx_game_param_handler( newmenu *menu, d_event *event, param_opt *opt )
else Int3(); // Invalid mode -- see Rob
}
if (citem == opt->closed)
{
if (menus[opt->closed].value)
Netgame.game_flags |= NETGAME_FLAG_CLOSED;
else
Netgame.game_flags &= ~NETGAME_FLAG_CLOSED;
}
if (menus[opt->closed].value)
Netgame.game_flags |= NETGAME_FLAG_CLOSED;
else
Netgame.game_flags &= ~NETGAME_FLAG_CLOSED;
Netgame.RefusePlayers=menus[opt->refuse].value;
break;
case EVENT_NEWMENU_SELECTED:
@ -4339,6 +4331,7 @@ void net_ipx_send_data( ubyte * ptr, int len, int urgent )
Int3();
}
Assert(check == ptr[0]);
(void)check;
}
Assert(MySyncPack.data_size+len <= NET_XDATA_SIZE);
@ -4491,7 +4484,7 @@ void net_ipx_do_frame(int force, int listen)
}
else // If long packets
{
int send_data_size, i;
int i;
MySyncPack.numpackets = Players[0].n_packets_sent++;
MySyncPack.type = PID_PDATA;
@ -4504,9 +4497,6 @@ void net_ipx_do_frame(int force, int listen)
MySyncPack.phys_velocity = Objects[objnum].mtype.phys_info.velocity;
MySyncPack.phys_rotvel = Objects[objnum].mtype.phys_info.rotvel;
send_data_size = MySyncPack.data_size; // do this so correct size data is sent
// ipxdrvSendGamePacket((ubyte*)&MySyncPack, sizeof(IPX_frame_info) - MaxXDataSize + send_data_size);
for(i=0; i<N_players; i++)
{
if(Players[i].connected && (i != Player_num))

View file

@ -460,6 +460,7 @@ int udp_tracker_process_game( ubyte *data, int data_len )
// Get the IPv6 flag from the tracker
bIPv6 = data[iPos++];
(void)bIPv6; // currently unused
// Get the IP
sIP = (char *)&data[iPos];
@ -1268,7 +1269,6 @@ net_udp_disconnect_player(int playernum)
void
net_udp_new_player(UDP_sequence_packet *their)
{
int objnum;
int pnum;
pnum = their->player.connected;
@ -1276,8 +1276,6 @@ net_udp_new_player(UDP_sequence_packet *their)
Assert(pnum >= 0);
Assert(pnum < MaxNumNetPlayers);
objnum = Players[pnum].objnum;
if (Newdemo_state == ND_STATE_RECORDING) {
int new_player;
@ -3181,9 +3179,6 @@ int net_udp_game_param_handler( newmenu *menu, d_event *event, param_opt *opt )
Netgame.levelnum = atoi(slevel);
}
if (citem == opt->refuse)
Netgame.RefusePlayers=menus[opt->refuse].value;
if (citem == opt->maxnet)
{
sprintf( menus[opt->maxnet].text, "Maximum players: %d", menus[opt->maxnet].value+2 );
@ -3221,13 +3216,11 @@ int net_udp_game_param_handler( newmenu *menu, d_event *event, param_opt *opt )
else Int3(); // Invalid mode -- see Rob
}
if (citem == opt->closed)
{
if (menus[opt->closed].value)
Netgame.game_flags |= NETGAME_FLAG_CLOSED;
else
Netgame.game_flags &= ~NETGAME_FLAG_CLOSED;
}
if (menus[opt->closed].value)
Netgame.game_flags |= NETGAME_FLAG_CLOSED;
else
Netgame.game_flags &= ~NETGAME_FLAG_CLOSED;
Netgame.RefusePlayers=menus[opt->refuse].value;
break;
case EVENT_NEWMENU_SELECTED:
@ -4148,6 +4141,7 @@ void net_udp_send_data( ubyte * ptr, int len, int priority )
if (UDP_MData.mbuf_size != 0)
Int3();
Assert(check == ptr[0]);
(void)check;
}
Assert(UDP_MData.mbuf_size+len <= UPID_MDATA_BUF_SIZE);