A little code snippet from detecting where supressing fire could be put on. This could of course be done using thousands of traceline, but this'd for sure cause lags.
Code:
// look if we can see some of the nearby waypoints to the enemy
g_Map.m_Waypoints.setDistanceMask(&BFNearEnemy,1,350,p->m_VOrigin);
// dont take the waypoints which are less than 250 units away
g_Map.m_Waypoints.setDistanceMask(&BFNotNearBot,1,250,m_pBot->getOrigin());
BFNotNearBot.negate();
// take only visible waypoints from here
g_Map.m_Waypoints.setVisibleMask(&BFVis,m_pBot->m_iNearestWP);
BFNearEnemy &= BFVis; // everything that's near to the enemy and visible to us
//g_Map.m_Waypoints.broadenMask(&BFNearEnemy);
BFNearEnemy &= BFNotNearBot; // everything that's far enough from me
long lShootAt = BFNearEnemy.getSet(); // get the first suitable waypoint ... randomizing this would be fine too
or to search a waypoint suitable for guarding the bomb
Code:
g_Map.m_Waypoints.setVisibleMask(&BFBVisible,iNearBomb);
g_Map.m_Waypoints.setVisibleMask(&BFPVisible,m_pBot->m_iNearestWP);
g_Map.m_Waypoints.setDistanceMask(&BFBNear,1,450,pGoal->m_pPerceipt->m_VOrigin);
// search only the waypoint which are visible to the bomb and to the bot
// if you would just search the best waypoint in the view of the bomb,
// you would have sometimes more than one bot near a waypoint, this way
// they may guard the bomb from more than one side
BFBVisible &= BFPVisible;
BFBVisible &= BFBNear;
// search the waypoint with the least visible waypoints around
// only those which are marked in the bitfield
iDestination = g_Map.m_Waypoints.getMaximum(&BFBVisible,CWaypointGraph::WG_SEARCH_AVDISTVWP,-1);