diff options
Diffstat (limited to 'src/Level.h')
-rw-r--r-- | src/Level.h | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/Level.h b/src/Level.h index a0b571e..7b25d0b 100644 --- a/src/Level.h +++ b/src/Level.h @@ -50,23 +50,16 @@ struct Pos { class Level { public: - void loadLevelFromFile(const char *filePath); - - bool isEmpty(int x, int y); - - bool playerCanStep(int dx, int dy); - + explicit Level(const char *filePath); + ~Level() = default; + void load(); + bool playerCanStep(int dx, int dy) const; int getEnemyIndex(int id); - - bool enemyCanStep(Pos pos, int dx, int dy); - + bool enemyCanStep(const Pos &pos, int dx, int dy) const; void reset(); - /* deprecate*/ - void print(); - int nextId(); - int getWidth(); - int getHeight(); + int getWidth() const; + int getHeight() const; std::vector<std::vector<char>> map; // source copy of map std::vector<sf::RectangleShape> displayMap; @@ -76,9 +69,9 @@ public: private: int idCounter = 1; // defaults at 1 (player always 0) - int width; - int height; - const char *file; + int width{}; + int height{}; + std::unique_ptr<std::string> file; }; #endif // DNG_LEVEL_H |