summaryrefslogtreecommitdiffstats
path: root/labb4
diff options
context:
space:
mode:
Diffstat (limited to 'labb4')
-rw-r--r--labb4/GameState.cpp16
-rw-r--r--labb4/GameState.h1
-rw-r--r--labb4/Junk.cpp4
-rw-r--r--labb4/Junk.h12
4 files changed, 9 insertions, 24 deletions
diff --git a/labb4/GameState.cpp b/labb4/GameState.cpp
index 3d7b8b7..6de11dd 100644
--- a/labb4/GameState.cpp
+++ b/labb4/GameState.cpp
@@ -42,7 +42,7 @@ void GameState::teleportHero() {
}
void GameState::moveRobots() {
- for (unsigned int i = 0; i < robots.size(); i++) {
+ for (int i = 0; i < robots.size(); i++) {
robots[i]->moveTowards(hero);
}
}
@@ -60,20 +60,6 @@ int GameState::countCollisions() {
}
}
return numberDestroyed;
-
- //int numberDestroyed = 0;
- //unsigned int i = 0;
- //while (i < robots.size()) {
- // bool hitJunk = junkAt (robots[i]);
- // bool collision = (countRobotsAt (robots[i]) > 1);
- // if (hitJunk || collision) {
- // if (!hitJunk) junks.push_back (Junk(robots[i]));
- // robots[i] = robots[robots.size()-1];
- // robots.pop_back();
- // numberDestroyed++;
- // } else i++;
- //}
- //return numberDestroyed;
}
bool GameState::anyRobotsLeft() const {
diff --git a/labb4/GameState.h b/labb4/GameState.h
index 7466308..331dcb7 100644
--- a/labb4/GameState.h
+++ b/labb4/GameState.h
@@ -21,7 +21,6 @@ class GameState {
public:
GameState();
GameState(int numberOfRobots);
-
GameState(const GameState &);
/*
diff --git a/labb4/Junk.cpp b/labb4/Junk.cpp
index 2276240..86493c7 100644
--- a/labb4/Junk.cpp
+++ b/labb4/Junk.cpp
@@ -15,9 +15,9 @@ void Junk::draw(QGraphicsScene *scene) const {
JUNK_RADIUS, JUNK_RADIUS), QPen(), QBrush(JUNK_COLOR));
}
-void Junk::moveTowards(const Unit& u) {}
+void Junk::moveTowards(const Unit&) {}
-bool Junk::attacks(const Unit& u) const {
+bool Junk::attacks(const Unit&) const {
return false;
}
diff --git a/labb4/Junk.h b/labb4/Junk.h
index c520e9f..e8c028f 100644
--- a/labb4/Junk.h
+++ b/labb4/Junk.h
@@ -17,17 +17,17 @@ public:
/*
* Draws this junk onto the given QGraphicsScene.
*/
- void draw(QGraphicsScene* scene) const;
+ void draw(QGraphicsScene* scene) const override;
- void moveTowards(const Unit& u);
+ void moveTowards(const Unit& u) override;
- bool attacks(const Unit& u) const;
+ bool attacks(const Unit& u) const override;
- unsigned int getCollisionCount() const;
+ unsigned int getCollisionCount() const override;
- bool alive() const;
+ bool alive() const override;
- Junk *clone() const;
+ Junk *clone() const override;
};
#endif // JUNK_H