-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.cpp
More file actions
71 lines (59 loc) · 1006 Bytes
/
Copy pathGame.cpp
File metadata and controls
71 lines (59 loc) · 1006 Bytes
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
#include "Team.hpp"
#include "Game.hpp"
#include <iostream>
using namespace std;
Game::Game(Team *winner, Team *loser, int winningScore, int losingScore, char turf)
{
_winner = winner;
_loser = loser;
_winningScore = winningScore;
_losingScore = losingScore;
_turf = turf;
winner->addGame(this);
loser->addGame(this);
}
Team *Game::winner()
{
return _winner;
}
Team *Game::loser()
{
return _loser;
}
bool Game::isWinner(Team *team)
{
// cout << "Compare " << team->id() << ", " << _winner->id() << endl;
if(team->id() == _winner->id())
return true;
else
return false;
}
bool Game::isPlayer(Team *team)
{
if(team->id() == _winner->id() || team->id() == _loser->id())
return true;
else
return false;
}
Team *Game::otherPlayer(Team *team)
{
if(team->id() == _winner->id())
return _loser;
else
return _winner;
}
int Game::winningScore()
{
return _winningScore;
}
int Game::losingScore()
{
return _losingScore;
}
char Game::turf()
{
return _turf;
}
Game::~Game()
{
}