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 {
4545 void checkCargo (); // NOT IMPLEMENTED
4646 void buy (); // NOT IMPLEMENTED
4747 void sell (); // NOT IMPLEMENTED
48+ bool exitGame ();
4849
4950 std::unique_ptr<Player> player_;
5051 std::unique_ptr<Time> time_;
Original file line number Diff line number Diff line change @@ -102,6 +102,9 @@ Game::MenuOption Game::selectOption() {
102102 sell ();
103103 break ;
104104 case MenuOption::Exit :
105+ if (exitGame () == false ) {
106+ menuOption_ = MenuOption::NoChoose;
107+ }
105108 break ;
106109 default :
107110 std::cout << " Option doesn't exists\n " ;
@@ -135,6 +138,18 @@ Game::ConfirmOption Game::confirmOption(std::string announcemen) {
135138 return ConfirmOption::Error;
136139}
137140
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+
138153void Game::travel () {
139154
140155}
You can’t perform that action at this time.
0 commit comments