From fc493e288c24c4296d97b99d6c32424c8a5f9cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2=20?= =?UTF-8?q?=D0=A1=D1=83=D1=85=D0=BE=D0=B2?= <22411953+Vladislav4KZ@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:17:52 +0600 Subject: [PATCH] fix: toggling t and ct important flags when there are other flags on the node (#405) fix: removed unnecessary condition for toggling the camp flag --- src/control.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/control.cpp b/src/control.cpp index 688c1e7..4848f8e 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -1447,7 +1447,7 @@ int BotControl::menuGraphFlag (int item) { break; case 2: - if (graph[nearest].flags == NodeFlag::CTOnly) { + if (graph[nearest].flags & NodeFlag::CTOnly) { graph.toggleFlags (NodeFlag::CTOnly); graph.toggleFlags (NodeFlag::TerroristOnly); } @@ -1458,7 +1458,7 @@ int BotControl::menuGraphFlag (int item) { break; case 3: - if (graph[nearest].flags == NodeFlag::TerroristOnly) { + if (graph[nearest].flags & NodeFlag::TerroristOnly) { graph.toggleFlags (NodeFlag::TerroristOnly); graph.toggleFlags (NodeFlag::CTOnly); } @@ -1503,20 +1503,13 @@ int BotControl::menuGraphFlag (int item) { case 9: // if the node doesn't have a camp flag, set it and open the camp directions selection menu - if (!(graph[nearest].flags & NodeFlag::Crossing) && !(graph[nearest].flags & NodeFlag::Camp)) { - graph.toggleFlags (NodeFlag::Crossing); - graph.toggleFlags (NodeFlag::Camp); - showMenu (Menu::CampDirections); - break; - } - else if ((graph[nearest].flags & NodeFlag::Crossing) && !(graph[nearest].flags & NodeFlag::Camp)) { + if (!(graph[nearest].flags & NodeFlag::Camp)) { graph.toggleFlags (NodeFlag::Camp); showMenu (Menu::CampDirections); break; } // otherwise remove the flag, and don't show the camp directions selection menu else { - graph.toggleFlags (NodeFlag::Crossing); graph.toggleFlags (NodeFlag::Camp); showMenu (Menu::NodeFlag); break;