-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCardFour.cpp
41 lines (34 loc) · 1.02 KB
/
CardFour.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
#include "CardFour.h"
CardFour::CardFour(const CellPosition& pos) : Card(pos) // set the cell position of the card
{
cardNumber = 4; // set the inherited cardNumber data member with the card number
}
CardFour::~CardFour(void)
{
}
void CardFour::ReadCardParameters(Grid* pGrid)
{
//This card has no parameters
}
Card* CardFour::CopyCard(CellPosition pos)
{
CardFour* ptr = new CardFour(pos);
return ptr;
}
void CardFour::Save(ofstream& OutFile) {
OutFile << GetCardNumber() << " " << position.VCell() << " " << position.HCell() << endl;
}
void CardFour::Load(ifstream& Infile) {
int vstart = -1, h = -1;
Infile >> vstart >> h;
position.SetHCell(h);
position.SetVCell(vstart);
}
void CardFour::Apply(Grid* pGrid, Player* pPlayer)
{
// 1- Call Apply() of the base class Card to print the message that you reached this card number
Card::Apply(pGrid, pPlayer);
// 2- Make the turnskip of the player who stood on the card = 1
pGrid->PrintErrorMessage("You lose your next turn, click to continue...");
pPlayer->setTurnsToSkip(1);
}