Skip to content

Commit

Permalink
Client: Warn the user about a different game mode on server
Browse files Browse the repository at this point in the history
The servers discovered via Beacon are not being filtered, so display
a warning if the game is different.
  • Loading branch information
skyjake committed Mar 16, 2013
1 parent 4ed90ca commit 98b6892
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions doomsday/client/src/network/ui_mpi.cpp
Expand Up @@ -299,10 +299,9 @@ void MPIUpdateServerInfo(ui_object_t *)
return;

success =
(searchMode ==
SEARCH_MASTER ? N_MasterGet(lstit_found[lst_found.selection].data2,
&info) :
N_GetHostInfo(lstit_found[lst_found.selection].data2, &info));
(searchMode == SEARCH_MASTER?
N_MasterGet (lstit_found[lst_found.selection].data2, &info)
: N_GetHostInfo(lstit_found[lst_found.selection].data2, &info));

if(!success)
{
Expand Down Expand Up @@ -337,7 +336,13 @@ void MPIUpdateServerInfo(ui_object_t *)
"Errors may occur during game play.", info.loadedFilesCRC, myCrc);

// Show IWAD warning?
if(!(lst_found.count >= 1 && lst_found.selection >= 0 &&
if(strcmp(info.gameIdentityKey, Str_Text(App_CurrentGame().identityKey())))
{
UI_FlagGroup(ob_client, 5, UIF_DISABLED, false);
sprintf(str_sinfo.warning, "Different game in use (you have %s).",
Str_Text(App_CurrentGame().identityKey()));
}
else if(!(lst_found.count >= 1 && lst_found.selection >= 0 &&
lstit_found[lst_found.selection].data != -1 &&
lstit_found[lst_found.selection].data != (int) myCrc))
{
Expand Down Expand Up @@ -445,6 +450,13 @@ struct ServerDiscoveryObserver : DENG2_OBSERVES(ServerLink, DiscoveryUpdate)

static ServerDiscoveryObserver mpiDiscoveryObserver;

static bool isServerSuitable(serverinfo_t const *info)
{
return info->canJoin &&
info->version == DOOMSDAY_VERSION &&
!stricmp(info->gameIdentityKey, Str_Text(App_CurrentGame().identityKey()));
}

/*
* Fill the server list with the list of currently known servers.
*/
Expand Down Expand Up @@ -497,9 +509,7 @@ void MPIUpdateServerList(void)
N_MasterGet(i, &info);

// Is this suitable?
if(info.version != DOOMSDAY_VERSION ||
stricmp(info.gameIdentityKey, Str_Text(App_CurrentGame().identityKey())) ||
!info.canJoin)
if(!isServerSuitable(&info))
{
Con_Message("Server %s filtered out:", info.name);
Con_Message(" remote = %i, local = %i", info.version, DOOMSDAY_VERSION);
Expand Down

0 comments on commit 98b6892

Please sign in to comment.