Skip to content

Commit

Permalink
Fixed crash bot when can see a loose bomb but didn't get closest area…
Browse files Browse the repository at this point in the history
… for bomb
  • Loading branch information
s1lentq committed Dec 31, 2023
1 parent 991573f commit d3c0ec8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions regamedll/dlls/bot/cs_bot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,7 @@ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
if (bomb)
{
m_looseBombArea = TheNavAreaGrid.GetNearestNavArea(&bomb->pev->origin);
DbgAssert(m_looseBombArea); // TODO: Need investigation and find out why it cannot find nearest area for a lost bomb, just catch it
}
else
{
Expand Down
9 changes: 7 additions & 2 deletions regamedll/dlls/bot/states/cs_bot_hunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,15 @@ void HuntState::OnUpdate(CCSBot *me)
{
if (!me->IsRogue() && me->CanSeeLooseBomb())
{
CNavArea *looseBombArea = TheCSBots()->GetLooseBombArea();

// if we are near the loose bomb and can see it, hide nearby and guard it
me->SetTask(CCSBot::GUARD_LOOSE_BOMB);
me->Hide(TheCSBots()->GetLooseBombArea());
me->GetChatter()->AnnouncePlan("GoingToGuardLooseBomb", TheCSBots()->GetLooseBombArea()->GetPlace());
me->Hide(looseBombArea);

if (looseBombArea)
me->GetChatter()->AnnouncePlan("GoingToGuardLooseBomb", looseBombArea->GetPlace());

return;
}
else if (TheCSBots()->IsBombPlanted())
Expand Down

0 comments on commit d3c0ec8

Please sign in to comment.