fix warning

previously this happened when bringing up the quit dialog with the
Objectives (GUI2) dialog active: warning gui/event: Unhandled event 12.
This commit is contained in:
gfgtdf 2015-09-01 00:43:20 +02:00
parent a247fae572
commit e5920a1240
3 changed files with 30 additions and 1 deletions

View file

@ -417,6 +417,7 @@ void pump()
case SDL_QUIT: {
quit_confirmation::quit();
continue; //this event is already handled.
}
}

View file

@ -1,3 +1,16 @@
/*
Copyright (C) 2015 - 2015 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#include "quit_confirmation.hpp"
#include "gettext.hpp"

View file

@ -1,13 +1,28 @@
/*
Copyright (C) 2015 - 2015 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#pragma once
class CVideo;
#include <cassert>
/// Any object of this type will prevent the game from quitting immediately, instad a confirmation dialog will pop up when attepmting to close.
class quit_confirmation
{
public:
quit_confirmation() { ++count_; }
quit_confirmation(const quit_confirmation&) { ++count_; }
~quit_confirmation() { --count_; }
~quit_confirmation() { --count_; assert(count_ >= 0); }
/// Shows the quit confirmation if needed, throws CVideo::quit to exit.
static void quit();
static void quit(CVideo& video );