float HouseLevelSpec::evaluateReligionNeed(House &house, const ServiceType service) { int houseLevel = house.getLevelSpec().getHouseLevel(); int minLevel = HouseSpecHelper::getInstance().getHouseLevelSpec(houseLevel+1)._minReligionLevel; return (float)minLevel; }
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; }
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; }
float HouseLevelSpec::evaluateEntertainmentNeed(House &house, const ServiceType service) { int houseLevel = house.getLevelSpec().getHouseLevel(); return (float)HouseSpecHelper::getInstance().getHouseLevelSpec(houseLevel+1)._minEntertainmentLevel; }