diff --git a/lib/application_manager.rb b/lib/application_manager.rb index 508b813..0c9f0f7 100644 --- a/lib/application_manager.rb +++ b/lib/application_manager.rb @@ -249,9 +249,17 @@ class W3DHub return nil unless app_data - found_server = Store.server_list.select do |server| - server.game == app_id && server.channel == channel && !server.status.password && server.status.player_count < server.status.max_players - end&.first + server_options = Store.server_list.select do |server| + server.game == app_id && + server.channel == channel && + !server.status.password && + server.status.player_count < server.status.max_players + end + + # try to find server with lowest ping and matching version + found_server = server_options.find { |server| server.version == app_data[:installed_version] } + # try to find server with lowest ping and undefined version + found_server ||= server_options.find { |server| server.version == Api::ServerListServer::NO_OR_DEFAULT_VERSION } found_server ? found_server : nil end @@ -283,7 +291,7 @@ class W3DHub end end - def favorive(app_id, bool) + def favorite(app_id, bool) Store.settings[:favorites] ||= {} if bool diff --git a/lib/pages/games.rb b/lib/pages/games.rb index 32d9062..a445f66 100644 --- a/lib/pages/games.rb +++ b/lib/pages/games.rb @@ -369,7 +369,7 @@ class W3DHub flow(width: 1.0, height: 28, padding: 8) do para "Favorite", fill: true toggle_button checked: Store.application_manager.favorite?(game.id), height: 18, padding_top: 3, padding_right: 3, padding_bottom: 3, padding_left: 3 do |btn| - Store.application_manager.favorive(game.id, btn.value) + Store.application_manager.favorite(game.id, btn.value) Store.settings.save_settings populate_games_list