-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardFive.cpp
More file actions
37 lines (29 loc) · 706 Bytes
/
CardFive.cpp
File metadata and controls
37 lines (29 loc) · 706 Bytes
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
#include "CardFive.h"
#include "Player.h"
CardFive::CardFive(const CellPosition& pos) : Card(pos)
{
cardNumber = 5;
}
CardFive::~CardFive()
{
}
void CardFive::Apply(Grid* pGrid, Player* pPlayer)
{
Output* pOut = pGrid->GetOutput();
Card::Apply(pGrid, pPlayer);
pOut->PrintMessage("Move backward with the rolled dice number...");
CellPosition NewPosition = pPlayer->GetCell()->GetCellPosition();
NewPosition.AddCellNum(-2 * pPlayer->GetjustRolledDiceNum());
pGrid->UpdatePlayerCell(pPlayer, NewPosition);
}
void CardFive::Save(ofstream& OutFile, int Type)
{
if (Type == 2) {
Card::Save(OutFile, Type);
OutFile << endl;
}
}
void CardFive::Load(ifstream& Infile)
{
Card::Load(Infile);
}