fix link signs preventing you from using quickoption buttons, fix being unable to place zoom window on link signs. Fixes #222

This commit is contained in:
jacob1 2014-08-05 19:25:11 -04:00
parent c83945e281
commit e4b08c88cf
4 changed files with 23 additions and 11 deletions

View File

@ -126,6 +126,7 @@ GameController::GameController():
options(NULL), options(NULL),
activePreview(NULL), activePreview(NULL),
localBrowser(NULL), localBrowser(NULL),
foundSign(NULL),
HasDone(false), HasDone(false),
firstTick(true) 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 GameController::MouseDown(int x, int y, unsigned button)
{ {
bool ret = commandInterface->OnMouseDown(x, y, button); bool ret = commandInterface->OnMouseDown(x, y, button);
ui::Point point = PointTranslate(ui::Point(x, y)); if (ret && y<YRES && x<XRES && !gameView->GetPlacingSave() && !gameView->GetPlacingZoom())
x = point.X; {
y = point.Y; ui::Point point = gameModel->AdjustZoomCoords(ui::Point(x, y));
if (ret && y<YRES && x<XRES && !gameView->GetPlacingSave()) 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 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())) if(foundSign && splitsign(foundSign->text.c_str()))
return false; return false;
} }
}
return ret; return ret;
} }
bool GameController::MouseUp(int x, int y, unsigned button) bool GameController::MouseUp(int x, int y, unsigned button)
{ {
bool ret = commandInterface->OnMouseUp(x, y, button); bool ret = commandInterface->OnMouseUp(x, y, button);
ui::Point point = PointTranslate(ui::Point(x, y)); if (ret && foundSign && y<YRES && x<XRES && !gameView->GetPlacingSave())
x = point.X;
y = point.Y;
if (ret && 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 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); sign * foundSign = GetSignAt(x, y);
if(foundSign) { if(foundSign) {
const char* str=foundSign->text.c_str(); const char* str = foundSign->text.c_str();
char type; char type;
int pos=splitsign(str, &type); int pos = splitsign(str, &type);
if (pos) if (pos)
{ {
ret = false; ret = false;
@ -609,6 +612,7 @@ bool GameController::MouseUp(int x, int y, unsigned button)
} }
} }
} }
foundSign = NULL;
return ret; return ret;
} }

View File

@ -32,6 +32,8 @@ private:
//Simulation * sim; //Simulation * sim;
bool firstTick; bool firstTick;
int screenshotIndex; int screenshotIndex;
sign * foundSign;
PreviewController * activePreview; PreviewController * activePreview;
GameView * gameView; GameView * gameView;
GameModel * gameModel; GameModel * gameModel;

View File

@ -623,6 +623,11 @@ bool GameView::GetPlacingSave()
return selectMode != SelectNone; return selectMode != SelectNone;
} }
bool GameView::GetPlacingZoom()
{
return !zoomCursorFixed;
}
void GameView::NotifyActiveToolsChanged(GameModel * sender) void GameView::NotifyActiveToolsChanged(GameModel * sender)
{ {
for(int i = 0; i < toolButtons.size(); i++) for(int i = 0; i < toolButtons.size(); i++)

View File

@ -137,6 +137,7 @@ public:
void SetDebugHUD(bool mode); void SetDebugHUD(bool mode);
bool GetDebugHUD(); bool GetDebugHUD();
bool GetPlacingSave(); bool GetPlacingSave();
bool GetPlacingZoom();
bool CtrlBehaviour(){ return ctrlBehaviour; } bool CtrlBehaviour(){ return ctrlBehaviour; }
bool ShiftBehaviour(){ return shiftBehaviour; } bool ShiftBehaviour(){ return shiftBehaviour; }
bool AltBehaviour(){ return altBehaviour; } bool AltBehaviour(){ return altBehaviour; }