MP Lobby: fixed bugged behavior when double clicking game to join/observe
Previously it was always attempting to join.
This commit is contained in:
parent
e0fda9a0ff
commit
a1ad61fa9b
1 changed files with 29 additions and 11 deletions
|
@ -923,19 +923,37 @@ void mp_lobby::process_gamelist_diff(const config& data)
|
|||
|
||||
void mp_lobby::enter_game(const mp::game_info& game, JOIN_MODE mode)
|
||||
{
|
||||
const bool try_join = mode == DO_JOIN || (mode == DO_EITHER && game.can_join());
|
||||
switch(mode) {
|
||||
case DO_JOIN:
|
||||
if(!game.can_join()) {
|
||||
ERR_LB << "Attempted to join a game with no vacant slots" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case DO_OBSERVE:
|
||||
if(!game.can_observe()) {
|
||||
ERR_LB << "Attempted to observe a game with observers disabled" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case DO_EITHER:
|
||||
if(game.can_join()) {
|
||||
mode = DO_JOIN;
|
||||
} else if(game.can_observe()) {
|
||||
mode = DO_OBSERVE;
|
||||
} else {
|
||||
DBG_LB << "Cannot join or observe a game." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
const bool try_join = mode == DO_JOIN;
|
||||
const bool try_obsv = mode == DO_OBSERVE;
|
||||
|
||||
if(try_obsv && !game.can_observe()) {
|
||||
ERR_LB << "Attempted to observe a game with observers disabled" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(try_join && !game.can_join()) {
|
||||
ERR_LB << "Attempted to join a game with no vacant slots" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
window& window = *get_window();
|
||||
|
||||
// Prompt user to download this game's required addons if its requirements have not been met
|
||||
|
|
Loading…
Add table
Reference in a new issue