-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCut.cpp
More file actions
46 lines (38 loc) · 1.07 KB
/
Copy pathCut.cpp
File metadata and controls
46 lines (38 loc) · 1.07 KB
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
#include "Cut.h"
#include "Action.h"
#include "Grid.h"
#include "CellPosition.h"
void Cut::ReadActionParameters()
{
Grid* pGride = pManager->GetGrid();
Input* pInp = pGride->GetInput();
pGride->GetOutput()->PrintMessage("Click on Cell to Cut");
cutcell = pInp->GetCellClicked();
if (!cutcell.IsValidCell()) //checks if the cell is valid
{
pGride->PrintErrorMessage("The Cell is Inavled");
return;
}
}
void Cut::Execute()
{
Grid* pGride = pManager->GetGrid();
ReadActionParameters();
if (!cutcell.IsValidCell()) //checks if the cell is valid
{
pGride->PrintErrorMessage("The Cell is Inavled");
return;
}
GameObject* cutOBJ = pGride->getGameobject(cutcell);
if (cutOBJ == __nullptr) //checks if the cell contains any object
{
pGride->PrintErrorMessage("The Cell does not contain any objects");
return;
}
pGride->SetClipboard(cutOBJ); //sets the clipboard
pGride->RemoveObjectFromCell(cutcell); //delete the object from the cell
pGride->GetOutput()->PrintMessage("Object cutted successfully");
}
Cut::~Cut()
{
}