Skip to content

Commit

Permalink
update last tool and drawMode when clicking too, fixes some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Oct 10, 2015
1 parent d4e3196 commit 66863b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/game/GameController.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/gui/game/GameController.h
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/gui/game/GameView.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 66863b7

Please sign in to comment.