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


C++ PlayerCityPtr::walkers方法代码示例

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


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

示例1: calcVacantHouse

void Migration::Impl::createMigrationToCity( PlayerCityPtr city )
{
  unsigned int vh = calcVacantHouse( city );
  if( vh == 0 )
  {
    return;
  }

  EmigrantList migrants;
  migrants << city->walkers();

  if( vh <= migrants.size() * 5 )
  {
    return;
  }

  Tile& roadTile = city->tilemap().at( city->borderInfo().roadEntry );

  ImmigrantPtr emigrant = Immigrant::create( city );

  if( emigrant.isValid() )
  {
    bool success = emigrant->send2city( roadTile );
    emigrant->setSpeedMultiplier( 0.8f + math::random( 40 ) / 100.f );

    if( success )
      lastMonthComing += emigrant->peoples().count();
  }
}
开发者ID:binakot,项目名称:caesaria-game,代码行数:29,代码来源:migration.cpp

示例2: _doWrath

void Neptune::_doWrath(PlayerCityPtr city)
{
  GameEventPtr event = ShowInfobox::create( _("##wrath_of_neptune_title##"),
                                            _("##wrath_of_neptune_description##"),
                                            ShowInfobox::send2scribe,
                                            "god_neptune");
  event->dispatch();

  ShipList boats;
  boats << city->walkers();

  ShipList destroyBoats = boats.random( 5 );
  for( auto ship : destroyBoats )
  {
    ship->die();
  }
}
开发者ID:binakot,项目名称:caesaria-game,代码行数:17,代码来源:neptune.cpp

示例3: _doBlessing

void Mars::_doBlessing(PlayerCityPtr city)
{
  EnemySoldierList enemies;
  enemies << city->walkers( walker::any );

  bool blessingDone = false;
  int step = enemies.size() / 3;
  for( int k=0; k < step; k++ )
  {
    int index = math::random( enemies.size() );
    EnemySoldierList::iterator it = enemies.begin();
    std::advance( it, index );
    (*it)->die();
    blessingDone = true;
  }

  if( blessingDone )
  {
    events::GameEventPtr event = events::ShowInfobox::create( _("##spirit_of_mars_title##"),
                                                              _("##spirit_of_mars_text##"),
                                                              events::ShowInfobox::send2scribe );
    event->dispatch();
  }
}
开发者ID:mdl8bit,项目名称:caesaria-game,代码行数:24,代码来源:mars.cpp


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