当前位置: 首页>>代码示例>>C++>>正文


C++ ConfigElem::remove_ushort方法代码示例

本文整理汇总了C++中clib::ConfigElem::remove_ushort方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigElem::remove_ushort方法的具体用法?C++ ConfigElem::remove_ushort怎么用?C++ ConfigElem::remove_ushort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clib::ConfigElem的用法示例。


在下文中一共展示了ConfigElem::remove_ushort方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: name

RealmDescriptor::RealmDescriptor(const std::string& realm_name, const std::string& realm_path, Clib::ConfigElem& elem) :
  name( realm_name ),
  file_path( realm_path ),
  width( elem.remove_ushort( "width" ) ),
  height( elem.remove_ushort( "height" ) ),
  uomapid( elem.remove_unsigned( "uomapid", 0 ) ),
  uodif( elem.remove_bool( "uodif", false ) ),
  num_map_patches( elem.remove_unsigned( "num_map_patches", 0 ) ),
  num_static_patches( elem.remove_unsigned( "num_static_patches", 0 ) ),
  season( elem.remove_unsigned( "season", 1 ) ),
  mapserver_type( Clib::strlower( elem.remove_string( "mapserver", "memory" ) ) ),
  grid_width(calc_grid_size(width)),
  grid_height(calc_grid_size(height))
{
}
开发者ID:gtozzi,项目名称:polserver,代码行数:15,代码来源:realmdescriptor.cpp

示例2: add_npc

	Mobile::NPC* add_npc( const char* npctype, unsigned short x, unsigned short y, short z )
	{
	  Clib::ConfigFile cfile;
	  Clib::ConfigElem elem;
	  if ( !Core::FindNpcTemplate( npctype, cfile, elem ) )
	  {
          throw std::runtime_error(std::string("NPC template '") + npctype + "' not found");
	  }

	  auto  npc = new Mobile::NPC( elem.remove_ushort( "OBJTYPE" ), elem );
	  elem.clear_prop( "Serial" );
	  elem.clear_prop( "X" );
	  elem.clear_prop( "Y" );
	  elem.clear_prop( "Z" );

	  elem.add_prop( "Serial", GetNextSerialNumber() );
	  elem.add_prop( "X", x );
	  elem.add_prop( "Y", y );
	  elem.add_prop( "Z", z );
	  npc->readPropertiesForNewNPC( elem );

	  objStorageManager.objecthash.Insert( npc );

	  SetCharacterWorldPosition( npc, WorldChangeReason::NpcCreate );
	  return npc;
	}
开发者ID:AlessandroMamusa,项目名称:polserver,代码行数:26,代码来源:testenv.cpp

示例3: while

AuxService::AuxService( const Plib::Package* pkg, Clib::ConfigElem& elem ) :
  _pkg( pkg ),
  _scriptdef( elem.remove_string( "SCRIPT" ), _pkg ),
  _port( elem.remove_ushort( "PORT" ) )
{
  std::string iptext;
  while ( elem.remove_prop( "IPMATCH", &iptext ) )
  {
    auto delim = iptext.find_first_of("/");
    if (delim != std::string::npos)
    {
      std::string ipaddr_str = iptext.substr(0, delim);
      std::string ipmask_str = iptext.substr(delim + 1);
      unsigned int ipaddr = inet_addr( ipaddr_str.c_str() );
      unsigned int ipmask = inet_addr( ipmask_str.c_str() );
      _aux_ip_match.push_back( ipaddr );
      _aux_ip_match_mask.push_back( ipmask );
    }
    else
    {
      unsigned int ipaddr = inet_addr( iptext.c_str() );
      _aux_ip_match.push_back( ipaddr );
      _aux_ip_match_mask.push_back( 0xFFffFFffLu );
    }
  }
}
开发者ID:gtozzi,项目名称:polserver,代码行数:26,代码来源:auxclient.cpp

示例4: load_general_entry

// Strength
// Dexterity
void load_general_entry( const Plib::Package* pkg, Clib::ConfigElem& elem )
{
  checka( elem,
          networkManager.uoclient_general.strength,
          "Strength" );
  checka( elem,
          networkManager.uoclient_general.intelligence,
          "Intelligence" );
  checka( elem,
          networkManager.uoclient_general.dexterity,
          "Dexterity" );
  checkv( elem,
          networkManager.uoclient_general.hits,
          "Hits" );
  checkv( elem,
          networkManager.uoclient_general.stamina,
          "Stamina" );
  checkv( elem,
          networkManager.uoclient_general.mana,
          "Mana" );
  //dave changed 3/15/03, support configurable max skillid
  networkManager.uoclient_general.maxskills = elem.remove_ushort( "MaxSkillID", SKILLID__HIGHEST );
  std::string temp;
  if ( elem.remove_prop( "MethodScript", &temp ) )
  {
    if ( !temp.empty() )
    {
      ExportScript* shs = new ExportScript( pkg, temp );
      if ( shs->Initialize() )
        networkManager.uoclient_general.method_script = shs;
      else
        delete shs;
    }
  }
}
开发者ID:gtozzi,项目名称:polserver,代码行数:37,代码来源:uoclient.cpp

示例5: port

UoClientListener::UoClientListener( Clib::ConfigElem& elem ) :
  port( elem.remove_ushort( "PORT" ) ),
  aosresist( elem.remove_bool( "AOSRESISTANCES", false ) ),
  sticky( elem.remove_bool( "KeepClients", false ) )

{
  CalculateCryptKeys( elem.remove_string( "ENCRYPTION", "none" ), encryption );
}
开发者ID:gtozzi,项目名称:polserver,代码行数:8,代码来源:uoclient.cpp

示例6: EquipDesc

/// Since the constructor is doing some wrong guessing to tell when an armor is a shield,
/// forceShield will force to consider it a shield
ArmorDesc::ArmorDesc( u32 objtype, Clib::ConfigElem& elem, const Plib::Package* pkg,
                      bool forceShield )
    : EquipDesc( objtype, elem, ARMORDESC, pkg ),
      ar( elem.remove_ushort( "AR", 0 ) ),
      zones(),
      on_hit_script( elem.remove_string( "ONHITSCRIPT", "" ), pkg, "scripts/items/" )
{
  std::string coverage;
  while ( elem.remove_prop( "COVERAGE", &coverage ) )
  {
    try
    {
      zones.insert( Mobile::zone_name_to_zone( coverage.c_str() ) );
    }
    catch ( std::runtime_error& )
    {
      fmt::Writer tmp;
      tmp.Format( "Error in Objtype 0x{:X}" ) << objtype;
      if ( pkg == NULL )
        tmp << "config/itemdesc.cfg\n";
      else
        tmp << pkg->dir() << "itemdesc.cfg\n";

      ERROR_PRINT << tmp.str();
      throw;
    }
  }

  if ( zones.empty() )
  {
    // No 'COVERAGE' entries existed.
    // default coverage based on object type/layer
    unsigned short layer = Plib::systemstate.tile[graphic].layer;
    // special case for shields - they effectively have no coverage.
    if ( !forceShield && layer != Core::LAYER_HAND1 && layer != Core::LAYER_HAND2 )
    {
      try
      {
        zones.insert( Mobile::layer_to_zone( layer ) );
      }
      catch ( std::runtime_error& )
      {
        fmt::Writer tmp;
        tmp.Format( "Error in Objtype 0x{:X}" ) << objtype;
        if ( pkg == NULL )
          tmp << "config/itemdesc.cfg\n";
        else
          tmp << pkg->dir() << "itemdesc.cfg\n";

        ERROR_PRINT << tmp.str();
        throw;
      }
    }
  }
}
开发者ID:JohnnyB1971,项目名称:polserver,代码行数:57,代码来源:armor.cpp

示例7: OpenExistingFiles

void MapWriter::OpenExistingFiles(const std::string& realm_name)
{
  using std::ios;

  _realm_name = realm_name;

  std::string directory = "realm/" + _realm_name + "/";

  std::string realm_cfg_filename = directory + "realm.cfg";
  Clib::ConfigFile cf( realm_cfg_filename, "REALM" );
  Clib::ConfigElem elem;
  if ( !cf.read( elem ) )
    throw std::runtime_error("Unable to read realm from " + realm_cfg_filename);
  _width = elem.remove_ushort( "width" );
  _height = elem.remove_ushort( "height" );

  std::string filename = directory + "base.dat";
  Clib::open_file( _ofs_base, filename, ios::in | ios::out | ios::binary );


  // First-level Solids index (solidx1)
  filename = directory + "solidx1.dat";
  Clib::open_file( _ofs_solidx1, filename, ios::in | ios::out | ios::binary );

  // Second-level Solids index (solidx2)
  filename = directory + "solidx2.dat";
  Clib::open_file( _ofs_solidx2, filename, ios::in | ios::out | ios::binary );
  _ofs_solidx2.seekp( 0, ios::end );
  solidx2_offset = _ofs_solidx2.tellp();

  // Solids data (solids)
  filename = directory + "solids.dat";
  Clib::open_file( _ofs_solids, filename, ios::in | ios::out | ios::binary );
  _ofs_solids.seekp( 0, ios::end );
  solids_offset = _ofs_solids.tellp();

  // Maptile (maptile.dat)
  filename = directory + "maptile.dat";
  Clib::open_file( _ofs_maptile, filename, ios::in | ios::out | ios::binary );
  _ofs_maptile.seekp( 0, ios::end );
}
开发者ID:gtozzi,项目名称:polserver,代码行数:41,代码来源:mapwriter.cpp

示例8: readProperties

	void UCorpse::readProperties( Clib::ConfigElem& elem )
	{
	  // corpses can be the same color as mobiles
	  u16 savecolor = elem.remove_ushort( "COLOR", 0 );

	  base::readProperties( elem );

	  color = savecolor;

	  elem.remove_prop( "CorpseType", &corpsetype );
	  elem.remove_prop( "OwnerSerial", &ownerserial );
	  take_contents_to_grave = elem.remove_bool( "TakeContentsToGrave", false );
	  movable_ = false;
	}
开发者ID:vitorfdl,项目名称:polserver,代码行数:14,代码来源:corpse.cpp

示例9: runtime_error

	USpell::USpell( Clib::ConfigElem& elem, Plib::Package* pkg ) :
	  pkg_( pkg ),
	  spellid_( elem.remove_ushort( "SPELLID" ) ),
	  name_( elem.remove_string( "NAME" ) ),
	  power_words_( elem.remove_string( "POWERWORDS" ) ),
	  scriptdef_( elem.remove_string( "SCRIPT", "" ), pkg, "scripts/" )
	{
	  unsigned short action;
	  if ( elem.remove_prop( "ANIMATION", &action ) )
	  {
		if ( UACTION_IS_VALID( action ) )
		{
		  action_ = static_cast<UACTION>( action );
		}
		else
		{
		  elem.throw_error( "Animation is out of range" );
		}
	  }
	  else
	  {
		action_ = ACTION_CAST_SPELL1;
	  }

	  unsigned short circle;
	  if ( elem.remove_prop( "CIRCLE", &circle ) )
	  {
		if ( circle < 1 || circle > spellcircles.size() ||
			 spellcircles[circle - 1] == NULL )
		{
          ERROR_PRINT << "Error reading spell " << name_
            << ": Circle " << circle << " is not defined.\n";
		  throw std::runtime_error( "Config file error" );
		}

		params_ = spellcircles[circle - 1]->params;
	  }
	  else
	  {
		params_ = USpellParams( elem );
	  }

	  std::string reagent_name;
	  while ( elem.remove_prop( "Reagent", &reagent_name ) )
	  {
        unsigned int reagent = Items::get_objtype_from_string( reagent_name );

		reglist_.push_back( reagent );
	  }
	}
开发者ID:Lolkauo,项目名称:polserver,代码行数:50,代码来源:spells.cpp

示例10: pkg

Attribute::Attribute( const Plib::Package* pkg, Clib::ConfigElem& elem ) :
  pkg( pkg ),
  name( elem.rest() ),
  attrid( 0 ),
  aliases(),
  next( NULL ),
  getintrinsicmod_func( nullptr ),
  delay_seconds( elem.remove_ushort( "DELAY", 0 ) ),
  unhides( elem.remove_bool( "UNHIDES", true ) ),
  disable_core_checks( elem.remove_bool( "DisableCoreChecks", false ) ),
  default_cap( elem.remove_ushort( "DefaultCap", Core::settingsManager.ssopt.default_attribute_cap ) ),
  script_( elem.remove_string( "SCRIPT", "" ), pkg, "scripts/skills/" )
{
  aliases.push_back( name );
  std::string tmp;
  while ( elem.remove_prop( "Alias", &tmp ) )
    aliases.push_back( tmp );

  if ( elem.remove_prop( "GetIntrinsicModFunction", &tmp ) )
  {
    getintrinsicmod_func = Core::FindExportedFunction( elem, pkg, tmp, 1 );
  }
}
开发者ID:gtozzi,项目名称:polserver,代码行数:23,代码来源:attribute.cpp

示例11: main

int UoToolMain::main()
{
  const std::vector<std::string> binArgs = programArgs();

  /**********************************************
   * show help
   **********************************************/
  if (binArgs.size() == 1)
  {
    showHelp();
    return 0; // return "okay"
  }

  /**********************************************
   * TODO: rework the following cruft from former uotool.cpp
   **********************************************/
  Clib::ConfigFile cf( "pol.cfg" );
  Clib::ConfigElem elem;

  cf.readraw( elem );

  Plib::systemstate.config.uo_datafile_root = elem.remove_string( "UoDataFileRoot" );
  Plib::systemstate.config.uo_datafile_root = Clib::normalized_dir_form( Plib::systemstate.config.uo_datafile_root );

  unsigned short max_tile = elem.remove_ushort( "MaxTileID", UOBJ_DEFAULT_MAX );

  if ( max_tile != UOBJ_DEFAULT_MAX && max_tile != UOBJ_SA_MAX && max_tile != UOBJ_HSA_MAX )
    Plib::systemstate.config.max_tile_id = UOBJ_DEFAULT_MAX;
  else
    Plib::systemstate.config.max_tile_id = max_tile;

  std::string argvalue = binArgs[1];
  if ( argvalue[0] == '/' || argvalue[0] == ':' )
  {
    Plib::systemstate.config.uo_datafile_root = argvalue;
    if (binArgs.size() < 3)
    {
      showHelp();
      return 0;
    }
    argvalue = binArgs[2];
  }

  std::transform(argvalue.begin(), argvalue.end(), argvalue.begin(), ::tolower);

  if ( argvalue == "tiledump" )
  {
    return UoTool::tiledump( s_argc, s_argv );
  }
  else if ( argvalue == "vertile" )
  {
    return UoTool::vertile();
  }
  else if ( argvalue == "verlandtile" )
  {
    return UoTool::verlandtile();
  }
  else if ( argvalue == "landtilehist" )
  {
    return UoTool::landtilehist();
  }
  else if ( argvalue == "flagsearch" )
  {
    return UoTool::flagsearch( s_argc, s_argv );
  }
  else if ( argvalue == "landtileflagsearch" )
  {
    return UoTool::landtileflagsearch( s_argc, s_argv );
  }
  else if ( argvalue == "loschange" )
  {
    return UoTool::loschange( s_argc, s_argv );
  }
  else if ( argvalue == "rawdump" )
  {
    return UoTool::rawdump( s_argc, s_argv );
  }
  else if ( argvalue == "ctable" )
  {
    return UoTool::print_ctable();
  }
  else if ( argvalue == "sndlist" )
  {
    return UoTool::print_sndlist();
  }
  else if ( argvalue == "statics" )
  {
    return UoTool::print_statics();
  }
  else if ( argvalue == "verdata" )
  {
    return UoTool::print_verdata_info();
  }
  else if ( argvalue == "multis" )
  {
    return UoTool::print_multis();
  }
  else if ( argvalue == "water" )
  {
    return UoTool::print_water_data();
//.........这里部分代码省略.........
开发者ID:gtozzi,项目名称:polserver,代码行数:101,代码来源:UoToolMain.cpp

示例12: manacost

	USpellParams::USpellParams( Clib::ConfigElem& elem ) :
	  manacost( elem.remove_ushort( "MANA" ) ),
	  difficulty( elem.remove_ushort( "DIFFICULTY" ) ),
	  pointvalue( elem.remove_ushort( "POINTVALUE" ) ),
	  delay( elem.remove_ushort( "DELAY" ) )
	{}
开发者ID:Lolkauo,项目名称:polserver,代码行数:6,代码来源:spells.cpp

示例13: main

int UoConvertMain::main()
{
  const std::vector<std::string>& binArgs = programArgs();

  /**********************************************
   * show help
   **********************************************/
  if ( binArgs.size() == 1 )
  {
    showHelp();
    return 0;  // return "okay"
  }

  /**********************************************
   * TODO: rework the following cruft from former uoconvert.cpp
   **********************************************/
  Plib::systemstate.config.max_tile_id = UOBJ_DEFAULT_MAX;  // default
  std::string argvalue = programArgsFindEquals( "uodata=", "" );
  if ( !argvalue.empty() )
  {
    Plib::systemstate.config.uo_datafile_root = argvalue;
    Plib::systemstate.config.uo_datafile_root =
        Clib::normalized_dir_form( Plib::systemstate.config.uo_datafile_root );
  }
  else
  {
    INFO_PRINT << "Reading pol.cfg.\n";
    Clib::ConfigFile cf( "pol.cfg" );
    Clib::ConfigElem elem;

    cf.readraw( elem );
    Plib::systemstate.config.uo_datafile_root = elem.remove_string( "UoDataFileRoot" );
    Plib::systemstate.config.uo_datafile_root =
        Clib::normalized_dir_form( Plib::systemstate.config.uo_datafile_root );

    unsigned short max_tile = elem.remove_ushort( "MaxTileID", UOBJ_DEFAULT_MAX );

    if ( max_tile == UOBJ_DEFAULT_MAX || max_tile == UOBJ_SA_MAX || max_tile == UOBJ_HSA_MAX )
      Plib::systemstate.config.max_tile_id = max_tile;
  }

  unsigned short max_tile =
      static_cast<unsigned short>( programArgsFindEquals( "maxtileid=", UOBJ_DEFAULT_MAX, true ) );
  if ( max_tile == UOBJ_DEFAULT_MAX || max_tile == UOBJ_SA_MAX || max_tile == UOBJ_HSA_MAX )
    Plib::systemstate.config.max_tile_id = max_tile;


  std::string main_cfg = "uoconvert.cfg";
  if ( Clib::FileExists( main_cfg.c_str() ) )
  {
    std::string temp;
    Clib::ConfigElem elem;
    INFO_PRINT << "Reading uoconvert.cfg.\n";
    Clib::ConfigFile cf_main( main_cfg.c_str() );
    while ( cf_main.read( elem ) )
    {
      if ( elem.type_is( "MultiTypes" ) )
      {
        temp = elem.remove_string( "Boats" );
        ISTRINGSTREAM is_boats( temp );
        std::string graphicnum;
        while ( is_boats >> graphicnum )
          UoConvert::BoatTypes.insert( strtoul( graphicnum.c_str(), NULL, 0 ) );

        temp = elem.remove_string( "Houses" );
        ISTRINGSTREAM is_houses( temp );
        while ( is_houses >> graphicnum )
          UoConvert::HouseTypes.insert( strtoul( graphicnum.c_str(), NULL, 0 ) );

        temp = elem.remove_string( "Stairs" );
        ISTRINGSTREAM is_stairs( temp );
        while ( is_stairs >> graphicnum )
          UoConvert::StairTypes.insert( strtoul( graphicnum.c_str(), NULL, 0 ) );
      }
      else if ( elem.type_is( "LOSOptions" ) )
开发者ID:JohnnyB1971,项目名称:polserver,代码行数:75,代码来源:UoConvertMain.cpp


注:本文中的clib::ConfigElem::remove_ushort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。