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
Collidable Class Reference

#include <collide_map.h>

Inheritance diagram for Collidable:
CollideArray::CollidableBackref

Classes

union  CollideRef
 

Public Member Functions

QVector GetPosition () const
 
void SetPosition (const QVector &bpos)
 
Collidableoperator* ()
 
Collidableoperator-> ()
 
double getKey () const
 
bool operator< (const Collidable &other) const
 
Collidableget ()
 
 Collidable ()
 
 Collidable (Unit *un)
 
 Collidable (unsigned int bolt_index, float speed, const QVector &p)
 

Public Attributes

QVector position
 
float radius
 
union Collidable::CollideRef ref
 

Detailed Description

Definition at line 13 of file collide_map.h.

Constructor & Destructor Documentation

Collidable::Collidable ( )
inline

Definition at line 63 of file collide_map.h.

References f.

63  : radius(
64 #if defined (_WIN32) || __GNUC__ != 2
65  std::numeric_limits< float >::quiet_NaN()
66 #else
67  1.0f/1024.0f/1024.0f/1024.0f
68 #endif
69  ) {}
Collidable::Collidable ( Unit un)

Definition at line 247 of file collide_map.cpp.

References FINITE, Unit::isSubUnit(), Unit::LocalPosition(), radius, ref, Unit::rSize(), SetPosition(), and Collidable::CollideRef::unit.

248 {
249  radius = un->rSize();
250  if ( radius <= FLT_MIN || !FINITE( radius ) ) radius = 2*FLT_MIN;
251  assert( !un->isSubUnit() );
252  this->SetPosition( un->LocalPosition() );
253  ref.unit = un;
254 }
Collidable::Collidable ( unsigned int  bolt_index,
float  speed,
const QVector p 
)
inline

Definition at line 71 of file collide_map.h.

References Collidable::CollideRef::bolt_index, FINITE, ISNAN, radius, ref, SetPosition(), and SIMULATION_ATOM.

72  {
73  ref.bolt_index = bolt_index;
75  if (
76 #ifdef __APPLE__
77  !FINITE( radius )
78 #else
79  ISNAN( radius )
80 #endif
81  || radius >= -FLT_MIN) radius = -FLT_MIN*2;
82  this->SetPosition( p );
83  }

Member Function Documentation

Collidable& Collidable::get ( )
inline

Definition at line 59 of file collide_map.h.

60  {
61  return *this;
62  }
QVector Collidable::GetPosition ( ) const
inline

Definition at line 25 of file collide_map.h.

References position.

Referenced by CollideChecker< T, canbebolt >::ApartPositive(), and beamCheckCollision().

26  {
27  return position;
28  }
Collidable& Collidable::operator* ( )
inline

Definition at line 42 of file collide_map.h.

43  {
44  return *this;
45  }
Collidable* Collidable::operator-> ( )
inline

Definition at line 46 of file collide_map.h.

47  {
48  return this;
49  }
bool Collidable::operator< ( const Collidable other) const
inline

Definition at line 55 of file collide_map.h.

References getKey().

56  {
57  return getKey() < other.getKey();
58  }
void Collidable::SetPosition ( const QVector bpos)
inline

Definition at line 29 of file collide_map.h.

References FINITE, getKey(), ISNAN, position, and QVector.

Referenced by Collidable(), and Bolt::Update().

30  {
31  //in case we want to drop in an xtra radius parameter when we get performance testing
32  this->position = bpos;
33 #ifdef __APPLE__
34  if ( !FINITE( getKey() ) )
35  position = QVector( 0, 0, 0 ); //hack for now
36 
37 #else
38  if ( ISNAN( getKey() ) )
39  position = QVector( 0, 0, 0 ); //hack for now
40 #endif
41  }

Member Data Documentation

QVector Collidable::position

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