Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UnitWithinRangeLocator< T > Class Template Reference

#include <unit_find.h>

Inheritance diagram for UnitWithinRangeLocator< T >:
UnitWithinRangeOfPosition< T >

Public Member Functions

 UnitWithinRangeLocator (float radius, float maxUnitRadius)
 
bool UnitsOnly ()
 
bool BoltsOrUnits ()
 
bool NeedDistance ()
 
void init (CollideMap *cm, CollideMap::iterator parent)
 
bool cullless (CollideMap::iterator tless)
 
bool cullmore (CollideMap::iterator tmore)
 
bool acquire (float dist, CollideMap::iterator i)
 

Public Attributes

action
 
double startkey
 
float radius
 
float maxUnitRadius
 

Detailed Description

template<class T>
class UnitWithinRangeLocator< T >

Definition at line 194 of file unit_find.h.

Constructor & Destructor Documentation

template<class T >
UnitWithinRangeLocator< T >::UnitWithinRangeLocator ( float  radius,
float  maxUnitRadius 
)
inline

Definition at line 201 of file unit_find.h.

201  :
202  startkey( 0 )
203  , radius( radius )

Member Function Documentation

template<class T >
bool UnitWithinRangeLocator< T >::acquire ( float  dist,
CollideMap::iterator  i 
)
inline

Definition at line 233 of file unit_find.h.

References UnitWithinRangeLocator< T >::action, and UnitWithinRangeLocator< T >::radius.

234  {
235  if (dist < radius)
236  //Inside radius...
237  return action.acquire( (*i)->ref.unit, dist );
238  return true;
239  }
template<class T >
bool UnitWithinRangeLocator< T >::BoltsOrUnits ( )
inline

Definition at line 210 of file unit_find.h.

211  {
212  return false;
213  }
template<class T >
bool UnitWithinRangeLocator< T >::cullless ( CollideMap::iterator  tless)
inline

Definition at line 223 of file unit_find.h.

References UnitWithinRangeLocator< T >::maxUnitRadius, UnitWithinRangeLocator< T >::radius, and UnitWithinRangeLocator< T >::startkey.

224  {
225  double tmp = startkey-radius-maxUnitRadius;
226  return tmp > (*tless)->getKey();
227  }
template<class T >
bool UnitWithinRangeLocator< T >::cullmore ( CollideMap::iterator  tmore)
inline

Definition at line 228 of file unit_find.h.

References UnitWithinRangeLocator< T >::maxUnitRadius, UnitWithinRangeLocator< T >::radius, and UnitWithinRangeLocator< T >::startkey.

229  {
230  return startkey+radius+maxUnitRadius < (*tmore)->getKey();
231  }
template<class T >
void UnitWithinRangeLocator< T >::init ( CollideMap cm,
CollideMap::iterator  parent 
)
inline

Definition at line 219 of file unit_find.h.

References UnitWithinRangeLocator< T >::startkey.

220  {
221  startkey = (*parent)->getKey();
222  }
template<class T >
bool UnitWithinRangeLocator< T >::NeedDistance ( )
inline

Definition at line 214 of file unit_find.h.

215  {
216  return true;
217  }
template<class T >
bool UnitWithinRangeLocator< T >::UnitsOnly ( )
inline

Definition at line 206 of file unit_find.h.

207  {
208  return true;
209  }

Member Data Documentation

template<class T >
T UnitWithinRangeLocator< T >::action

Definition at line 197 of file unit_find.h.

Referenced by UnitWithinRangeLocator< T >::acquire(), and GameStarSystem::Draw().

template<class T >
float UnitWithinRangeLocator< T >::maxUnitRadius

The documentation for this class was generated from the following file: