summaryrefslogtreecommitdiffstats
path: root/labb4/GameState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'labb4/GameState.cpp')
-rw-r--r--labb4/GameState.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/labb4/GameState.cpp b/labb4/GameState.cpp
index 1a3aeef..3d7b8b7 100644
--- a/labb4/GameState.cpp
+++ b/labb4/GameState.cpp
@@ -20,6 +20,13 @@ GameState::GameState(int numberOfRobots) {
teleportHero();
}
+GameState::GameState(const GameState &other) {
+ for (const auto &robot : other.robots) {
+ robots.push_back(robot->clone());
+ }
+ hero = other.hero;
+}
+
void GameState::draw(QGraphicsScene *scene) const {
scene->clear();
for (int i = 0; i < robots.size(); i++) {
@@ -52,7 +59,6 @@ int GameState::countCollisions() {
}
}
}
- printf("done, %d\n", numberDestroyed);
return numberDestroyed;
//int numberDestroyed = 0;