From 9f8804390d9ad183a05dc5f4d8f99627e71a791e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 13 Aug 2009 16:41:39 +0000 Subject: improved menu ESC handling --- src/client/playerview.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/client/playerview.cc') diff --git a/src/client/playerview.cc b/src/client/playerview.cc index e75cd47..889e4d4 100644 --- a/src/client/playerview.cc +++ b/src/client/playerview.cc @@ -19,8 +19,6 @@ PlayerView::PlayerView(ui::Widget *parent) : ui::Widget(parent) set_border(false); set_background(false); - view_lastentity = 0; - view_notify = new Notifications(this); view_hud = new HUD(this); @@ -52,8 +50,6 @@ void PlayerView::clear() view_chat->hide(); view_map->hide(); view_entitymenu->hide(); - - view_lastentity = 0; } void PlayerView::event_text(const std::string & text) @@ -198,19 +194,18 @@ void PlayerView::draw() label_viewname->show(); - if (view_lastentity != core::localplayer()->view()) { + if (view_entitymenu->generated_entity() != core::localplayer()->view()) { // initially show the menu show_menu("main"); map()->hide(); chat()->hide(); audio::play("ui/menu"); - view_lastentity = core::localplayer()->view(); } else if (!view_entitymenu->visible() && !view_buymenu->visible() && !map()->visible() && (!chat()->visible() || chat()->small_view()) ) { // show the menu if there's no other window open - menu()->show(); + view_entitymenu->show(); audio::play("ui/menu"); } @@ -219,8 +214,6 @@ void PlayerView::draw() } else { // entity without menus, plain view - view_lastentity = 0; - this->hide(); return; } @@ -231,6 +224,11 @@ void PlayerView::draw() if (view_entitymenu->visible()) { view_entitymenu->hide(); } + + if (view_entitymenu->generated_entity()) { + view_entitymenu->generate(0,0); + } + if (view_buymenu->visible()) { view_buymenu->hide(); } @@ -247,7 +245,6 @@ void PlayerView::draw() } view_hud->show(); - view_lastentity = 0; } // reposition chat widget -- cgit v1.2.3