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_factory.cpp File Reference
#include <config.h>
#include "unit_factory.h"
#include "unit.h"
#include "nebula.h"
#include "missile.h"
#include "enhancement.h"
#include "planet.h"
#include "asteroid.h"
#include "building.h"
#include "terrain.h"
#include "cont_terrain.h"

Go to the source code of this file.

Functions

std::string getMasterPartListUnitName ()
 
void KillDuplicateUnits (ObjSerial likeSerial)
 

Function Documentation

std::string getMasterPartListUnitName ( )

Definition at line 33 of file unit_factory.cpp.

References VegaConfig::getVariable(), and vs_config.

34 {
35  static std::string mpl = vs_config->getVariable( "data", "master_part_list", "master_part_list" );
36  return mpl;
37 }
void KillDuplicateUnits ( ObjSerial  likeSerial)

Definition at line 39 of file unit_factory.cpp.

References _Universe, Universe::activeStarSystem(), UnitCollection::createIterator(), StarSystem::getUnitList(), Unit::Kill(), Network, and SERVER.

Referenced by UnitFactory::createAsteroid(), UnitFactory::createMissile(), UnitFactory::createNebula(), and UnitFactory::createUnit().

40 {
41  if ( likeSerial != 0 && (Network || SERVER) ) {
42  Unit *un; //FIXME What's the purpos of un here?; doesn't seem to be used --unless macro magic exists...
43  for (un_iter it = _Universe->activeStarSystem()->getUnitList().createIterator(); (un=*it)!=NULL; ++it)
44  if ( (*it)->GetSerial() == likeSerial )
45  (*it)->Kill();
46  }
47 }