Fixes for rev1148: Was too hasty with calling net_udp_close; Fixing typo in WSACleanup()

This commit is contained in:
zicodxx 2010-07-04 13:57:21 +00:00
parent 44d6e096d6
commit d87c4ab289
3 changed files with 10 additions and 8 deletions

View file

@ -5,6 +5,7 @@ D1X-Rebirth Changelog
main/net_udp.c: Fixed Compiler-warning on Windows
main/net_ipx.c, main/net_udp.c: Implemented Winsock functions for UDP which I totally forgot about; Now when leaving game in any way, close sockets and Winsock stuff
main/gameseq.c, main/multi.c: Since time is not suspended between levels in Multiplayer, call reset_time after level change. Apply this in Singleplayer, too since it should always be safe - and appropriate - to reset timer_value soon as a new level begins
main/net_udp.c: Fixes for rev1148: Was too hasty with calling net_udp_close; Fixing typo in WSACleanup()
20100701
--------

View file

@ -389,7 +389,7 @@ static int time_paused=0;
void stop_time()
{
if (time_paused==0) {
fix time;printf("STOP\n");
fix time;
time = timer_get_fixed_seconds();
last_timer_value = time - last_timer_value;
if (last_timer_value < 0) {
@ -404,7 +404,7 @@ void start_time()
time_paused--;
Assert(time_paused >= 0);
if (time_paused==0) {
fix time;printf("START\n");
fix time;
time = timer_get_fixed_seconds();
last_timer_value = time - last_timer_value;
}
@ -453,7 +453,7 @@ void FixedStepCalc()
}
void reset_time()
{printf("RESET\n");
{
last_timer_value = timer_get_fixed_seconds();
}

View file

@ -453,7 +453,6 @@ static int manual_join_game_handler(newmenu *menu, d_event *event, direct_join *
case EVENT_WINDOW_CLOSE:
d_free(dj);
net_udp_close();
break;
default:
@ -467,7 +466,7 @@ void net_udp_manual_join_game()
{
direct_join *dj;
newmenu_item m[7];
int nitems = 0;
int nitems = 0, i = 0;
MALLOC(dj, direct_join, 1);
if (!dj)
@ -501,7 +500,9 @@ 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
newmenu_do1( NULL, "ENTER GAME ADDRESS", nitems, m, (int (*)(newmenu *, d_event *, void *))manual_join_game_handler, dj, 0 );
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();
}
static int NLPage = 0;
@ -770,7 +771,7 @@ void net_udp_init()
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2, 0);
WSACleanUp();
WSACleanup();
if (WSAStartup( wVersionRequested, &wsaData))
nm_messagebox( TXT_ERROR, 1, TXT_OK, "Cannot init Winsock!"); // no break here... game will fail at socket creation anyways...
}
@ -805,7 +806,7 @@ void net_udp_init()
void net_udp_close()
{
#ifdef _WIN32
WSACleanUp();
WSACleanup();
#endif
if( UDP_Socket[0] != -1 )