void UnitFactory::addPlanetBuffer( NetBuffer &netbuf,
                                   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 )
{
    netbuf.addChar( ZoneMgr::AddPlanet );
    netbuf.addSerial( netcreate );
    netbuf.addQVector( x );
    netbuf.addQVector( y );
    netbuf.addFloat( vely );
    netbuf.addVector( Vector( rotvel ) );
    netbuf.addFloat( pos );
    netbuf.addFloat( gravity );
    netbuf.addFloat( radius );

    netbuf.addString( string( filename ) );
    netbuf.addChar( sr );
    netbuf.addChar( ds );

    netbuf.addShort( dest.size() );
    for (unsigned int i = 0; i < dest.size(); i++)
        netbuf.addString( dest[i] );
    netbuf.addQVector( QVector( orbitcent ) );
    netbuf.addSerial( parent->GetSerial() );
    netbuf.addGFXMaterial( ourmat );
    netbuf.addShort( ligh.size() );
    for (unsigned int j = 0; j < ligh.size(); j++)
        netbuf.addGFXLightLocal( ligh[j] );
    netbuf.addInt32( faction );
    netbuf.addString( fullname );
    netbuf.addChar( inside_out );
}
void UnitFactory::addUnitBuffer( NetBuffer &netbuf,
                                 const string &filename,
                                 const string &name,
                                 const string &fullname,
                                 bool SubUnit,
                                 int faction,
                                 std::string customizedUnit,
                                 const ClientState &curr_state,
                                 Flightgroup *flightgroup,
                                 int fg_subnumber,
                                 string *netxml,
                                 ObjSerial netcreate )
{
    netbuf.addChar( ZoneMgr::AddUnit );
    assert( netcreate != 0 );           //crash if we are doing something stupid :)
    netbuf.addSerial( netcreate );
    netbuf.addString( filename );
    netbuf.addString( name );
    netbuf.addString( fullname );
    netbuf.addChar( SubUnit );
    netbuf.addInt32( faction );
    netbuf.addString( flightgroup != NULL ? flightgroup->name : std::string( "Object" ) );
    netbuf.addString( customizedUnit );
    netbuf.addInt32( fg_subnumber );
    if (netbuf.version() <= 4951)
        netbuf.addTransformation( curr_state.getTransformation() );
    else
        netbuf.addClientState( curr_state );
}
void UnitFactory::addMissileBuffer( NetBuffer &netbuf,
                                    const string &filename,
                                    const string &name,
                                    const string &fullname,
                                    int faction,
                                    const string &modifications,
                                    const ClientState &curr_state,
                                    const float damage,
                                    float phasedamage,
                                    float time,
                                    float radialeffect,
                                    float radmult,
                                    float detonation_radius,
                                    ObjSerial netcreate )
{
    netbuf.addChar( ZoneMgr::AddMissile );
    netbuf.addSerial( netcreate );
    netbuf.addString( filename );
    netbuf.addString( name );
    netbuf.addString( fullname );

    netbuf.addInt32( faction );
    netbuf.addString( modifications );
    netbuf.addFloat( damage );
    netbuf.addFloat( phasedamage );
    netbuf.addFloat( time );
    netbuf.addFloat( radialeffect );
    netbuf.addFloat( radmult );
    netbuf.addFloat( detonation_radius );
    if (netbuf.version() <= 4951)
        netbuf.addTransformation( curr_state.getTransformation() );
    else
        netbuf.addClientState( curr_state );
}
void UnitFactory::addAsteroidBuffer( NetBuffer &netbuf,
                                     const char *filename,
                                     int faction,
                                     Flightgroup *fg,
                                     int fg_snumber,
                                     float difficulty,
                                     ObjSerial netcreate )
{
    netbuf.addChar( ZoneMgr::AddAsteroid );
    netbuf.addSerial( netcreate );
    netbuf.addString( string( filename ) );
    netbuf.addInt32( faction );
    netbuf.addString( fg->name );
    netbuf.addInt32( fg_snumber );
    netbuf.addFloat( difficulty );
}
void UnitFactory::addNebulaBuffer( NetBuffer &netbuf,
                                   const char *unitfile,
                                   bool SubU,
                                   int faction,
                                   Flightgroup *fg,
                                   int fg_snumber,
                                   ObjSerial netcreate )
{
    netbuf.addChar( ZoneMgr::AddNebula );
    netbuf.addSerial( netcreate );
    netbuf.addString( string( unitfile ) );
    netbuf.addChar( SubU );
    netbuf.addInt32( faction );
    netbuf.addString( fg->name );
    netbuf.addInt32( fg_snumber );
}