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::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)); }