Commits

Ilkka Halila committed 7afff84

Added confirmation dialog to exit (unless exiting from the main menu)

  • Participants
  • Parent commits fdd2410
  • Branches v0.11

Comments (0)

Files changed (4)

Goblin Camp/include/Game.hpp

 	bool Running();
 	void Reset();
 	static void DoNothing();
-	static void Exit();
+	static void Exit(bool confirm=true);
 
 	int ScreenWidth() const;
 	int ScreenHeight() const;

Goblin Camp/src/GCamp.cpp

 		TCODConsole::root->flush();
 
 	}
-	Game::Inst()->Exit();
+	Game::Inst()->Exit(false);
 	return 0;
 }
 

Goblin Camp/src/Game.cpp

 
 void Game::DoNothing() {}
 
-void Game::Exit() {
+void Game::Exit(bool confirm) {
+	if (confirm && !Menu::YesNoDialog("Really exit?")) return;
 	Logger::End();
 	exit(0);
 }

Goblin Camp/src/Menu.cpp

 #endif
 		mainMenu->AddChoice(MenuChoice("Squads", boost::bind(UI::ChangeMenu, SquadsMenu::SquadMenu())));
 		mainMenu->AddChoice(MenuChoice("Main Menu", boost::bind(Game::ToMainMenu, true)));
-		mainMenu->AddChoice(MenuChoice("Quit", boost::bind(Game::Exit)));
+		mainMenu->AddChoice(MenuChoice("Quit", boost::bind(Game::Exit, true)));
 	}
 	return mainMenu;
 }