Adding bot safety check

This commit is contained in:
Dustin Hendrickson
2025-05-26 15:08:32 -07:00
parent 894bc68f4e
commit 949226d203

View File

@@ -554,17 +554,26 @@ static void ProcessPendingLevelResets()
break; break;
Player* bot = it->bot; Player* bot = it->bot;
if (!bot || !bot->IsInWorld())
{
it = g_PendingLevelResets.erase(it);
continue;
}
int targetRange = it->targetRange; int targetRange = it->targetRange;
if (g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(bot)) if (g_IgnoreGuildBotsWithRealPlayers && BotInGuildWithRealPlayer(bot))
{ {
it = g_PendingLevelResets.erase(it); it = g_PendingLevelResets.erase(it);
continue; continue;
} }
if (g_IgnoreFriendListed && BotInFriendList(bot)) if (g_IgnoreFriendListed && BotInFriendList(bot))
{ {
it = g_PendingLevelResets.erase(it); it = g_PendingLevelResets.erase(it);
continue; continue;
} }
if (bot && bot->IsInWorld() && IsBotSafeForLevelReset(bot)) if (bot && bot->IsInWorld() && IsBotSafeForLevelReset(bot))
{ {
AdjustBotToRange(bot, targetRange, it->factionRanges); AdjustBotToRange(bot, targetRange, it->factionRanges);