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

Public Member Functions

 UnitDrawer ()
 
bool acquire (Unit *unit, float distance)
 
void drawParents ()
 
bool draw (Unit *unit)
 
bool grav_acquire (Unit *unit)
 

Public Attributes

Unitparent
 
Unitparenttarget
 

Detailed Description

Definition at line 163 of file star_system.cpp.

Constructor & Destructor Documentation

UnitDrawer::UnitDrawer ( )
inline

Definition at line 170 of file star_system.cpp.

References parent, and parenttarget.

171  {
172  parent = NULL;
173  parenttarget = NULL;
174  }

Member Function Documentation

bool UnitDrawer::acquire ( Unit unit,
float  distance 
)
inline

Definition at line 175 of file star_system.cpp.

References draw().

176  {
177  if ( gravunits.find( unit ) == gravunits.end() )
178  return draw( unit );
179  else
180  return true;
181  }
bool UnitDrawer::draw ( Unit unit)
inline

Definition at line 202 of file star_system.cpp.

References _Universe, Universe::activeStarSystem(), calc_blend_factor(), Unit::cur_sim_queue_slot, StarSystem::getCurrentSimFrame(), interpolation_blend_factor, Unit::isSubUnit(), Unit::owner, parent, parenttarget, saved_interpolation_blend_factor, Unit::sim_atom_multiplier, and SIMULATION_ATOM.

Referenced by acquire(), GameStarSystem::Draw(), drawParents(), and grav_acquire().

203  {
204  if ( parent == unit || (parent && parent->isSubUnit() && parent->owner == unit) )
205  parent = NULL;
206  if ( parenttarget == unit || (parenttarget && parenttarget->isSubUnit() && parenttarget->owner == unit) )
207  parenttarget = NULL;
208  float backup = SIMULATION_ATOM;
209  unsigned int cur_sim_frame = _Universe->activeStarSystem()->getCurrentSimFrame();
211  unit->sim_atom_multiplier,
212  unit->cur_sim_queue_slot,
213  cur_sim_frame );
214  SIMULATION_ATOM = backup*unit->sim_atom_multiplier;
215  (/*(GameUnit< Unit >*)*/ unit)->Draw();
217  SIMULATION_ATOM = backup;
218  return true;
219  }
void UnitDrawer::drawParents ( )
inline

Definition at line 182 of file star_system.cpp.

References draw(), Unit::isSubUnit(), UnitUtil::owner(), parent, and parenttarget.

Referenced by GameStarSystem::Draw().

183  {
184  if (parent) {
185  if ( parent->isSubUnit() ) {
187  draw( parent );
188  } else {
189  draw( parent );
190  }
191  }
192  if (parenttarget) {
193  if ( parenttarget->isSubUnit() ) {
195  draw( parenttarget );
196  } else {
197  draw( parenttarget );
198  }
199  }
200  }
bool UnitDrawer::grav_acquire ( Unit unit)
inline

Definition at line 220 of file star_system.cpp.

References draw().

Referenced by GameStarSystem::Draw().

221  {
222  gravunits[unit] = empty();
223  return draw( unit );
224  }

Member Data Documentation

Unit* UnitDrawer::parent

Definition at line 168 of file star_system.cpp.

Referenced by GameStarSystem::Draw(), draw(), drawParents(), and UnitDrawer().

Unit* UnitDrawer::parenttarget

Definition at line 169 of file star_system.cpp.

Referenced by GameStarSystem::Draw(), draw(), drawParents(), and UnitDrawer().


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