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
unit_collide.h File Reference
#include "gfx/vec.h"
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <assert.h>
#include "linecollide.h"
#include "collection.h"
#include "cmd/unit_generic.h"
#include <set>

Go to the source code of this file.

Classes

class  UnitHash3d< CTSIZ, CTACCURACY, CTHUGE >
 
class  CollideTable
 
struct  collideTrees
 

Macros

#define SAFE_COLLIDE_DEBUG
 
#define COLLIDETABLESIZE   sizeof (CTSIZ)
 
#define COLLIDETABLEACCURACY   sizeof (CTACCURACY)
 
#define HUGEOBJECT   sizeof (CTHUGE)
 objects that go over 16 sectors are considered huge and better to check against everything. More...
 

Functions

void AddCollideQueue (LineCollide &, StarSystem *ss)
 
bool TableLocationChanged (const QVector &, const QVector &)
 
bool TableLocationChanged (const LineCollide &, const QVector &, const QVector &)
 
void KillCollideTable (LineCollide *lc, StarSystem *ss)
 
bool EradicateCollideTable (LineCollide *lc, StarSystem *ss)
 

Variables

const int tablehuge = 27
 
const int coltableacc = 128
 
const int coltablesize = 20
 
const unsigned int collideTreesMaxTrees = 16
 

Macro Definition Documentation

#define SAFE_COLLIDE_DEBUG

Definition at line 4 of file unit_collide.h.

Function Documentation

void AddCollideQueue ( LineCollide ,
StarSystem ss 
)

Definition at line 108 of file collide.cpp.

References CollideTable::c, StarSystem::collidetable, LineCollide::object, UnitHash3d< CTSIZ, CTACCURACY, CTHUGE >::Put(), LineCollide::type, and LineCollide::UNIT.

Referenced by Beam::UpdatePhysics().

109 {
110  if (tmp.type == LineCollide::UNIT)
111  ss->collidetable->c.Put( &tmp, tmp.object.u );
112  else
113  printf( "such collide types as %d not allowed", tmp.type );
114 }
bool EradicateCollideTable ( LineCollide lc,
StarSystem ss 
)

Definition at line 98 of file collide.cpp.

References CollideTable::c, StarSystem::collidetable, UnitHash3d< CTSIZ, CTACCURACY, CTHUGE >::Eradicate(), LineCollide::object, LineCollide::type, and LineCollide::UNIT.

99 {
100  if (lc->type == LineCollide::UNIT) {
101  return ss->collidetable->c.Eradicate( lc->object.u );
102  } else {
103  printf( "such collide types as %d not allowed", lc->type );
104  return false;
105  }
106 }
void KillCollideTable ( LineCollide lc,
StarSystem ss 
)

Definition at line 90 of file collide.cpp.

References CollideTable::c, StarSystem::collidetable, LineCollide::object, UnitHash3d< CTSIZ, CTACCURACY, CTHUGE >::Remove(), LineCollide::type, and LineCollide::UNIT.

91 {
92  if (lc->type == LineCollide::UNIT)
93  ss->collidetable->c.Remove( lc, lc->object.u );
94  else
95  printf( "such collide types as %d not allowed", lc->type );
96 }
bool TableLocationChanged ( const LineCollide ,
const QVector ,
const QVector  
)

Definition at line 85 of file collide.cpp.

References LineCollide::Maxi, LineCollide::Mini, and TableLocationChanged().

86 {
87  return TableLocationChanged( lc.Mini, minx ) || TableLocationChanged( lc.Maxi, maxx );
88 }

Variable Documentation

const unsigned int collideTreesMaxTrees = 16
const int coltableacc = 128

Definition at line 252 of file unit_collide.h.

Referenced by Beam::UpdatePhysics().

const int coltablesize = 20

Definition at line 253 of file unit_collide.h.

const int tablehuge = 27

Definition at line 251 of file unit_collide.h.

Referenced by Beam::UpdatePhysics().