Skip to content

Commit

Permalink
Multiplayer|UI|Client: Show package version error dialog when connecting
Browse files Browse the repository at this point in the history
If a multiplayer game cannot be joined because the server’s packages
are not available locally, an error dialog is opened.
  • Loading branch information
skyjake committed Nov 22, 2016
1 parent b695bb1 commit a101f1a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions doomsday/apps/client/src/network/serverlink.cpp
Expand Up @@ -282,7 +282,8 @@ DENG2_PIMPL(ServerLink)
dlg->title().setText(tr("Cannot Join Game"));
dlg->message().setText(msg);
dlg->buttons() << new DialogButtonItem(DialogWidget::Default | DialogWidget::Accept);
dlg->exec(ClientWindow::main().root());
ClientWindow::main().root().addOnTop(dlg);
dlg->open(MessageDialog::Modal);
}
};

Expand Down Expand Up @@ -327,10 +328,18 @@ void ServerLink::connectToServerAndChangeGame(shell::ServerInfo info)

if (!serverProfile->isPlayable())
{
auto prettyPkg = [] (String const &pkgId) -> String {
auto meta = Package::split(pkgId);
if (meta.second.isValid()) {
return String("%1 (version %2)").arg(meta.first).arg(meta.second.asText());
}
return pkgId;
};

String const errorMsg = QString("Server's game \"%1\" is not playable on this system. "
"The following packages are unavailable:\n\n%2")
.arg(info.gameId())
.arg(String::join(serverProfile->unavailablePackages(), "\n"));
.arg(String::join(de::map(serverProfile->unavailablePackages(), prettyPkg), "\n"));
LOG_NET_ERROR("Failed to join %s: ") << info.address() << errorMsg;
d->reportError(errorMsg);
return;
Expand Down

0 comments on commit a101f1a

Please sign in to comment.