-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddDangerzoneAction.cpp
More file actions
45 lines (36 loc) · 1.05 KB
/
Copy pathAddDangerzoneAction.cpp
File metadata and controls
45 lines (36 loc) · 1.05 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
#include "AddDangerzoneAction.h"
AddDangerzoneAction::AddDangerzoneAction(ApplicationManager* pApp) : Action(pApp)
{
}
void AddDangerzoneAction::ReadActionParameters()
{
// Get a pointer to the Input / Output Interfaces
Grid* pGrid = pManager->GetGrid();
Output* pOut = pGrid->GetOutput();
Input* pIn = pGrid->GetInput();
pOut->PrintMessage("New Work Shop: Click on its Cell ...");
Dangerpos = pIn->GetCellClicked();
if (!Dangerpos.IsValidCell()) {
pOut->PrintMessage("Invalid cell! Click anywhere to continue.");
pIn->GetCellClicked();
return;
}
pOut->ClearStatusBar();
}
void AddDangerzoneAction::Execute()
{
ReadActionParameters();
DangerZone* pDanger = new DangerZone(Dangerpos);
Grid* pGrid = pManager->GetGrid();
bool added = pGrid->AddObjectToCell(pDanger);
// if the GameObject cannot be added
if (!added)
{
pGrid->PrintErrorMessage("Error: Cell already has an object ! Click to continue ...");
;
// Print an appropriate message
}
}
AddDangerzoneAction::~AddDangerzoneAction()
{
}