From 4552ebd79c4ceb811036e0450c8b2e8252b08da3 Mon Sep 17 00:00:00 2001 From: dmitry Date: Mon, 31 Jan 2022 22:00:07 +0300 Subject: [PATCH] graph: auto acquire editor rights via menu --- src/control.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/control.cpp b/src/control.cpp index 9b0daa8..34a3000 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -893,13 +893,20 @@ int BotControl::menuMain (int item) { int BotControl::menuFeatures (int item) { closeMenu (); // reset menu display + auto autoAcquireEditorRights = [&] () { + if (!graph.hasEditor ()) { + graph.setEditor (m_ent); + } + return graph.hasEditor () && graph.getEditor () == m_ent ? Menu::NodeMainPage1 : Menu::Features; + }; + switch (item) { case 1: showMenu (Menu::WeaponMode); break; case 2: - showMenu (graph.hasEditor () ? Menu::NodeMainPage1 : Menu::Features); + showMenu (autoAcquireEditorRights ()); break; case 3: