diff --git a/src/client/component/input.cpp b/src/client/component/input.cpp index 7cdbd1c..632686c 100644 --- a/src/client/component/input.cpp +++ b/src/client/component/input.cpp @@ -1,6 +1,5 @@ #include #include "loader/component_loader.hpp" - #include "game/game.hpp" #include "game_console.hpp" diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index b78ebb0..803a548 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -277,7 +277,7 @@ namespace party int server_client_count() { - return party::sv_maxclients; + return sv_maxclients; } class component final : public component_interface @@ -584,7 +584,7 @@ namespace party } const auto sv_running = info.get("sv_running"); - if (sv_running.empty() || sv_running == "0"s) + if (sv_running != "1"s) { const auto* error_msg = "Server not running."; console::error("%s\n", error_msg); diff --git a/src/client/component/server_list.cpp b/src/client/component/server_list.cpp index c536693..1b64cc8 100644 --- a/src/client/component/server_list.cpp +++ b/src/client/component/server_list.cpp @@ -1,11 +1,12 @@ #include #include "loader/component_loader.hpp" +#include "game/game.hpp" + #include "server_list.hpp" #include "localized_strings.hpp" #include "network.hpp" #include "scheduler.hpp" #include "party.hpp" -#include "game/game.hpp" #include #include @@ -157,7 +158,7 @@ namespace server_list void sort_serverlist() { - std::stable_sort(servers.begin(), servers.end(), [](const server_info& a, const server_info& b) + std::ranges::stable_sort(servers, [](const server_info& a, const server_info& b) { if (a.clients == b.clients) { @@ -310,21 +311,21 @@ namespace server_list void handle_info_response(const game::netadr_s& address, const utils::info_string& info) { // Don't show servers that aren't dedicated! - const auto dedicated = std::atoi(info.get("dedicated").data()); - if (!dedicated) + const auto dedicated = info.get("dedicated"); + if (dedicated != "1"s) { return; } // Don't show servers that aren't running! - const auto sv_running = std::atoi(info.get("sv_running").data()); - if (!sv_running) + const auto sv_running = info.get("sv_running"); + if (sv_running != "1"s) { return; } // Only handle servers of the same playmode! - const auto playmode = game::CodPlayMode(std::atoi(info.get("playmode").data())); + const auto playmode = static_cast(std::atoi(info.get("playmode").data())); if (game::Com_GetCurrentCoDPlayMode() != playmode) { return; @@ -352,9 +353,9 @@ namespace server_list server.map_name = game::UI_GetMapDisplayName(info.get("mapname").data()); server.game_type = game::UI_GetGameTypeDisplayName(info.get("gametype").data()); server.play_mode = playmode; - server.clients = atoi(info.get("clients").data()); - server.max_clients = atoi(info.get("sv_maxclients").data()); - server.bots = atoi(info.get("bots").data()); + server.clients = std::atoi(info.get("clients").data()); + server.max_clients = std::atoi(info.get("sv_maxclients").data()); + server.bots = std::atoi(info.get("bots").data()); server.ping = std::min(now - start_time, 999); server.in_game = 1; diff --git a/src/client/component/server_list.hpp b/src/client/component/server_list.hpp index 18936b9..09f62b2 100644 --- a/src/client/component/server_list.hpp +++ b/src/client/component/server_list.hpp @@ -1,6 +1,4 @@ #pragma once - -#include "game/game.hpp" #include namespace server_list