From 38e972dedac81e1e124b764cdb780d5b38bbf7d8 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 21 May 2025 12:12:15 +0200 Subject: [PATCH] CL_AbortConnection --- src/d_clisrv.c | 17 ++++++++--------- src/d_clisrv.h | 3 +++ src/d_netfil.c | 7 ++----- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e286e417e..d378f7bc9 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2307,7 +2307,7 @@ static void M_ConfirmConnect(event_t *ev) #endif } -static void AbortConnection(void) +void CL_AbortConnection(void) { #ifdef HAVE_CURL CURLAbortFile(); @@ -2320,7 +2320,6 @@ static void AbortConnection(void) cl_mode = CL_ABORTED; } - static boolean CL_FinishedFileList(void) { INT32 i; @@ -2333,7 +2332,7 @@ static boolean CL_FinishedFileList(void) } else if (i == 3) // too many files { - AbortConnection(); + CL_AbortConnection(); M_StartMessage(M_GetText( "You have too many WAD files loaded\n" "to add ones the server is using.\n" @@ -2344,7 +2343,7 @@ static boolean CL_FinishedFileList(void) } else if (i == 2) // cannot join for some reason { - AbortConnection(); + CL_AbortConnection(); M_StartMessage(M_GetText( "You have the wrong addons loaded.\n\n" "To play on this server, restart\n" @@ -2381,7 +2380,7 @@ static boolean CL_FinishedFileList(void) { if (!CL_CheckDownloadable()) // nope! { - AbortConnection(); + CL_AbortConnection(); M_StartMessage(M_GetText( "An error occured when trying to\n" "download missing addons.\n" @@ -2646,7 +2645,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic { CONS_Printf(M_GetText("Legacy downloader request packet failed.\n")); CONS_Printf(M_GetText("Network game synchronization aborted.\n")); - AbortConnection(); + CL_AbortConnection(); M_StartMessage(M_GetText( "The direct download encountered an error.\n" "See the logfile for more info.\n" @@ -2673,7 +2672,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic { CONS_Printf("%d minute wait time exceeded.\n", cv_connectawaittime.value); CONS_Printf(M_GetText("Network game synchronization aborted.\n")); - AbortConnection(); + CL_AbortConnection(); M_StartMessage(va( "%d minute wait time exceeded.\n" "You may retry connection.\n" @@ -2744,7 +2743,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED)) { CONS_Printf(M_GetText("Network game synchronization aborted.\n")); - AbortConnection(); + CL_AbortConnection(); return false; } @@ -3972,7 +3971,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) #ifdef DUMPCONSISTENCY if (msg == KICK_MSG_CON_FAIL) SV_SavedGame(); #endif - AbortConnection(); + CL_AbortConnection(); if (msg == KICK_MSG_CON_FAIL) M_StartMessage(M_GetText("Server closed connection\n(Synch failure)\nPress ESC\n"), NULL, MM_NOTHING); diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 6957804ad..d16f4d71f 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -634,6 +634,9 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason); void CL_QueryServerList(msg_server_t *list); void CL_UpdateServerList(void); void CL_TimeoutServerList(void); + +void CL_AbortConnection(void); + // Is there a game running boolean Playing(void); diff --git a/src/d_netfil.c b/src/d_netfil.c index 2c9c9f972..07401eb46 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1315,11 +1315,8 @@ void CURLPrepareFile(const char* url, int dfilenum) if (!curl_curfile->file) { - CONS_Alert(CONS_ERROR, "Download of %s failed! Check if you have write access to your download folder!\n", curl_curfile->filename); - CURLAbortFile(); - D_QuitNetGame(); - CL_Reset(); - D_StartTitle(); + CONS_Alert(CONS_ERROR, "Couldnt open %s for writing!\nAborting file download.\nCheck if you have write access to your download folder!\n", curl_curfile->filename); + CL_AbortConnection(); M_StartMessage(M_GetText( "An error occured when trying to\n" "download missing addons.\n"