-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOutput.cpp
More file actions
91 lines (77 loc) · 4.21 KB
/
Copy pathOutput.cpp
File metadata and controls
91 lines (77 loc) · 4.21 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
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
#include "Output.h"
#include "Country.h"
#include "player.h"
#include <iomanip>
using namespace std;
void Output::PlayerStats(Player p)
{
cout << p.getID() << endl << endl;
for (size_t i = 0; i < p.GetCountries().size(); i++)
{
if (i == 0)
{
cout << setw(15) << "| Country (Number of Armies)| Surrounding Countries -> Player (Number of Armies)|" << endl;
cout << left << "\n-----------------------------------------------------------------------------------------------------------------------" << endl << endl;
}
cout << setw(2) << i+1 << " | " << right << setw(21) << p.GetCountries().at(i)->getName() << " (" << p.GetCountries().at(i)->getNumberOfPieces() << ") | ";
for (int index = 0; index < p.GetCountries().at(i)->getAdjacentCount(); index++)
{
cout << p.GetCountries().at(i)->getAdjacentCountry(index)->getName() << "->" << p.GetCountries().at(i)->getAdjacentCountry(index)->occupiedBy->name << " (" << p.GetCountries().at(i)->getAdjacentCountry(index)->getNumberOfPieces() << ") | ";
}
cout << left << "\n-----------------------------------------------------------------------------------------------------------------------" << endl << endl;
}
}
void Output::attackPlayerStats(Player p)
{
cout << "Player: " << p.getID() << endl << endl;
for (size_t i = 0; i < p.GetCountries().size(); i++)
{
if (i == 0)
{
cout << setw(15) << "| Country (Number of Armies)| Surrounding Countries -> Player (Number of Armies)|" << endl;
cout << left << "\n-----------------------------------------------------------------------------------------------------------------------" << endl << endl;
}
cout << setw(2) << i + 1 << " | " << right << setw(21) << p.GetCountries().at(i)->getName() << " (" << p.GetCountries().at(i)->getNumberOfPieces() << ") | ";
for (int index = 0; index < p.GetCountries().at(i)->getAdjacentCount(); index++)
{
if (p.name != p.GetCountries().at(i)->getAdjacentCountry(index)->occupiedBy->name)
cout << p.GetCountries().at(i)->getAdjacentCountry(index)->getName() << "->" << p.GetCountries().at(i)->getAdjacentCountry(index)->occupiedBy->name << " (" << p.GetCountries().at(i)->getAdjacentCountry(index)->getNumberOfPieces() << ") | ";
}
cout << left << "\n-----------------------------------------------------------------------------------------------------------------------" << endl << endl;
}
}
void Output::fortificationPlayerStats(Player p)
{
cout << "Player: " << p.getID() << endl << endl;
for (size_t i = 0; i < p.GetCountries().size(); i++)
{
if (i == 0)
{
cout << setw(15) << "| Country (Number of Armies)| Surrounding Countries -> Player (Number of Armies)|" << endl;
cout << left << "\n-----------------------------------------------------------------------------------------------------------------------" << endl << endl;
}
cout << setw(2) << i + 1 << "| " << right << setw(21) << p.GetCountries().at(i)->getName() << " (" << p.GetCountries().at(i)->getNumberOfPieces() << ") | ";
for (int index = 0; index < p.GetCountries().at(i)->getAdjacentCount(); index++)
{
if (p.name == p.GetCountries().at(i)->getAdjacentCountry(index)->occupiedBy->name)
cout << p.GetCountries().at(i)->getAdjacentCountry(index)->getName() << "->" << p.GetCountries().at(i)->getAdjacentCountry(index)->occupiedBy->name << " (" << p.GetCountries().at(i)->getAdjacentCountry(index)->getNumberOfPieces() << ") | ";
}
cout << left << "\n-----------------------------------------------------------------------------------------------------------------------" << endl << endl;
}
}
void Output::NewLine()
{
cout << endl;
}
void Output::StartMenu()
{
cout << "================================================================================" << endl;
cout << " RRRRRRR II SSSSSS KK KK TM" << endl;
cout << " RR RR II SS KK KK" << endl;
cout << " RRRRRRR II SSSSSS KKKKK" << endl;
cout << " RR RR II SS KK KK" << endl;
cout << " RR RR II SSSSSS KK KK" << endl;
cout << "================================================================================" << endl;
cout << endl;
cout << "Welcome to Risk!" << endl << endl;
}