fix game join conditions and messages

This commit is contained in:
Martin Michelsen
2022-03-07 20:21:10 -08:00
parent 951b6085ab
commit e5bc59a896
2 changed files with 10 additions and 17 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ enum LobbyFlag {
Episode3 = 0x08, // lobby only Episode3 = 0x08, // lobby only
QuestInProgress = 0x10, // game only QuestInProgress = 0x10, // game only
JoinableQuestInProgress = 0x20, // game only JoinableQuestInProgress = 0x20, // game only
Default = 0x40, // lobby only; false for private lobbies Default = 0x40, // lobby only; not set for games and private lobbies
Persistent = 0x80, // if not set, lobby is deleted when empty Persistent = 0x80, // if not set, lobby is deleted when empty
}; };
+9 -16
View File
@@ -665,39 +665,32 @@ void process_menu_selection(shared_ptr<ServerState> s, shared_ptr<Client> c,
case GAME_MENU_ID: { case GAME_MENU_ID: {
auto game = s->find_lobby(cmd->item_id); auto game = s->find_lobby(cmd->item_id);
if (!game) { if (!game) {
send_message_box(c, u"$C6This game is no\nlonger active."); send_lobby_message_box(c, u"$C6You cannot join this\ngame because it no longer\nexists.");
break; break;
} }
if (!game->is_game()) { if (!game->is_game()) {
send_message_box(c, u"$C6This game is not\na game."); send_lobby_message_box(c, u"$C6You cannot join this\ngame because it is not\na game.");
break; break;
} }
if (game->count_clients() >= game->max_clients) { if (game->count_clients() >= game->max_clients) {
send_message_box(c, u"$C6This game is full."); send_lobby_message_box(c, u"$C6You cannot join this\ngame because it is full.");
break; break;
} }
if ((game->version != c->version) || if ((game->version != c->version) ||
(!(game->flags & LobbyFlag::Episode3) != !(c->flags & LobbyFlag::Episode3))) { (!(game->flags & LobbyFlag::Episode3) != !(c->flags & LobbyFlag::Episode3))) {
send_message_box(c, u"$C6This game is for\n a different version\nof PSO."); send_lobby_message_box(c, u"$C6You cannot join this\ngame because it is for\na different version\nof PSO.");
break; break;
} }
if (game->flags & LobbyFlag::QuestInProgress) {
if ((game->version != c->version) || send_lobby_message_box(c, u"$C6You cannot join this\ngame because a quest is\nalready in progress.");
(!(game->flags & LobbyFlag::Episode3) != !(c->flags & LobbyFlag::Episode3))) {
send_message_box(c, u"$C6A quest is in progress\nin this game.");
break; break;
} }
if (game->any_client_loading()) { if (game->any_client_loading()) {
send_message_box(c, u"$C6A player is currently\nloading."); send_lobby_message_box(c, u"$C6You cannot join this\ngame because another\nplayer is currently\nloading. Try again soon.");
break; break;
} }
if (game->mode == 3) {
if (game->any_client_loading()) { send_lobby_message_box(c, u"$C6You cannot join this\n game because it is a\nSolo Mode game.");
send_message_box(c, u"$C6You cannot join a\nSolo Mode game.");
break; break;
} }