-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCardFour.cpp
50 lines (38 loc) · 1.08 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
42
43
44
45
46
47
48
49
50
#include "CardFour.h"
CardFour::CardFour(const CellPosition& pos) : Card(pos) // set the cell position of the card
{
cardNumber = 4; //sets the inherited cardNumber data member with the card number
}
Card* CardFour::GetCopy(const CellPosition& pos)
{
return new CardFour(pos);
}
void CardFour::ReadCardParameters(Grid* pGrid)
{
//No Parameters for CardFour
}
void CardFour::Apply(Grid* pGrid, Player* pPlayer)
{
Card::Apply(pGrid, pPlayer);
// Printing a message showing the player the details of card four
pGrid->PrintErrorMessage("This card prevents player " + to_string(pPlayer->GetPlayerNum()) + " from rolling next turn. Click to continue...");
// Preventing the player from rolling next turn
pPlayer->PreventNextTurn(true);
}
void CardFour::Save(ofstream& outFile, ObjectType ObjType)
{
if (ObjType == Cards)
{
// Calling the parent class save function that saves the type and cell to the file
Card::Save(outFile, ObjType);
// No Card Parameters here
outFile << std::endl;
}
}
void CardFour::Load(ifstream& InFile)
{
Card::Load(InFile);
}
CardFour::~CardFour(void)
{
}