Skip to content

Commit

Permalink
Fixed m_looseBombArea assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jan 31, 2024
1 parent b34d564 commit aec3ba2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion regamedll/dlls/bot/cs_bot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +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
DbgAssert(!TheNavAreaGrid.IsValid() || m_looseBombArea); // TODO: Need investigation and find out why it cannot find nearest area for a lost bomb, just catch it
}
else
{
Expand Down
5 changes: 5 additions & 0 deletions regamedll/game_shared/bot/nav_area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4674,6 +4674,11 @@ void CNavAreaGrid::RemoveNavArea(CNavArea *area)
m_areaCount--;
}

bool CNavAreaGrid::IsValid() const
{
return m_grid && m_areaCount > 0;
}

// Given a position, return the nav area that IsOverlapping and is *immediately* beneath it
CNavArea *CNavAreaGrid::GetNavArea(const Vector *pos, float beneathLimit) const
{
Expand Down
1 change: 1 addition & 0 deletions regamedll/game_shared/bot/nav_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ class CNavAreaGrid
CNavArea *GetNavAreaByID(unsigned int id) const;
CNavArea *GetNearestNavArea(const Vector *pos, bool anyZ = false) const;

bool IsValid() const;
Place GetPlace(const Vector *pos) const; // return radio chatter place for given coordinate

private:
Expand Down

0 comments on commit aec3ba2

Please sign in to comment.