From 688b4bec306c33b13e57f134903fbd2f45fdcaed Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 14 Jun 2020 15:23:16 -0400 Subject: [PATCH] Fix bug with line tool while WIND is selected (id:2554353) --- src/gui/game/GameView.cpp | 43 ++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 4b815d492..dc018332a 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -487,38 +487,28 @@ bool GameView::GetPlacingZoom() void GameView::NotifyActiveToolsChanged(GameModel * sender) { - decoBrush = false; for (size_t i = 0; i < toolButtons.size(); i++) { auto *tool = toolButtons[i]->tool; - if(sender->GetActiveTool(0) == tool) - { - toolButtons[i]->SetSelectionState(0); //Primary - windTool = tool->GetIdentifier() == "DEFAULT_UI_WIND"; - - if (sender->GetActiveTool(0)->GetIdentifier().BeginsWith("DEFAULT_DECOR_")) - decoBrush = true; - } - else if(sender->GetActiveTool(1) == tool) - { - toolButtons[i]->SetSelectionState(1); //Secondary - if (sender->GetActiveTool(1)->GetIdentifier().BeginsWith("DEFAULT_DECOR_")) - decoBrush = true; - } - else if(sender->GetActiveTool(2) == tool) - { - toolButtons[i]->SetSelectionState(2); //Tertiary - } - else if(sender->GetActiveTool(3) == tool) - { - toolButtons[i]->SetSelectionState(3); //Replace Mode - } + // Primary + if (sender->GetActiveTool(0) == tool) + toolButtons[i]->SetSelectionState(0); + // Secondary + else if (sender->GetActiveTool(1) == tool) + toolButtons[i]->SetSelectionState(1); + // Tertiary + else if (sender->GetActiveTool(2) == tool) + toolButtons[i]->SetSelectionState(2); + // Replace Mode + else if (sender->GetActiveTool(3) == tool) + toolButtons[i]->SetSelectionState(3); + // Not selected at all else - { toolButtons[i]->SetSelectionState(-1); - } } + decoBrush = sender->GetActiveTool(0)->GetIdentifier().BeginsWith("DEFAULT_DECOR_"); + if (sender->GetRenderer()->findingElement) { Tool *active = sender->GetActiveTool(0); @@ -1037,6 +1027,9 @@ void GameView::OnMouseDown(int x, int y, unsigned button) return; Tool *lastTool = c->GetActiveTool(toolIndex); c->SetLastTool(lastTool); + windTool = lastTool->GetIdentifier() == "DEFAULT_UI_WIND"; + decoBrush = lastTool->GetIdentifier().BeginsWith("DEFAULT_DECOR_"); + UpdateDrawMode(); isMouseDown = true;