From fc151ff1e1c862f5b40dc028c293ce083695d78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 10 Nov 2020 00:57:06 +0100 Subject: gamestate cc, polymorphic clone --- labb4/mainwindow.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'labb4/mainwindow.cpp') diff --git a/labb4/mainwindow.cpp b/labb4/mainwindow.cpp index 1d3f5e0..6fd4422 100644 --- a/labb4/mainwindow.cpp +++ b/labb4/mainwindow.cpp @@ -153,11 +153,10 @@ bool MainWindow::tryMove(Hero hero, const Point& point) { * Process results of viable move */ void MainWindow::processMove(bool waiting) { - // GameState copy=gameState; - // copy.moveRobots(); - // gameState=copy; + GameState copy=gameState; + copy.moveRobots(); + gameState=copy; - gameState.moveRobots(); score += gameState.countCollisions() * (POINTS_PER_ROBOT + (waiting ? WAIT_BONUS : 0)); gameState.draw(scene); -- cgit v1.2.1