Skip to content

Instantly share code, notes, and snippets.

@twist84
Created May 28, 2024 17:44
Show Gist options
  • Save twist84/423a62af8f40b48d2a46dcfa0e57a4f4 to your computer and use it in GitHub Desktop.
Save twist84/423a62af8f40b48d2a46dcfa0e57a4f4 to your computer and use it in GitHub Desktop.
bool __cdecl multiplayer_game_hopper_set_active_hopper_and_request_game_set(word hopper_identifier, bool a2, c_network_session_membership const* session_membership)
{
c_url_string game_set_url{};
c_hopper_configuration* hopper_configuration = multiplayer_game_hoppers_get_hopper_configuration(hopper_identifier);
if (!hopper_configuration && a2)
{
ASSERT(session_membership);
long hopper_configuration_index;
for (hopper_configuration_index = 0; hopper_configuration_index < g_multiplayer_game_hopper_globals.hopper_configuration_table.hopper_configuration_count; hopper_configuration_index++)
{
hopper_configuration = &g_multiplayer_game_hopper_globals.hopper_configuration_table.hopper_configurations[hopper_configuration_index];
if (multiplayer_game_hopper_is_hopper_visible(hopper_configuration->get_hopper_identifier(), session_membership))
break;
}
if (hopper_configuration_index == g_multiplayer_game_hopper_globals.hopper_configuration_table.hopper_configuration_count)
{
hopper_configuration = g_multiplayer_game_hopper_globals.hopper_configuration_table.hopper_configurations;
}
else if (g_multiplayer_game_hopper_globals.hopper_configuration_table.hopper_configuration_count == 0)
{
hopper_configuration = NULL;
}
}
if (hopper_configuration)
{
online_url_make_matchmaking_gameset(&game_set_url, hopper_configuration->get_hopper_identifier());
g_multiplayer_game_hopper_globals.game_set_downloader.set_url(&game_set_url);
g_multiplayer_game_hopper_globals.game_set_downloader.set_hash(hopper_configuration->game_set_hash());
}
else
{
game_set_url.clear();
g_multiplayer_game_hopper_globals.game_set_downloader.set_url(&game_set_url);
g_multiplayer_game_hopper_globals.game_set_downloader.set_hash(NULL);
}
g_multiplayer_game_hopper_globals.game_set_downloader.update();
g_multiplayer_game_hopper_globals.current_hopper_configuration = hopper_configuration;
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment