1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
Population Definition
#ifndef POPULATION_H
#define POPULATION_H
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class population
{
public:
//Default Constructor
population();
//Overload Constructors
population(int, string, string, string, int, string, int, string, string, int, string, int, int, int, int, int, int, int, int, bool);
population(int);
//Destructor
~population();
//Accessor Function
int getNumber() const;
string getName() const;
string getGender() const;
string getRace() const;
int getAge() const;
string getMarried() const;
int getMarriedCount() const;
string getSpouse() const;
string getSurname() const;
int getFamilyCount() const;
string getEconType() const;
int getEconPower() const;
int getResidence() const;
int getStr() const;
int getDex() const;
int getCon() const;
int getInt() const;
int getWis() const;
int getCha() const;
bool getAlive() const;
//Mutator Functions
void setNumber(int);
void setName(string);
void setGender(string);
void setRace(string);
void setAge(int);
void setMarried(string);
void setMarriedCount(int);
void setSpouse(string);
void setSurname(string);
void setFamilyCount(int);
void setEconType(string);
void setEconPower(int);
void setResidence(int);
void setStr(int);
void setDex(int);
void setCon(int);
void setInt(int);
void setWis(int);
void setCha(int);
void setAlive(bool);
private:
//Member Variables
int newNumber;
string newName;
string newGender;
string newRace;
int newAge;
string newMarried;
int newMarriedCount;
string newSpouse;
string newSurname;
int newFamilyCount;
string newEconType;
int newEconPower;
int newResidence;
int newStr;
int newDex;
int newCon;
int newInt;
int newWis;
int newCha;
bool newAlive;
};
#endif // POPULATION_H
|
Settlements Definition
#ifndef SETTLEMENTS_H
#define SETTLEMENTS_H
#include <iostream>
#include <string>
#include <vector>
#include "population.h"
using namespace std;
class settlements
{
public:
//Default Constructor
settlements();
//Overload Constructors
settlements(int number, string name, int popCount, string align, string type, int servRating, int dockRating, int laborRating, int commRating, int healRating, int relRating, int govRating, int milRating, int crimeRating);
settlements(int);
//Destructor
~settlements();
//Accessor Function
int getNumber() const;
string getName() const;
int getPopCount() const;
string getAlign() const;
string getType() const;
int getServRating() const;
int getDockRating() const;
int getLaborRating() const;
int getCommRating() const;
int getHealRating() const;
int getRelRating() const;
int getGovRating() const;
int getMilRating() const;
int getCrimeRating() const;
//Mutator Functions
void setNumber(int);
void setName(string);
void setPopCount(int);
void setAlign(string);
void setType(string);
void setServRating(int);
void setDockRating(int);
void setLaborRating(int);
void setCommRating(int);
void setHealRating(int);
void setRelRating(int);
void setGovRating(int);
void setMilRating(int);
void setCrimeRating(int);
void popUpkeep(vector<population>& world, vector<settlements>& cities);
private:
//Member Variables
int newNumber;
string newName;
int newPopCount;
string newAlign;
string newType;
int newServRating;
int newDockRating;
int newLaborRating;
int newCommRating;
int newHealRating;
int newRelRating;
int newGovRating;
int newMilRating;
int newCrimeRating;
};
#endif // SETTLEMENTS_H
--------------------------------------------------------------------------------
Function to set upkeep the settlement population with the number of citizens that have been identified as having that settlement as their home.
void settlements::popUpkeep(vector<population>& newWorld, vector<settlements>& newCities){
for(int x = 0; x < newCities.size(); x++){
for(int i = 0; i < newWorld.size(); i++){
if(newWorld[i].getResidence == newCities[x].getNumber()){
newCities[x].setPopCount() = newCities[x].getPopCount() + 1;
}
}
}
} |