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


C++ House::getLevelSpec方法代码示例

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


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

示例1: evaluateReligionNeed

float HouseLevelSpec::evaluateReligionNeed(House &house, const ServiceType service)
{
   int houseLevel = house.getLevelSpec().getHouseLevel();
   int minLevel = HouseSpecHelper::getInstance().getHouseLevelSpec(houseLevel+1)._minReligionLevel;

   return (float)minLevel;
}
开发者ID:LMG,项目名称:opencaesar3,代码行数:7,代码来源:oc3_house_level.cpp

示例2: evaluateEducationNeed

float HouseLevelSpec::evaluateEducationNeed(House &house, const ServiceType service)
{
   float res = 0;
   int houseLevel = house.getLevelSpec().getHouseLevel();
   int minLevel = HouseSpecHelper::getInstance().getHouseLevelSpec(houseLevel+1)._minEducationLevel;
   if (minLevel == 1)
   {
      // need school or library
      if (service != S_COLLEGE)
      {
         res = (float)( 100 - std::max(house.getServiceAccess(S_SCHOOL), house.getServiceAccess(S_LIBRARY)) );
      } 
   }
   else if (minLevel == 2)
   {
      // need school and library
      if (service != S_COLLEGE)
      {
         res = (float)( 100 - house.getServiceAccess(service) );
      }
   }
   else if (minLevel == 3)
   {
      // need school and library and college
      res = (float)( 100 - house.getServiceAccess(service) );
   }
   // std::cout << "education need: " << service << " " << res << std::endl;
   return res;
}
开发者ID:LMG,项目名称:opencaesar3,代码行数:29,代码来源:oc3_house_level.cpp

示例3: evaluateHealthNeed

float HouseLevelSpec::evaluateHealthNeed(House &house, const ServiceType service)
{
   float res = 0;
   int houseLevel = house.getLevelSpec().getHouseLevel();
   int minLevel = HouseSpecHelper::getInstance().getHouseLevelSpec(houseLevel+1)._minHealthLevel;
   if (minLevel >= 1 && service == S_BATHS)
   {
      // minLevel>=1  => need baths
      res = (float)( 100 - house.getServiceAccess(service) );
   }
   if (minLevel >= 2 && (service == S_DOCTOR || service == S_HOSPITAL))
   {
      if (minLevel == 4)
      {
         // need doctor and hospital
         res = (float)( 100 - house.getServiceAccess(service) );
      }
      else
      {
         // need doctor or hospital
         res = (float)( 100 - std::max(house.getServiceAccess(S_DOCTOR), house.getServiceAccess(S_HOSPITAL)) );
      }
   }
   if (minLevel >= 3 && service == S_BARBER)
   {
      // minLevel>=3  => need barber
      res = (float)( 100 - house.getServiceAccess(service) );
   }

   return res;
}
开发者ID:LMG,项目名称:opencaesar3,代码行数:31,代码来源:oc3_house_level.cpp

示例4: evaluateEntertainmentNeed

float HouseLevelSpec::evaluateEntertainmentNeed(House &house, const ServiceType service)
{
   int houseLevel = house.getLevelSpec().getHouseLevel();
   return (float)HouseSpecHelper::getInstance().getHouseLevelSpec(houseLevel+1)._minEntertainmentLevel;
}
开发者ID:LMG,项目名称:opencaesar3,代码行数:5,代码来源:oc3_house_level.cpp


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