fix: crash due xash loadiing gamedll even without starting local game server

fix: zero out yb_think_fps_disable on xash when sys_ticrate > 100 (closes #677)
This commit is contained in:
jeefo 2025-03-03 21:58:35 +03:00
commit 2fb0419765
No known key found for this signature in database
GPG key ID: D696786B81B667C8
3 changed files with 23 additions and 3 deletions

View file

@ -2204,6 +2204,7 @@ BotControl::BotControl () {
m_ent = nullptr; m_ent = nullptr;
m_djump = nullptr; m_djump = nullptr;
m_denyCommands = true;
m_ignoreTranslate = false; m_ignoreTranslate = false;
m_isFromConsole = false; m_isFromConsole = false;
m_isMenuFillCommand = false; m_isMenuFillCommand = false;

View file

@ -628,7 +628,9 @@ void BotManager::kickEveryone (bool instant, bool zeroQuota) {
if (instant) { if (instant) {
for (const auto &bot : m_bots) { for (const auto &bot : m_bots) {
bot->kick (true); if (!game.isNullEntity (bot->ent ())) {
bot->kick (true);
}
} }
} }
m_addRequests.clear (); m_addRequests.clear ();
@ -2330,5 +2332,17 @@ bool BotManager::isFrameSkipDisabled () {
if (game.is (GameFlags::Legacy)) { if (game.is (GameFlags::Legacy)) {
return true; return true;
} }
return game.is (GameFlags::Xash3D) && cv_think_fps_disable;
if (game.is (GameFlags::Xash3D) && cv_think_fps_disable) {
static ConVarRef sys_ticrate ("sys_ticrate");
// ignore think_fps_disable if fps is more than 100 on xash dedicated server
if (game.isDedicated () && sys_ticrate.value () > 100.0f) {
cv_think_fps_disable.set (0);
return false;
}
return true;
}
return false;
} }

View file

@ -3449,6 +3449,11 @@ void Bot::findShortestPath (int srcIndex, int destIndex) {
void Bot::syncFindPath (int srcIndex, int destIndex, FindPath pathType) { void Bot::syncFindPath (int srcIndex, int destIndex, FindPath pathType) {
// this function finds a path from srcIndex to destIndex; // this function finds a path from srcIndex to destIndex;
// stale bots shouldn't do pathfinding
if (m_isStale) {
return;
}
if (!m_pathFindLock.tryLock ()) { if (!m_pathFindLock.tryLock ()) {
return; // allow only single instance of syncFindPath per-bot return; // allow only single instance of syncFindPath per-bot
} }
@ -3524,7 +3529,7 @@ void Bot::syncFindPath (int srcIndex, int destIndex, FindPath pathType) {
m_chosenGoalIndex = srcIndex; m_chosenGoalIndex = srcIndex;
m_goalValue = 0.0f; m_goalValue = 0.0f;
auto result = m_planner->find (m_team, srcIndex, destIndex, [this] (int index) { const auto result = m_planner->find (m_team, srcIndex, destIndex, [this] (int index) {
m_pathWalk.add (index); m_pathWalk.add (index);
return true; return true;
}); });