-
Notifications
You must be signed in to change notification settings - Fork 2
/
CharacterManager.cpp
85 lines (64 loc) 路 1.35 KB
/
CharacterManager.cpp
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
#pragma once
#ifndef CHARACTER_MANAGER_CPP
#define CHARACTER_MANAGER_CPP
/* WorldSim: CharacterManager.cpp
#include "CharacterManager.cpp"
Container for storing groups of Characters, called a population. A population is a group of people who live in the same area. They will share culture, language, technology, etc. A Character can only belong to one population. A population does not have a fixed race.
Could be further subdivided into cultural groups.
*/
#include "Character.hpp"
class CharacterManager
{
public:
// The name the population calls themselves.
std::string name;
//culture
//religion
//language
//leadership and government
Character* leader;
Vector <Character*> vPopulation;
CharacterManager()
{
name="?POPULATION?";
leader=0;
}
Character* get(int i)
{
if (vPopulation.isSafe(i))
{
return vPopulation(i);
}
return 0;
}
void add(Character* _character)
{
vPopulation.push(_character);
}
void clear()
{
vPopulation.clear();
}
int size()
{
return vPopulation.size();
}
bool chooseLeader()
{
// build candidates and then make a story to explain how the leader was chosen.
if ( vPopulation.size() > 0 )
{
// select one randomly for now.
}
return true;
}
bool hasLeader()
{
if (leader==0 || leader->isAlive==false)
{
return false;
}
return true;
}
};
#endif