예제 #1
0
void save_ships( void )
{
   ofstream stream;
   list < ship_data * >::iterator iship;

   stream.open( SHIP_FILE );
   if( !stream.is_open(  ) )
   {
      perror( SHIP_FILE );
      bug( "%s: can't open ship file", __FUNCTION__ );
      return;
   }

   for( iship = shiplist.begin(  ); iship != shiplist.end(  ); ++iship )
   {
      ship_data *ship = *iship;

      stream << "#SHIP" << endl;
      stream << "Name      " << ship->name << endl;
      stream << "Owner     " << ship->owner << endl;
      stream << "Flags     " << bitset_string( ship->flags, ship_flags ) << endl;
      stream << "Vnum      " << ship->vnum << endl;
      stream << "Room      " << ship->room << endl;
      stream << "Type      " << ship_type[ship->type] << endl;
      stream << "Hull      " << ship->hull << endl;
      stream << "Max_hull  " << ship->max_hull << endl;
      stream << "Fuel      " << ship->fuel << endl;
      stream << "Max_fuel  " << ship->max_fuel << endl;
      stream << "Coordinates " << ship->cmap << " " << ship->mx << " " << ship->my << endl;
      stream << "End" << endl << endl;
   }
   stream.close(  );
}
예제 #2
0
void save_mudchannels( void )
{
   ofstream stream;

   stream.open( CHANNEL_FILE );
   if( !stream.is_open(  ) )
   {
      bug( "%s: fopen", __func__ );
      perror( CHANNEL_FILE );
   }
   else
   {
      stream << "#VERSION " << CHANNEL_VERSION << endl;
      list < mud_channel * >::iterator chan;
      for( chan = chanlist.begin(  ); chan != chanlist.end(  ); ++chan )
      {
         mud_channel *channel = *chan;

         if( !channel->name.empty(  ) )
         {
            stream << "#CHANNEL" << endl;
            stream << "ChanName      " << channel->name << endl;
            stream << "ChanColorname " << channel->colorname << endl;
            stream << "ChanLevel     " << channel->level << endl;
            stream << "ChanType      " << channel->type << endl;
            if( channel->flags.any(  ) )
               stream << "ChanFlags     " << bitset_string( channel->flags, chan_flags ) << endl;
            stream << "End" << endl << endl;
         }
      }
      stream.close(  );
   }
}