diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-11-10 01:35:03 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-11-10 01:35:03 +0100 |
| commit | 9cc46300dba5c1e53a26415507c4d08addfd89eb (patch) | |
| tree | 65e69e4e69eda4b19c0c047dab466cf4b4b9e87e /labb4 | |
| parent | fc151ff1e1c862f5b40dc028c293ce083695d78c (diff) | |
| download | tddd86-9cc46300dba5c1e53a26415507c4d08addfd89eb.tar.gz | |
warnings etc
Diffstat (limited to 'labb4')
| -rw-r--r-- | labb4/GameState.cpp | 16 | ||||
| -rw-r--r-- | labb4/GameState.h | 1 | ||||
| -rw-r--r-- | labb4/Junk.cpp | 4 | ||||
| -rw-r--r-- | labb4/Junk.h | 12 |
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 |
