-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCardThree.cpp
42 lines (34 loc) · 1.1 KB
/
CardThree.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
#include "CardThree.h"
CardThree::CardThree(const CellPosition& pos, ApplicationManager* pApp) : Card(pos), pManager(pApp) // set the cell position of the card
{
cardNumber = 3; // set the inherited cardNumber data member with the card number
}
CardThree::~CardThree(void)
{
}
void CardThree::ReadCardParameters(Grid* pGrid)
{
//This card has no parameters
}
void CardThree::Save(ofstream& OutFile) {
OutFile <<GetCardNumber() << " " << position.VCell() << " " << position.HCell() << endl;
}
void CardThree::Load(ifstream& Infile) {
int vstart = -1, h = -1;
Infile >> vstart >> h;
position.SetHCell(h);
position.SetVCell(vstart);
}
Card* CardThree::CopyCard(CellPosition pos)
{
CardThree* ptr = new CardThree(pos, pManager);
return ptr;
}
void CardThree::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- Call appmanager's ExecuteAction to execute an extra dice roll
pGrid->PrintErrorMessage("You get an extra dice roll, click to continue...");
pManager->ExecuteAction(ROLL_DICE);
}