Fixed m_looseBombArea assertion

This commit is contained in:
s1lentq 2024-01-31 18:33:34 +07:00
parent b34d564e3c
commit aec3ba2579
3 changed files with 7 additions and 1 deletions

View File

@ -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
{

View File

@ -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
{

View File

@ -503,6 +503,7 @@ public:
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: