File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ class Game {
45
45
void checkCargo (); // NOT IMPLEMENTED
46
46
void buy (); // NOT IMPLEMENTED
47
47
void sell (); // NOT IMPLEMENTED
48
+ bool exitGame ();
48
49
49
50
std::unique_ptr<Player> player_;
50
51
std::unique_ptr<Time> time_;
Original file line number Diff line number Diff line change @@ -102,6 +102,9 @@ Game::MenuOption Game::selectOption() {
102
102
sell ();
103
103
break ;
104
104
case MenuOption::Exit :
105
+ if (exitGame () == false ) {
106
+ menuOption_ = MenuOption::NoChoose;
107
+ }
105
108
break ;
106
109
default :
107
110
std::cout << " Option doesn't exists\n " ;
@@ -135,6 +138,18 @@ Game::ConfirmOption Game::confirmOption(std::string announcemen) {
135
138
return ConfirmOption::Error;
136
139
}
137
140
141
+ bool Game::exitGame () {
142
+ while (true ) {
143
+ ConfirmOption exitAnswer = confirmOption (" Are you sure you wanna exit game? Y/N" ;
144
+ if (exitAnswer == ConfirmOption::Yes) {
145
+ return true ;
146
+ }
147
+ if (exitAnswer == ConfirmOption::No) {
148
+ return false
149
+ }
150
+ }
151
+ }
152
+
138
153
void Game::travel () {
139
154
140
155
}
You can’t perform that action at this time.
0 commit comments