-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCardThree.cpp
76 lines (55 loc) · 1.75 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "CardThree.h"
#include"Ladder.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
}
CardThree::~CardThree(void)
{
}
void CardThree::ReadCardParameters(Grid* pGrid)
{
//ammar msh kateb 7aga hena
///TODO: Implement this function as mentioned in the guideline steps (numbered below) below
// == Here are some guideline steps (numbered below) (numbered below) to implement this function ==
// 1- Get a Pointer to the Output Interfaces from the Grid
Output* pOut = pGrid->GetOutput();
// Don't forget to first print to a descriptive message to the user
pOut->PrintMessage("New CardThree: Move forward to next Ladder if exist");
// 3- Clear the status bar
pOut->ClearStatusBar();
}
void CardThree::Apply(Grid* pGrid, Player* pPlayer)
{
///TODO: Implement this function as mentioned in the guideline steps (numbered below) below
// == Here are some guideline steps (numbered below) (numbered below) to implement this function ==
// 1- Call Apply() of the base class Card to print the message that you reached this card number
Card::Apply(pGrid, pPlayer);
// 2- Go to next ladder
Input* pIn = pGrid->GetInput();
Output* pOut = pGrid->GetOutput();
Ladder* pLadder = pGrid->GetNextLadder(position);
if (pLadder == NULL)
{
return;
}
else
{
pGrid->UpdatePlayerCell(pPlayer, pLadder->GetPosition());
pLadder->Apply(pGrid, pPlayer);
}
}
Card* CardThree::CopyParameters(CellPosition position)
{
Card* pCard = new CardThree(position);
pCard->SetCardNumber(cardNumber);
return pCard;
}
void CardThree::Save(ofstream& OutFile, int type)
{
if (type == 2)
{
Card::Save(OutFile, type);
OutFile << endl;
}
}