本文整理汇总了C++中House::getServiceAccess方法的典型用法代码示例。如果您正苦于以下问题:C++ House::getServiceAccess方法的具体用法?C++ House::getServiceAccess怎么用?C++ House::getServiceAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类House
的用法示例。
在下文中一共展示了House::getServiceAccess方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: evaluateServiceNeed
float HouseLevelSpec::evaluateServiceNeed(House &house, const ServiceType service)
{
float res = 0;
switch (service)
{
case S_TEMPLE_CERES:
case S_TEMPLE_NEPTUNE:
case S_TEMPLE_MARS:
case S_TEMPLE_VENUS:
case S_TEMPLE_MERCURE:
res = evaluateReligionNeed(house, service);
break;
case S_THEATER:
case S_AMPHITHEATER:
case S_COLLOSSEUM:
case S_HIPPODROME:
res = evaluateEntertainmentNeed(house, service);
break;
case S_SCHOOL:
case S_LIBRARY:
case S_COLLEGE:
res = evaluateEducationNeed(house, service);
break;
case S_BATHS:
case S_BARBER:
case S_DOCTOR:
case S_HOSPITAL:
res = evaluateHealthNeed(house, service);
break;
case S_FORUM:
res = 1;
break;
default:
break;
}
return res * (100 - house.getServiceAccess(service));
}