summaryrefslogtreecommitdiff
path: root/src/Level.h
diff options
context:
space:
mode:
authorSteph Enders <smenders@gmail.com>2022-06-24 17:10:50 -0400
committerSteph Enders <smenders@gmail.com>2022-06-24 17:37:11 -0400
commitab37629c6e4798654fca1d533a611da7986b5053 (patch)
tree11b8a0b49bff176c9226b24b496588fd69f72cc3 /src/Level.h
parent20076f7271e19ecc259014681ba733047bea4d9b (diff)
Select level via command line (linux tested)
Diffstat (limited to 'src/Level.h')
-rw-r--r--src/Level.h27
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