-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardTwo.cpp
44 lines (37 loc) · 982 Bytes
/
CardTwo.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
#include "CardTwo.h"
#include "Ladder.h"
CardTwo::CardTwo(const CellPosition & pos) : Card(pos) // set the cell position of the card
{
cardNumber = 2; // set the inherited cardNumber data member with the card number
}
CardTwo::~CardTwo(void)
{
}
void CardTwo::ReadCardParameters(Grid * pGrid)
{
//No Card parameters
}
Card* CardTwo::GetCopy() {
return new CardTwo(position);
}
void CardTwo::Apply(Grid* pGrid, Player* pPlayer)
{
Card::Apply(pGrid, pPlayer);
Ladder* NextLadder=pGrid->GetNextLadder(position);//setting the pointer to point on the Nextladder if any
if(NextLadder==NULL)
{
return;
}
else
{
pPlayer->Move(pGrid,(NextLadder->GetPosition().GetCellNum()-position.GetCellNum()));//Move the current player to the nextt ladder
}
}
void CardTwo::Save(ofstream& OutFile, const CellPosition& startCellPos)
{
Card::Save(OutFile, startCellPos);
OutFile << endl;
}
void CardTwo::Load(ifstream& Infile)
{
}