added option to read level data from file

This commit is contained in:
2024-07-21 00:42:10 -04:00
parent 25477c2cf8
commit 401b5b00b5
14 changed files with 366 additions and 58 deletions

View File

@ -11,6 +11,8 @@
#include "player.h"
#include "characters.h"
struct level_data;
class game_map final {
private:
static const int MAX_ROOM_CNT = 20;
@ -54,7 +56,7 @@ public:
// randomly generate a map
game_map(character *player, RNG *rng, const feature enabled_features);
// read map from a string
game_map(character *player, const std::string &map_data, RNG *rng,
game_map(const level_data &lvl, character *player, RNG *rng,
const feature enabled_features);
bool is_available(const position &pos) const;
@ -74,6 +76,7 @@ public:
int get_room_cnt() const;
private:
position get_available_spot(const level_data &lvl, int room, RNG *rng);
std::vector<room> room_data;
position remap_index(const int idx) const;
int remap_position(const position &pos) const;
@ -107,7 +110,7 @@ private:
room hit_room(const position &a);
bool hit_room(const position &a, const room &r);
void gen_stairs(int player_room, RNG *rng);
void gen_stairs(const level_data &lvl, int player_room, RNG *rng);
room get_room(std::size_t idx) const;
};