Permalink
Browse files

fix link signs preventing you from using quickoption buttons, fix bei…

…ng unable to place zoom window on link signs. Fixes #222
  • Loading branch information...
jacob1 committed Aug 5, 2014
1 parent c83945e commit e4b08c88cfbc0c6db2860474f9324ae6018007f0
Showing with 23 additions and 11 deletions.
  1. +15 −11 src/gui/game/GameController.cpp
  2. +2 −0 src/gui/game/GameController.h
  3. +5 −0 src/gui/game/GameView.cpp
  4. +1 −0 src/gui/game/GameView.h
@@ -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 && y<YRES && x<XRES && !gameView->GetPlacingSave())
if (ret && y<YRES && x<XRES && !gameView->GetPlacingSave() && !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 && y<YRES && x<XRES && !gameView->GetPlacingSave())
if (ret && foundSign && y<YRES && x<XRES && !gameView->GetPlacingSave())
{
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;
}

@@ -32,6 +32,8 @@ class GameController: public ClientListener
//Simulation * sim;
bool firstTick;
int screenshotIndex;
sign * foundSign;

PreviewController * activePreview;
GameView * gameView;
GameModel * gameModel;
@@ -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++)
@@ -137,6 +137,7 @@ class GameView: public ui::Window
void SetDebugHUD(bool mode);
bool GetDebugHUD();
bool GetPlacingSave();
bool GetPlacingZoom();
bool CtrlBehaviour(){ return ctrlBehaviour; }
bool ShiftBehaviour(){ return shiftBehaviour; }
bool AltBehaviour(){ return altBehaviour; }

0 comments on commit e4b08c8

Please sign in to comment.