コード例 #1
0
Planet* UnitFactory::createPlanet( QVector x,
                                   QVector y,
                                   float vely,
                                   const Vector &rotvel,
                                   float pos,
                                   float gravity,
                                   float radius,
                                   const std::string &filename,
                                   const std::string &technique,
                                   const std::string &unitname,
                                   BLENDFUNC sr,
                                   BLENDFUNC ds,
                                   const vector< string > &dest,
                                   const QVector &orbitcent,
                                   Unit *parent,
                                   const GFXMaterial &ourmat,
                                   const std::vector< GFXLightLocal > &ligh,
                                   int faction,
                                   string fullname,
                                   bool inside_out,
                                   ObjSerial netcreate )
{
    _Universe->netLock( true );
    Planet *p = new Planet( x, y, vely, rotvel, pos, gravity, radius,
                           filename, technique, unitname, dest, orbitcent, parent, faction,
                           fullname, inside_out, ligh.size() );
    _Universe->netLock( false );
    if (netcreate)
        p->SetSerial( netcreate );
/*
 *               // False: Only allow creation through system files?  Doesn't make sense to be able to dynamically generate these.
 *               // Could cause inconsistencies with new clients that just read system files.
 *               if ( false && !_Universe->netLocked()) {
 *                       NetBuffer netbuf;
 *                       // Send a packet to clients in order to make them create this unit
 *
 *                       addPlanetBuffer( netbuf, x, y, vely, rotvel, pos, gravity, radius, filename, sr, ds, dest, orbitcent, parent, ourmat, ligh, faction, fullname, inside_out, netcreate);
 *                       endBuffer( netbuf );
 *                       VSServer->broadcast( netbuf, 0, _Universe->activeStarSystem()->GetZone(), CMD_ENTERCLIENT, true);
 *               }
 *               VSServer->invalidateSnapshot();
 */
    return p;
}
コード例 #2
0
Planet* UnitFactory::createPlanet( QVector x,
                                   QVector y,
				   float vely,
				   const Vector & rotvel,
				   float pos,
				   float gravity,
				   float radius,
				   const char * filename,
				   BLENDFUNC sr, BLENDFUNC ds,
				   const vector<string> &dest,
				   const QVector &orbitcent,
				   Unit * parent,
				   const GFXMaterial & ourmat,
				   const std::vector <GFXLightLocal> & ligh,
				   int faction,
				   string fullname ,
				   bool inside_out, ObjSerial netcreate)
{
    Planet * p = new GamePlanet( x,
                       y,
                       vely,
                       rotvel,
                       pos,
                       gravity,
                       radius,
                       filename,
		       sr,ds,
                       dest,
                       orbitcent,
                       parent,
                       ourmat,
                       ligh,
                       faction,
                       fullname , 
		       inside_out);
	if( netcreate) {
		KillDuplicateUnits( netcreate);
		p->SetSerial( netcreate);
	}
	return p;
}