-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteam.h
76 lines (61 loc) · 1.46 KB
/
team.h
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
#pragma once
#include "player.h"
//a struct that contains the team name and players in the team e.t.c
struct team
{
//look for ways to solve the linker issue with the arrays
std::string prefixes[6] = {
"",
"fc","cf","sc",
"athletic" ,"ac"
};
std::string names[12] = {
"manchester" , "madrid" , "london",
"barcelona" , "bilbao" , "midland",
"turin","milan","paris" ,
"lyon","marseille","amsterdam"
};
std::string suffixes[3] = {
"", "united" , "city",
};
std::string prefix;
std::string name;
std::string suffix;
std::vector<player> players; // index 0 contains the coach
team()
{
}
team(std::string prefix , std::string name , std::string suffix)
{
this->prefix = prefix;
this->name = name;
this->suffix = suffix;
for (int i = 0; i < 12; i++)
{
srand(rand() * time(0) * rand() * time(0));
players.emplace_back(player::generate_player());
}
}
static team generate_team()
{
team t;
srand(rand() * time(0) * rand() * time(0));
int prefix_index = rand() % 6;
srand(rand() * time(0) * rand() * time(0));
int name_index = rand() % 12;
srand(rand() * time(0) * rand() * time(0));
int suffix_index = rand() % 3;
return team(t.prefixes[prefix_index], t.names[name_index], t.suffixes[suffix_index]);
}
std::string display_name()
{
return prefix + " " + name + " " + suffix;
}
void display_players()
{
for (player player : players)
{
std::cout << player.last_name + " " << player.first_name + "\n";
}
}
};