Improved hanlding for closing sockets - doing via closing of Game_wind when available or in specific multi menus; Also handling GM_GAME_OVER setting over Game_wind closing as well if apprpriate - cleaner and helps to cleanup multi when mission is over
This commit is contained in:
parent
4c63f57aac
commit
9dbd8ad144
|
@ -3,6 +3,7 @@ D1X-Rebirth Changelog
|
|||
20100708
|
||||
--------
|
||||
main/net_udp.c, main/net_udp.h: Reworked handling of Netlist now also showing full game info; Prevent Clients from sending lite_info; Make lite_info show numconnected instead of numplayers as this would show disconnected ones as well; Removed reusing ports on different instances in Windows build - only screws up several games running on one machine
|
||||
main/game.c, main/gameseq.c, main/multi.c, main/net_udp.c, main/net_ipx.c: Improved hanlding for closing sockets - doing via closing of Game_wind when available or in specific multi menus; Also handling GM_GAME_OVER setting over Game_wind closing as well if apprpriate - cleaner and helps to cleanup multi when mission is over
|
||||
|
||||
20100705
|
||||
--------
|
||||
|
|
|
@ -1106,6 +1106,7 @@ int game_handler(window *wind, d_event *event, void *data)
|
|||
|
||||
clear_warn_func(game_show_warning); //don't use this func anymore
|
||||
game_disable_cheats();
|
||||
Game_mode = GM_GAME_OVER;
|
||||
show_menus();
|
||||
Game_wind = NULL;
|
||||
return 0; // continue closing
|
||||
|
|
|
@ -436,7 +436,6 @@ void DoGameOver()
|
|||
#endif
|
||||
scores_maybe_add_player(0);
|
||||
|
||||
Game_mode = GM_GAME_OVER;
|
||||
if (Game_wind)
|
||||
window_close(Game_wind); // Exit out of game loop
|
||||
}
|
||||
|
@ -991,8 +990,6 @@ int AdvanceLevel(int secret_flag)
|
|||
|
||||
do_end_briefing_screens(Ending_text_filename);
|
||||
|
||||
Game_mode = GM_GAME_OVER;
|
||||
|
||||
return 1;
|
||||
|
||||
} else {
|
||||
|
|
|
@ -807,8 +807,6 @@ multi_leave_game(void)
|
|||
}
|
||||
}
|
||||
|
||||
Game_mode |= GM_GAME_OVER;
|
||||
|
||||
plyr_save_stats();
|
||||
}
|
||||
|
||||
|
|
|
@ -3248,9 +3248,11 @@ int net_ipx_join_poll( newmenu *menu, d_event *event, void *menu_text )
|
|||
case EVENT_WINDOW_CLOSE:
|
||||
d_free(menu_text);
|
||||
d_free(menus);
|
||||
ipxdrv_close();
|
||||
if (!Game_wind)
|
||||
{
|
||||
ipxdrv_close();
|
||||
Network_status = NETSTAT_MENU; // they cancelled
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3405,10 +3407,10 @@ net_ipx_level_sync(void)
|
|||
{
|
||||
Players[Player_num].connected = CONNECT_DISCONNECTED;
|
||||
net_ipx_send_endlevel_packet();
|
||||
ipxdrv_close();
|
||||
if (Game_wind)
|
||||
window_close(Game_wind);
|
||||
show_menus();
|
||||
ipxdrv_close();
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
|
@ -3535,7 +3537,6 @@ void net_ipx_leave_game()
|
|||
Players[Player_num].connected = CONNECT_DISCONNECTED;
|
||||
net_ipx_send_endlevel_packet();
|
||||
change_playernum_to(0);
|
||||
Game_mode = GM_GAME_OVER;
|
||||
net_ipx_flush();
|
||||
ipxdrv_close();
|
||||
}
|
||||
|
|
|
@ -446,6 +446,8 @@ static int manual_join_game_handler(newmenu *menu, d_event *event, direct_join *
|
|||
}
|
||||
|
||||
case EVENT_WINDOW_CLOSE:
|
||||
if (!Game_wind) // they cancelled
|
||||
net_udp_close();
|
||||
d_free(dj);
|
||||
break;
|
||||
|
||||
|
@ -460,7 +462,7 @@ void net_udp_manual_join_game()
|
|||
{
|
||||
direct_join *dj;
|
||||
newmenu_item m[7];
|
||||
int nitems = 0, i = 0;
|
||||
int nitems = 0;
|
||||
|
||||
MALLOC(dj, direct_join, 1);
|
||||
if (!dj)
|
||||
|
@ -494,9 +496,7 @@ void net_udp_manual_join_game()
|
|||
m[nitems].type = NM_TYPE_INPUT; m[nitems].text=UDP_MyPort; m[nitems].text_len=5; nitems++;
|
||||
m[nitems].type = NM_TYPE_TEXT; m[nitems].text=blank; nitems++; // for connecting_txt
|
||||
|
||||
i = newmenu_do1( NULL, "ENTER GAME ADDRESS", nitems, m, (int (*)(newmenu *, d_event *, void *))manual_join_game_handler, dj, 0 );
|
||||
if (i != -2)
|
||||
net_udp_close();
|
||||
newmenu_do1( NULL, "ENTER GAME ADDRESS", nitems, m, (int (*)(newmenu *, d_event *, void *))manual_join_game_handler, dj, 0 );
|
||||
}
|
||||
|
||||
static char *ljtext = "";
|
||||
|
@ -583,9 +583,11 @@ int net_udp_list_join_poll( newmenu *menu, d_event *event, direct_join *dj )
|
|||
d_free(ljtext);
|
||||
d_free(menus);
|
||||
d_free(dj);
|
||||
net_udp_close();
|
||||
if (!Game_wind)
|
||||
{
|
||||
net_udp_close();
|
||||
Network_status = NETSTAT_MENU; // they cancelled
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -983,7 +985,6 @@ net_udp_disconnect_player(int playernum)
|
|||
multi_quit_game = 1;
|
||||
game_leave_menus();
|
||||
multi_reset_stuff();
|
||||
net_udp_close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3592,10 +3593,10 @@ net_udp_level_sync(void)
|
|||
{
|
||||
Players[Player_num].connected = CONNECT_DISCONNECTED;
|
||||
net_udp_send_endlevel_packet();
|
||||
net_udp_close();
|
||||
if (Game_wind)
|
||||
window_close(Game_wind);
|
||||
show_menus();
|
||||
net_udp_close();
|
||||
return -1;
|
||||
}
|
||||
return(0);
|
||||
|
@ -3659,7 +3660,6 @@ void net_udp_leave_game()
|
|||
Players[Player_num].connected = CONNECT_DISCONNECTED;
|
||||
net_udp_send_endlevel_packet();
|
||||
change_playernum_to(0);
|
||||
Game_mode = GM_GAME_OVER;
|
||||
net_udp_flush();
|
||||
net_udp_close();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue