From 6f5cb7a9babdf57f5eae54fb468773857f48ecdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 10 Nov 2020 15:33:46 +0100 Subject: copy assignment return when this == &other --- labb4/mainwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'labb4/mainwindow.cpp') diff --git a/labb4/mainwindow.cpp b/labb4/mainwindow.cpp index 6fd4422..31ceff2 100644 --- a/labb4/mainwindow.cpp +++ b/labb4/mainwindow.cpp @@ -153,9 +153,11 @@ bool MainWindow::tryMove(Hero hero, const Point& point) { * Process results of viable move */ void MainWindow::processMove(bool waiting) { - GameState copy=gameState; + GameState copy = gameState; copy.moveRobots(); - gameState=copy; + gameState = copy; + + gameState = gameState; score += gameState.countCollisions() * (POINTS_PER_ROBOT + (waiting ? WAIT_BONUS : 0)); -- cgit v1.2.1