fix: support for hardcore on the serverbrowser

This commit is contained in:
Jari van der Kaap 2023-04-11 00:27:21 +02:00
parent b047ac2272
commit d4f91ef3a6
3 changed files with 7 additions and 4 deletions

View File

@ -103,7 +103,7 @@ namespace getinfo
info.set("description",
game::is_server() ? game::get_dvar_string("live_steam_server_description") : "");
info.set("xuid", utils::string::va("%llX", steam::SteamUser()->GetSteamID().bits));
info.set("mapname", game::get_dvar_string("mapname"));
info.set("mapname", game::get_dvar_string("mapname"));
info.set("isPrivate", game::get_dvar_string("g_password").empty() ? "0" : "1");
info.set("clients", utils::string::va("%zu", get_client_count()));
info.set("bots", utils::string::va("%zu", get_bot_count()));
@ -112,7 +112,8 @@ namespace getinfo
info.set("playmode", utils::string::va("%i", game::Com_SessionMode_GetMode()));
info.set("gamemode", utils::string::va("%i", Com_SessionMode_GetGameMode()));
info.set("sv_running", utils::string::va("%i", game::is_server_running()));
info.set("dedicated", utils::string::va("%i", game::is_server() ? 1 : 0));
info.set("dedicated", utils::string::va("%i", game::is_server() ? 1 : 0));
info.set("hc", utils::string::va("%i", game::Com_GametypeSettings_GetUInt("hardcoremode", false)));
info.set("shortversion", SHORTVERSION);
network::send(target, "infoResponse", info.build(), '\n');

View File

@ -31,6 +31,7 @@ namespace game
WEAK symbol<void(const char* gametype, bool loadDefaultSettings)> Com_GametypeSettings_SetGametype{
0x1420F5980
};
WEAK symbol<unsigned int(const char* settingName, bool getDefault)> Com_GametypeSettings_GetUInt{0x1420F4E00, 0x1404FE5C0};
WEAK symbol<bool()> Com_IsRunningUILevel{0x142148350};
WEAK symbol<void(int localClientNum, eModes fromMode, eModes toMode, uint32_t flags)> Com_SwitchMode{
0x14214A4D0

View File

@ -55,9 +55,10 @@ namespace steam
const auto mode = game::eModes(std::atoi(playmode.data()));
const auto* tags = ::utils::string::va(
R"(\gametype\%s\dedicated\%s\ranked\false\hardcore\false\zombies\%s\modName\\playerCount\%d\bots\%d\)",
R"(\gametype\%s\dedicated\%s\ranked\false\hardcore\%s\zombies\%s\modName\\playerCount\%d\bots\%d\)",
info.get("gametype").data(),
info.get("dedicated") == "1" ? "true" : "false",
info.get("dedicated") == "1" ? "true" : "false",
info.get("hc") == "1" ? "true" : "false",
mode == game::MODE_ZOMBIES ? "true" : "false",
server.m_nPlayers, atoi(info.get("bots").data()));