diff --git a/src/gui/console/ConsoleController.cpp b/src/gui/console/ConsoleController.cpp index 602636faf..b79470c26 100644 --- a/src/gui/console/ConsoleController.cpp +++ b/src/gui/console/ConsoleController.cpp @@ -15,11 +15,13 @@ ConsoleController::ConsoleController(ControllerCallback * callback, CommandInter void ConsoleController::EvaluateCommand(std::string command) { - if (command.substr(0, 6) == "!load ") - CloseConsole(); - int returnCode = commandInterface->Command(command); if(command.length()) + { + if (command.substr(0, 6) == "!load ") + CloseConsole(); + int returnCode = commandInterface->Command(command); consoleModel->AddLastCommand(ConsoleCommand(command, returnCode, commandInterface->GetLastError())); + } else CloseConsole(); } diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index b8733606c..9dd949f8e 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -444,7 +444,6 @@ void GameController::DrawPoints(int toolSelection, queue & pointQueue { while(!pointQueue.empty()) { - //delete pointQueue.front(); pointQueue.pop(); } } @@ -455,20 +454,25 @@ void GameController::DrawPoints(int toolSelection, queue & pointQueue if(!pointQueue.empty()) { ui::Point sPoint(0, 0); + int size = pointQueue.size(); bool first = true; while(!pointQueue.empty()) { ui::Point fPoint = pointQueue.front(); - //delete pointQueue.front(); pointQueue.pop(); - if(!first) + if(size > 1) { - activeTool->DrawLine(sim, cBrush, sPoint, fPoint, true); + if (!first) + { + activeTool->DrawLine(sim, cBrush, sPoint, fPoint, true); + printf("From (%d, %d) To (%d, %d)\n", sPoint.X, sPoint.Y, fPoint.X, fPoint.Y); + } + first = false; } else { - first = false; activeTool->Draw(sim, cBrush, fPoint); + printf("(%d, %d)\n", fPoint.X, fPoint.Y); } sPoint = fPoint; } diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 735728f9d..d84bc41b7 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -1141,7 +1141,6 @@ void GameView::OnMouseUp(int x, int y, unsigned button) if(drawMode == DrawPoints) { c->ToolClick(toolIndex, c->PointTranslate(ui::Point(x, y))); - //pointQueue.push(ui::Point(x, y)); } if(drawModeReset) { @@ -1209,10 +1208,6 @@ void GameView::OnMouseWheel(int x, int y, int d) else { c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour); - if(isMouseDown) - { - pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x, y)))); - } } } @@ -1522,7 +1517,7 @@ void GameView::OnTick(float dt) c->SetZoomPosition(currentMouse); if(drawMode == DrawPoints) { - if(isMouseDown) + if(isMouseDown && pointQueue.empty()) { pointQueue.push(ui::Point(c->PointTranslate(currentMouse))); }