Skip to content

Commit 5102ac7

Browse files
committed
Saving before removing VictoryPointsWithoutCards()
1 parent 2413d36 commit 5102ac7

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/Player.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,13 @@ bool Player::canBuyRoad(){
140140

141141
/**
142142
* Subtracts the cost of a road from a player's resources if they have enough
143-
* @return true if the resources were subtracted, false otherwise
143+
* @return true if the resources were subtracted, false if the player had insufficient resources
144144
*/
145145
bool Player::buyRoad(){
146146
if(canBuyRoad()){
147147
addMultiple(-1,-1,0,0,0);
148148
return true;
149149
}
150-
//insufficient funds
151150
return false;
152151
}
153152

@@ -160,49 +159,52 @@ bool Player::canBuySettlement(){
160159
}
161160

162161
/**
163-
* Returns the number of knight cards this player has played
162+
* @return The number of knight cards this player has played
164163
*/
165164
int Player::getArmySize() const{
166165
return armySize;
167166
}
168167

169168
/**
170-
* Returns true if this player has the largest army, false otherwise
169+
* @return True if this player has the largest army, false otherwise
171170
*/
172171
bool Player::hasLargestArmy() const{
173172
return largestArmy;
174173
}
175174

176175
/**
177176
* Sets whether or not this player has the largest army
177+
* @param newVal The value of the largest army in the game
178178
*/
179179
void Player::setLargestArmy(bool newVal){
180180
largestArmy = newVal;
181181
}
182182

183183
/**
184-
* Returns the size of this player's longest road
184+
* @return The size of this player's longest road
185185
*/
186186
int Player::getLongestRoadSize() const{
187187
return longestRoadSize;
188188
}
189189

190190
/**
191-
* Returns true if this player has the longet road, false otherwise
191+
* @return True if this player has the longet road, false otherwise
192192
*/
193193
bool Player::hasLongestRoad() const{
194194
return longestRoad;
195195
}
196196

197197
/**
198198
* Sets whether or not this player has the longest road
199+
* @param newVal The value of the longest road on the board
199200
*/
200201
void Player::setLongestRoad(bool newVal){
201202
longestRoad = newVal;
202203
}
203204

204205
/**
205206
* Sets how long this player's longest road is
207+
* @param newVal The value of this player's longest road
206208
*/
207209
void Player::setLongestRoadSize(int newVal){
208210
longestRoadSize = newVal;
@@ -234,7 +236,7 @@ bool Player::canBuyCity(){
234236

235237
/**
236238
* Subtracts the cost of a city from a player's resources if they have enough
237-
* @return true if the resources were subtracted, false otherwise
239+
* @return True if the resources were subtracted, false otherwise
238240
*/
239241
bool Player::buyCity(){
240242
if(canBuyCity()){
@@ -246,15 +248,15 @@ bool Player::buyCity(){
246248

247249
/**
248250
* Determine if the player has enough resources to buy a wonder.
249-
* @return True if the player has enough resources to buy a wonder, false otherwise
251+
* @return True if the player has enough resources to buy a wonder, false if the player has insufficient resources
250252
*/
251253
bool Player::canBuyWonder(){
252254
return getWood() >= 5 && getBrick() >= 5 && getWheat() >= 5 && getWool() >= 5 && getOre() >= 5;
253255
}
254256

255257
/**
256258
* Subtracts the cost of a wonder from a player's resources if they have enough
257-
* @return true if the resources were subtracted, false otherwise
259+
* @return True if the resources were subtracted, false if the player had insufficient resources
258260
*/
259261
bool Player::buyWonder(){
260262
if(canBuyWonder()){
@@ -266,15 +268,15 @@ bool Player::buyWonder(){
266268

267269
/**
268270
* Determine if the player has enough resources to buy a card.
269-
* @return True if the player has enough resources to buy a card, false otherwise
271+
* @return True if the player has enough resources to buy a card, false if the player has insufficient resources
270272
*/
271273
bool Player::canBuyCard(){
272274
return getWheat() >= 1 && getWool() >= 1 && getOre() >= 1;
273275
}
274276

275277
/**
276278
* Subtracts the cost of a card from a player's resources if they have enough
277-
* @return true if the resources were subtracted, false otherwise
279+
* @return True if the resources were subtracted, false if they player has insufficient resources
278280
*/
279281
bool Player::buyCard(){
280282
if(canBuyCard()){

0 commit comments

Comments
 (0)