Merge branch 'ms-update-alert-fix' into 'master'

Master Server Update alert fix

See merge request STJr/SRB2!333
This commit is contained in:
Monster Iestyn 2018-11-22 13:34:43 -05:00
commit 37c0e646e4
2 changed files with 25 additions and 3 deletions

View file

@ -6048,7 +6048,7 @@ void M_SortServerList(void)
#ifndef NONET #ifndef NONET
#ifdef UPDATE_ALERT #ifdef UPDATE_ALERT
static int M_CheckMODVersion(void) static boolean M_CheckMODVersion(void)
{ {
char updatestring[500]; char updatestring[500];
const char *updatecheck = GetMODVersion(); const char *updatecheck = GetMODVersion();

View file

@ -557,9 +557,21 @@ const char *GetMODVersion(void)
msg.room = MODID; // Might as well use it for something. msg.room = MODID; // Might as well use it for something.
sprintf(msg.buffer,"%d",MODVERSION); sprintf(msg.buffer,"%d",MODVERSION);
if (MS_Write(&msg) < 0) if (MS_Write(&msg) < 0)
{
CONS_Alert(CONS_ERROR, M_GetText("Could not send to the Master Server\n"));
M_StartMessage(M_GetText("Could not send to the Master Server\n"), NULL, MM_NOTHING);
CloseConnection();
return NULL; return NULL;
}
if (MS_Read(&msg) < 0)
{
CONS_Alert(CONS_ERROR, M_GetText("No reply from the Master Server\n"));
M_StartMessage(M_GetText("No reply from the Master Server\n"), NULL, MM_NOTHING);
CloseConnection();
return NULL;
}
MS_Read(&msg);
CloseConnection(); CloseConnection();
if(strcmp(msg.buffer,"NULL") != 0) if(strcmp(msg.buffer,"NULL") != 0)
@ -587,9 +599,19 @@ void GetMODVersion_Console(void)
msg.room = MODID; // Might as well use it for something. msg.room = MODID; // Might as well use it for something.
sprintf(msg.buffer,"%d",MODVERSION); sprintf(msg.buffer,"%d",MODVERSION);
if (MS_Write(&msg) < 0) if (MS_Write(&msg) < 0)
{
CONS_Alert(CONS_ERROR, M_GetText("Could not send to the Master Server\n"));
CloseConnection();
return; return;
}
if (MS_Read(&msg) < 0)
{
CONS_Alert(CONS_ERROR, M_GetText("No reply from the Master Server\n"));
CloseConnection();
return;
}
MS_Read(&msg);
CloseConnection(); CloseConnection();
if(strcmp(msg.buffer,"NULL") != 0) if(strcmp(msg.buffer,"NULL") != 0)