-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSwitchToDesignModeAction.cpp
41 lines (35 loc) · 1.01 KB
/
SwitchToDesignModeAction.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
#include "SwitchToDesignModeAction.h"
#include "Grid.h"
#include "Output.h"
#include "Input.h"
#include "Player.h"
SwitchToDesignModeAction::SwitchToDesignModeAction(ApplicationManager* pApp) : Action(pApp)
{
// Initializes the pManager pointer of Action with the passed pointer
}
void SwitchToDesignModeAction::ReadActionParameters()
{
}
void SwitchToDesignModeAction::Execute()
{
// Get a Pointer to the Input / Output Interfaces
Grid* pGrid = pManager->GetGrid();
Output* pOut = pGrid->GetOutput();
Input* pIn = pGrid->GetInput();
pOut->PrintMessage("Are you sure you want to end this game? y/n");
string choice = pIn->getString(pOut);
if (tolower(choice[0]) == 'y') {
pOut->ClearStatusBar();
pOut->CreateDesignModeToolBar();
pManager->ExecuteAction(NEW_GAME);
}
else if(tolower(choice[0]) == 'n'){
pOut->ClearStatusBar();
}
else {
pGrid->PrintErrorMessage("The value you entered is invalid, Try again with a valid one, Click to continue...");
}
}
SwitchToDesignModeAction::~SwitchToDesignModeAction()
{
}