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
bolt_generic.cpp File Reference
#include <algorithm>
#include "bolt.h"
#include "gfxlib.h"
#include "gfx/mesh.h"
#include "gfxlib_struct.h"
#include <vector>
#include <string>
#include "unit_generic.h"
#include "audiolib.h"
#include "config_xml.h"

Go to the source code of this file.

Classes

class  UpdateBolt
 
class  UpdateBolts
 

Namespaces

 vsalg
 

Constant Groups

 vsalg
 

Functions

size_t nondecal_index (Collidable::CollideRef b)
 
template<typename IT , typename F >
void vsalg::for_each (IT start, IT end, F f)
 
void BoltDestroyGeneric (Bolt *whichbolt, unsigned int index, int decal, bool isBall)
 

Function Documentation

void BoltDestroyGeneric ( Bolt whichbolt,
unsigned int  index,
int  decal,
bool  isBall 
)

Definition at line 203 of file bolt_generic.cpp.

References _Universe, Universe::activeStarSystem(), bolt_draw::bolts, StarSystem::bolts, StarSystem::collidemap, CollideArray::erase(), index, q, Unit::UNIT_BOLT, CollideArray::UpdateBoltInfo(), VSFileSystem::vs_fprintf(), and VSDESTRUCT2.

Referenced by Bolt::Destroy().

204 {
207  vector< vector< Bolt > > *target;
208  if (!isBall)
209  target = &q->bolts;
210  else
211  target = &q->balls;
212  vector< Bolt > *vec = &(*target)[decal];
213  if (&(*vec)[index] == whichbolt) {
214  unsigned int tsize = vec->size();
216  cm->UpdateBoltInfo( vec->back().location, (*(*vec)[index].location)->ref );
217 
218  assert( index < tsize );
219  cm->erase( (*vec)[index].location );
220  if ( index+1 != vec->size() )
221  (*vec)[index] = vec->back(); //just a memcopy, yo
222  vec->pop_back(); //pop that back up
223  } else {
224  VSFileSystem::vs_fprintf( stderr, "Bolt Fault Nouveau! Not found in draw queue! No Chance to recover\n" );
225  fflush( stderr );
226  assert( 0 );
227  }
228 }
size_t nondecal_index ( Collidable::CollideRef  b)