From cdc100ff4a0ceecae2ee2cecaf9df6b82b8636e4 Mon Sep 17 00:00:00 2001 From: Dušan Ďurech Date: Sun, 27 Dec 2009 20:49:44 +0100 Subject: implements yes/no dialog if to quit the game or not --- src/screen/world.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/screen') diff --git a/src/screen/world.c b/src/screen/world.c index 1aaa2cc..c2615c8 100644 --- a/src/screen/world.c +++ b/src/screen/world.c @@ -28,6 +28,7 @@ #include "pauza.h" #include "term.h" #include "saveDialog.h" +#include "yes_no_dialog.h" #include "saveLoad.h" #ifndef NO_SOUND @@ -205,6 +206,7 @@ void world_draw() pauza_draw(); term_draw(); save_dialog_draw(); + yes_no_dialog_draw(); } static void netAction(tux_t *tux, int action) @@ -346,7 +348,9 @@ void world_event() net_multiplayer_event(); - if (pauza_is_active() == FALSE && save_dialog_is_active() == FALSE) { + if (pauza_is_active() == FALSE && + save_dialog_is_active() == FALSE && + yes_no_dialog_is_active() == FALSE) { arena_event(arena); /*module_event();*/ } @@ -366,13 +370,28 @@ void world_event() pauza_event(); term_event(); save_dialog_event(); + yes_no_dialog_event(); } -static void hotkey_escape() +void dialog_yes(void *p) { + UNUSED(p); + world_do_end(); } +void dialog_no(void *p) +{ + UNUSED(p); +} + +static void hotkey_escape() +{ + yes_no_dialog_set("Naozaj chete ukoncit hru ?", dialog_yes, dialog_no, NULL); + yes_no_dialog_set_active(TRUE); + //world_do_end(); +} + void startWorld() { arena = NULL; @@ -387,6 +406,8 @@ void startWorld() setGameType(); + yes_no_dialog_init(); + if (net_multiplayer_get_game_type() == NET_GAME_TYPE_NONE) { save_dialog_init(); } @@ -448,6 +469,8 @@ void stoptWorld() pauza_quit(); term_quit(); + yes_no_dialog_quit(); + if (net_multiplayer_get_game_type() == NET_GAME_TYPE_NONE) { save_dialog_quit(); } -- cgit v1.2.3