-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPeopleCommand.cpp
More file actions
48 lines (34 loc) · 1.34 KB
/
Copy pathPeopleCommand.cpp
File metadata and controls
48 lines (34 loc) · 1.34 KB
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
#include "Company.h"
#include "PeopleCommand.h"
#include "Person.h"
#include "MasterState.h"
#include "Trait.h"
#include <stdio.h>
#include <vector>
using std::vector;
#include <iostream>
using std::cout;
PeopleCommand::PeopleCommand(MasterState *masterState) : CommandFunctor(masterState, "applicants", "Tells you information about known people.") {
}
void PeopleCommand::executeCommand(const char *line) {
vector<Person *> *allPeople = this->_masterState->getPlayerCompany()->getKnownPeople();
for (vector<Person *>::iterator it = allPeople->begin(); it != allPeople->end(); ++it) {
Person *currentPerson = *it;
char message[100];
sprintf(message, "%s %s", currentPerson->getFirstName().c_str(), currentPerson->getLastName().c_str());
this->_masterState->addMessage(message);
Company *company = currentPerson->getCompany();
list<Trait *> *personTraits;
if (company && company == this->_masterState->getPlayerCompany())
personTraits = currentPerson->getRealTraits();
else
personTraits = currentPerson->getBelievedTraits();
for (list<Trait *>::iterator it2 = personTraits->begin(); it2 != personTraits->end(); ++it2) {
Trait *t = *it2;
sprintf(message, " %10s: %s", t->getName().c_str(), t->getDiscoveryModifiedText().c_str());
this->_masterState->addMessage(message);
}
}
}
PeopleCommand::~PeopleCommand() {
}