Unit* Planet::beginElement( QVector x, QVector y, float vely, const Vector &rotvel, float pos, float gravity, float radius, const string &filename, const string &technique, const string &unitname, BLENDFUNC blendSrc, BLENDFUNC blendDst, const vector< string > &dest, int level, const GFXMaterial &ourmat, const vector< GFXLightLocal > &ligh, bool isunit, int faction, string fullname, bool inside_out ) { //this function is OBSOLETE Unit *un = NULL; if (level > 2) { un_iter satiterator = satellites.createIterator(); assert( *satiterator ); if ( (*satiterator)->isUnit() == PLANETPTR ) { un = ( (Planet*) (*satiterator) )->beginElement( x, y, vely, rotvel, pos, gravity, radius, filename, technique, unitname, blendSrc, blendDst, dest, level-1, ourmat, ligh, isunit, faction, fullname, inside_out ); } else { VSFileSystem::vs_fprintf( stderr, "Planets are unable to orbit around units" ); } } else { if (isunit == true) { Unit *sat_unit = NULL; Flightgroup *fg = getStaticBaseFlightgroup( faction ); satellites.prepend( sat_unit = UnitFactory::createUnit( filename.c_str(), false, faction, "", fg, fg->nr_ships-1 ) ); sat_unit->setFullname( fullname ); un = sat_unit; un_iter satiterator( satellites.createIterator() ); (*satiterator)->SetAI( new PlanetaryOrbit( *satiterator, vely, pos, x, y, QVector( 0, 0, 0 ), this ) ); (*satiterator)->SetOwner( this ); } else { Planet *p; if (dest.size() != 0) radius = ScaleJumpRadius( radius ); satellites.prepend( p = UnitFactory::createPlanet( x, y, vely, rotvel, pos, gravity, radius, filename, technique, unitname, blendSrc, blendDst, dest, QVector( 0, 0, 0 ), this, ourmat, ligh, faction, fullname, inside_out ) ); un = p; p->SetOwner( this ); } } return un; }