forked from ahmedibrahim404/Snakes_Ladders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardThree.cpp
44 lines (30 loc) · 850 Bytes
/
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) : Card(pos) // set the cell position of the card
{
cardNumber = 3; // set the inherited cardNumber data member with the card number (3 here)
}
CardThree::~CardThree(void)
{
}
void CardThree::ReadCardParameters(Grid* pGrid)
{
}
void CardThree::Apply(Grid* pGrid, Player* pPlayer)
{
Card::Apply(pGrid, pPlayer);
Output* pOut = pGrid->GetOutput();
pOut->PrintMessage("Player " + to_string(pPlayer->getPlayerNumber()) + ": You will play again");
pGrid->RollCurrentPlayer();
}
Card* CardThree::GetCopy(CellPosition& Pos)
{
return new CardThree(Pos);
}
void CardThree::Save(ofstream& OutFile)
{
OutFile << this->GetCardNumber() << "\t" << this->position.GetCellNum() << "\n";
}
void CardThree::Load(ifstream& Infile, Grid* pGrid)
{
pGrid->AddObjectToCell(this);
}