29 District(
string district_name,
uint influence_size,
double influence_speed,
double influence_minimum,
31 m_name(district_name),
33 m_influence_size(influence_size),
34 m_influence_speed(influence_speed),
35 m_influence_minimum(influence_minimum) {}
39 if (!hasFacility(facility_name)) {
40 m_transportations_facilities.push_back(
41 make_pair(facility_name,
Influence(m_influence_size, m_influence_speed, m_influence_minimum)));
47 return getFacility(facility_name) != m_transportations_facilities.end();
51 if (hasFacility(facility_name)) {
52 auto it = getFacility(facility_name);
53 return it->second.getInfluence();
60 if (hasFacility(facility_name)) {
61 auto it = getFacility(facility_name);
62 it->second.addToFront(amount);
67 for (
auto& facility: m_transportations_facilities) {
68 facility.second.addRecord(0);
88 vector<pair<string, Influence>>::const_iterator
getFacility(
string facility_name)
const {
89 auto same_name = [&](
const pair<string, Influence>& facility) {
return facility.first == facility_name; };
90 return find_if(m_transportations_facilities.begin(), m_transportations_facilities.end(), same_name);
93 vector<pair<string, Influence>>::iterator
getFacility(
string facility_name) {
94 auto same_name = [&](
const pair<string, Influence>& facility) {
return facility.first == facility_name; };
95 return find_if(m_transportations_facilities.begin(), m_transportations_facilities.end(), same_name);
District(string district_name, uint influence_size, double influence_speed, double influence_minimum, GeoCoordinate location=GeoCoordinate(0, 0))
Constructor.
void advanceInfluencesRecords()
bool operator==(const District &other_district)
Equals operator for districts, two districts are equal if their name is the same. ...
void addFacility(string facility_name)
Add a transportation facility to this district.
string m_name
The name of the city/village.
const uint m_influence_speed
All Influences of facilities will get this speed.
string getName() const
Return the name of the district.
Time Dependent Person DataType.
const uint m_influence_minimum
All Influences of facilities will get this minimum.
double getFacilityInfluence(string facility_name) const
A district is either a city or a village (currently, there is no difference between city and village)...
const GeoCoordinate m_location
The geographic location of the district.
vector< pair< string, Influence > >::iterator getFacility(string facility_name)
vector< pair< string, Influence > > m_transportations_facilities
The transportation facilities have a name (string) and a sphere of influence.
void visitFacility(string facility_name, uint amount)
bool hasFacility(string facility_name) const
If the facility is found in this district, return true.
Header for the Influence class.
vector< pair< string, Influence > >::const_iterator getFacility(string facility_name) const
const uint m_influence_size
All Influences of facilities will get this size.
GeoCoordinate getLocation() const