From cf9d0cc84fc80a0f8bb8405befa8799568b2bbb1 Mon Sep 17 00:00:00 2001 From: jeefo Date: Mon, 4 Aug 2025 16:53:26 +0300 Subject: [PATCH] mgr: fix leader selection stuff (fix #624) Co-Authored-By: Max <161382234+dyspose@users.noreply.github.com> --- src/engine.cpp | 28 +++++++++++++++------------- src/manager.cpp | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/engine.cpp b/src/engine.cpp index 15a1919..751ac5b 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -796,43 +796,45 @@ bool Game::loadCSBinary () { return false; } - Array libs; + Array libs {}; // construct library suffix - String lib_suffix; + String libSuffix {}; + if (plat.android) { - lib_suffix += "_android"; + libSuffix += "_android"; } else if (plat.psvita) { - lib_suffix += "_psvita"; + libSuffix += "_psvita"; } if (plat.x64) { if (plat.arm) { - lib_suffix += "_arm64"; + libSuffix += "_arm64"; } else if (plat.ppc) { - lib_suffix += "_ppc64le"; + libSuffix += "_ppc64le"; } else { - lib_suffix += "_amd64"; + libSuffix += "_amd64"; } } else { if (plat.arm) { // don't want to put whole build.h logic from xash3d, just set whatever is supported by the YaPB if (plat.android) { - lib_suffix += "_armv7l"; + libSuffix += "_armv7l"; } else { - lib_suffix += "_armv7hf"; + libSuffix += "_armv7hf"; } } else if (!plat.nix && !plat.win && !plat.macos) { - lib_suffix += "_i386"; + libSuffix += "_i386"; } } - if (lib_suffix.empty ()) + if (libSuffix.empty ()) libs.insert (0, { "mp", "cs", "cs_i386" }); else { libs.insert (0, { "mp", "cs" }); + for (auto &lib: libs) { - lib += lib_suffix; + lib += libSuffix; } } @@ -852,7 +854,7 @@ bool Game::loadCSBinary () { // search the libraries inside game dlls directory for (const auto &lib : libs) { - String path; + String path {}; if (plat.android) { // this will be removed as soon as mod downloader will be implemented on engine side diff --git a/src/manager.cpp b/src/manager.cpp index 370de33..ff29ebc 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -464,7 +464,7 @@ void BotManager::maintainLeaders () { } // select leader each team somewhere in round start - if (m_timeRoundStart + 5.0f > game.time () && m_timeRoundStart + 10.0f < game.time ()) { + if (m_timeRoundStart + rg (1.5f, 3.0f) < game.time ()) { for (int team = 0; team < kGameTeamNum; ++team) { selectLeaders (team, false); }