-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayerUnit.cpp
106 lines (80 loc) · 1.58 KB
/
PlayerUnit.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//---------------------------------------------------------------------------
#pragma hdrstop
#include "PlayerUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
CPlayer::CPlayer()
{
Name = "";
Score = 0;
Advantage = 0;
Penalty = 0;
}
void CPlayer::SetName(AnsiString n)
{
CPlayer::Name = n;
}
AnsiString CPlayer::GetName()
{
return CPlayer::Name;
}
void CPlayer::SetScore(int s)
{
Score = s;
}
int CPlayer::GetScore()
{
return Score;
}
void CPlayer::SetAdvantage(int a)
{
Advantage = a;
}
int CPlayer::GetAdvantage()
{
return Advantage;
}
void CPlayer::SetPenalty(int p)
{
Penalty = p;
}
int CPlayer::GetPenalty()
{
return Penalty;
}
void CPlayer::PlusScore(int s)
{
((Score + s) < 0) ? Score = 0 : Score += s;
}
void CPlayer::PlusAdvantage(int a)
{
((Advantage + a) < 0) ? Advantage = 0 : Advantage += a;
}
void CPlayer::PlusPenalty(int p)
{
((Penalty + p) < 0) ? Penalty = 0 : Penalty += p;
}
/*
void CPlayer::MinusScore(int s)
{
((Score - s) < 0) ? Score = 0 : Score -= s;
}
void CPlayer::MinusAdvantage(int a)
{
((Advantage - a) < 0) ? Advantage = 0 : Advantage -= a;
}
void CPlayer::MinusPenalty(int p)
{
((Penalty - p) < 0) ? Penalty = 0 : Penalty -= p;
}
*/
void CPlayer::ResetScores()
{
Score = 0;
Advantage = 0;
Penalty = 0;
}
AnsiString CPlayer::GetAllScores()
{
return IntToStr(Score) + " " + IntToStr(Advantage) + " " + IntToStr(Penalty);
}