diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index 07ca6d0fe..fe8278883 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -126,6 +126,7 @@ GameController::GameController(): options(NULL), activePreview(NULL), localBrowser(NULL), + foundSign(NULL), HasDone(false), firstTick(true) { @@ -554,34 +555,36 @@ bool GameController::BrushChanged(int brushType, int rx, int ry) bool GameController::MouseDown(int x, int y, unsigned button) { bool ret = commandInterface->OnMouseDown(x, y, button); - ui::Point point = PointTranslate(ui::Point(x, y)); - x = point.X; - y = point.Y; - if (ret && yGetPlacingSave()) + if (ret && yGetPlacingSave() && !gameView->GetPlacingZoom()) + { + ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y)); + x = point.X; + y = point.Y; if (gameModel->GetActiveTool(0) && gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking { - sign * foundSign = GetSignAt(x, y); + foundSign = GetSignAt(x, y); if(foundSign && splitsign(foundSign->text.c_str())) return false; } + } return ret; } bool GameController::MouseUp(int x, int y, unsigned button) { bool ret = commandInterface->OnMouseUp(x, y, button); - ui::Point point = PointTranslate(ui::Point(x, y)); - x = point.X; - y = point.Y; - if (ret && yGetPlacingSave()) + if (ret && foundSign && yGetPlacingSave()) { + ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y)); + x = point.X; + y = point.Y; if (gameModel->GetActiveTool(0) && gameModel->GetActiveTool(0)->GetIdentifier() != "DEFAULT_UI_SIGN" || button != BUTTON_LEFT) //If it's not a sign tool or you are right/middle clicking { sign * foundSign = GetSignAt(x, y); if(foundSign) { - const char* str=foundSign->text.c_str(); + const char* str = foundSign->text.c_str(); char type; - int pos=splitsign(str, &type); + int pos = splitsign(str, &type); if (pos) { ret = false; @@ -609,6 +612,7 @@ bool GameController::MouseUp(int x, int y, unsigned button) } } } + foundSign = NULL; return ret; } diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h index 9fe362458..88337a03e 100644 --- a/src/gui/game/GameController.h +++ b/src/gui/game/GameController.h @@ -32,6 +32,8 @@ private: //Simulation * sim; bool firstTick; int screenshotIndex; + sign * foundSign; + PreviewController * activePreview; GameView * gameView; GameModel * gameModel; diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index a44731857..52a0f31e6 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -623,6 +623,11 @@ bool GameView::GetPlacingSave() return selectMode != SelectNone; } +bool GameView::GetPlacingZoom() +{ + return !zoomCursorFixed; +} + void GameView::NotifyActiveToolsChanged(GameModel * sender) { for(int i = 0; i < toolButtons.size(); i++) diff --git a/src/gui/game/GameView.h b/src/gui/game/GameView.h index 26781c16a..90fae7db2 100644 --- a/src/gui/game/GameView.h +++ b/src/gui/game/GameView.h @@ -137,6 +137,7 @@ public: void SetDebugHUD(bool mode); bool GetDebugHUD(); bool GetPlacingSave(); + bool GetPlacingZoom(); bool CtrlBehaviour(){ return ctrlBehaviour; } bool ShiftBehaviour(){ return shiftBehaviour; } bool AltBehaviour(){ return altBehaviour; }