1234567891011121314151617181920212223 |
- #ifndef MAP_H
- #define MAP_H
- #include "Position.h"
- #include "Tile.h"
- struct Map final {
- // OK is 0 to allow interpreting the enum as bool
- enum LoadResult { OK, FILE_NOT_FOUND, INVALID_FILE_FORMAT };
- // returns the tile at the given position or a null tile if the position is
- // not valid
- const Tile& getTile(const Position& p) const;
- // returns the width of the map, 0 is no map is loaded
- int getWidth() const;
- // return the hight of the map, 0 is no map is loaded
- int getHeight() const;
- // loads a map from a file and returns the result
- LoadResult load(const char* path);
- };
- #endif
|