From ab37629c6e4798654fca1d533a611da7986b5053 Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Fri, 24 Jun 2022 17:10:50 -0400 Subject: Select level via command line (linux tested) --- src/Level.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'src/Level.h') 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> map; // source copy of map std::vector 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 file; }; #endif // DNG_LEVEL_H -- cgit v1.2.3-54-g00ecf