-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPasteCardAction.cpp
40 lines (28 loc) · 986 Bytes
/
PasteCardAction.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
#include "PasteCardAction.h"
#include"Card.h"
#include"Grid.h"
#include"AddCardAction.h"
#include "CardOne.h"
PasteCardAction::PasteCardAction(ApplicationManager* pApp) :Action(pApp) {
} // Constructor
void PasteCardAction::ReadActionParameters() {
Grid* pGrid = pManager->GetGrid();
Output* pOut = pGrid->GetOutput();
Input* pIn = pGrid->GetInput();
pOut->PrintMessage("Click On your selected Cell...");
PasteTo = pIn->GetCellClicked();//gets the postion to paste in
pOut->ClearStatusBar();
}
void PasteCardAction::Execute() {
ReadActionParameters();
Grid* pGrid = pManager->GetGrid();
if (pGrid->GetClipboard() != NULL) //checks if there is card in the clipboard
{
Card* pCard = pGrid->GetClipboard()->CopyCard(PasteTo);
pGrid->AddObjectToCell(pCard);
}
else
pManager->GetGrid()->PrintErrorMessage("No Cards In Clipboard! click to continue...");
} // Executes action (code depends on action type so virtual)
PasteCardAction:: ~PasteCardAction() {
}