diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index 5db98471f..11497e417 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -1061,6 +1061,11 @@ void GameController::SetActiveTool(int toolSelection, Tool * tool) ((PropertyTool *)tool)->OpenWindow(gameModel->GetSimulation()); } +void GameController::SetLastTool(Tool * tool) +{ + gameModel->SetLastTool(tool); +} + int GameController::GetReplaceModeFlags() { return gameModel->GetSimulation()->replaceModeFlags; diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h index 127105384..c3fb71274 100644 --- a/src/gui/game/GameController.h +++ b/src/gui/game/GameController.h @@ -105,6 +105,7 @@ public: std::vector GetMenuList(); Tool * GetActiveTool(int selection); void SetActiveTool(int toolSelection, Tool * tool); + void SetLastTool(Tool * tool); int GetReplaceModeFlags(); void SetReplaceModeFlags(int flags); void ActiveToolChanged(int toolSelection, Tool *tool); diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 0f448239d..d1a072b11 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -1122,12 +1122,17 @@ void GameView::OnMouseDown(int x, int y, unsigned button) } if (currentMouse.X >= 0 && currentMouse.X < XRES && currentMouse.Y >= 0 && currentMouse.Y < YRES) { + // update tool index, set new "last" tool so GameView can detect certain tools properly if (button == BUTTON_LEFT) toolIndex = 0; if (button == BUTTON_RIGHT) toolIndex = 1; if (button == BUTTON_MIDDLE) toolIndex = 2; + Tool *lastTool = c->GetActiveTool(toolIndex); + c->SetLastTool(lastTool); + UpdateDrawMode(); + isMouseDown = true; c->HistorySnapshot(); if (drawMode == DrawRect || drawMode == DrawLine)