Permalink
Browse files

update last tool and drawMode when clicking too, fixes some issues

  • Loading branch information...
jacob1 committed Oct 10, 2015
1 parent d4e3196 commit 66863b75786000e37a187bdb2a8685ed17b37ef4
Showing with 11 additions and 0 deletions.
  1. +5 −0 src/gui/game/GameController.cpp
  2. +1 −0 src/gui/game/GameController.h
  3. +5 −0 src/gui/game/GameView.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;
@@ -105,6 +105,7 @@ class GameController: public ClientListener
std::vector<Menu*> 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);
@@ -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)

0 comments on commit 66863b7

Please sign in to comment.