|
|
@@ -505,7 +505,7 @@ void callback_submenu_lobby_pvp_choices(void *context, uint32_t index)
|
|
|
/* Handle other game lobbies
|
|
|
1. when clicked on, send request to fetch the selected game lobby details
|
|
|
2. start the websocket session
|
|
|
- 3. start the game thread (the rest will be handled by game_start and player_update)
|
|
|
+ 3. start the game thread (the rest will be handled by game_start_game and player_update)
|
|
|
*/
|
|
|
FlipWorldApp *app = (FlipWorldApp *)context;
|
|
|
furi_check(app, "FlipWorldApp is NULL");
|
|
|
@@ -570,11 +570,14 @@ void callback_submenu_lobby_pvp_choices(void *context, uint32_t index)
|
|
|
// check if the user is in the lobby
|
|
|
if (game_in_lobby(fhttp, lobby))
|
|
|
{
|
|
|
- FURI_LOG_I(TAG, "User is in the lobby");
|
|
|
- easy_flipper_dialog("Error", "You are already in the lobby. Press BACK to return.");
|
|
|
- flipper_http_free(fhttp);
|
|
|
- furi_string_free(lobby);
|
|
|
- return;
|
|
|
+ if (!game_remove_from_lobby(fhttp))
|
|
|
+ {
|
|
|
+ FURI_LOG_I(TAG, "User is in the lobby but failed to remove");
|
|
|
+ easy_flipper_dialog("Error", "You're already in the lobby.\nContact JBlanked.\n\nPress BACK to return.");
|
|
|
+ flipper_http_free(fhttp);
|
|
|
+ furi_string_free(lobby);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
// add the user to the lobby
|
|
|
if (!game_join_lobby(fhttp, lobby_list[lobby_index]))
|
|
|
@@ -600,11 +603,14 @@ void callback_submenu_lobby_pvp_choices(void *context, uint32_t index)
|
|
|
// check if the user is in the lobby
|
|
|
if (game_in_lobby(fhttp, lobby))
|
|
|
{
|
|
|
- FURI_LOG_I(TAG, "User is in the lobby");
|
|
|
- easy_flipper_dialog("Error", "You are already in the lobby. Press BACK to return.");
|
|
|
- flipper_http_free(fhttp);
|
|
|
- furi_string_free(lobby);
|
|
|
- return;
|
|
|
+ if (!game_remove_from_lobby(fhttp))
|
|
|
+ {
|
|
|
+ FURI_LOG_I(TAG, "User is in the lobby but failed to remove");
|
|
|
+ easy_flipper_dialog("Error", "You're already in the lobby.\nContact JBlanked.\n\nPress BACK to return.");
|
|
|
+ flipper_http_free(fhttp);
|
|
|
+ furi_string_free(lobby);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
// add the user to the lobby
|
|
|
if (!game_join_lobby(fhttp, lobby_list[lobby_index]))
|
|
|
@@ -617,6 +623,6 @@ void callback_submenu_lobby_pvp_choices(void *context, uint32_t index)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- game_start(fhttp, lobby, app); // this will free both the fhttp and lobby, and start the game
|
|
|
+ game_start_game(fhttp, lobby, app); // this will free both the fhttp and lobby, and start the game
|
|
|
}
|
|
|
}
|