Unfinished: rand map gen
This commit is contained in:
25
src/map.h
25
src/map.h
@ -2,14 +2,27 @@
|
||||
#define __MAP_H__
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include "constants.h"
|
||||
#include "display.h"
|
||||
#include "position.h"
|
||||
#include "characters.h"
|
||||
#include "rng.h"
|
||||
|
||||
class game_map final {
|
||||
private:
|
||||
static const int MAX_ROOM_CNT = 20;
|
||||
static const int MIN_ROOM_WIDTH = 3;
|
||||
static const int MIN_ROOM_HEIGHT = 3;
|
||||
static const int MAX_ROOM_WIDTH = 20;
|
||||
static const int MAX_ROOM_HEIGHT = 13;
|
||||
// setup safezones
|
||||
static const int ACTUAL_MAP_WIDTH = MAP_WIDTH - 4;
|
||||
static const int ACTUAL_MAP_HEIGHT = MAP_HEIGHT - 4;
|
||||
static const int MAP_PADDING = 1;
|
||||
static const int MIN_ROOM_SPACING = 4;
|
||||
static const int WIDTH_RESERVED = 8;
|
||||
static const int HEIGHT_RESERVED = 4;
|
||||
|
||||
const feature enabled_features;
|
||||
std::vector<char> map;
|
||||
// IMPORTANT: keep empty_spots ordered
|
||||
@ -25,6 +38,7 @@ public:
|
||||
const feature enabled_features);
|
||||
|
||||
const position_list get_available_positions() const;
|
||||
bool is_available(const position &pos) const;
|
||||
|
||||
const std::vector<position_list> get_room_list() const;
|
||||
// IMPORTANT: always print a map before anything else
|
||||
@ -43,6 +57,15 @@ private:
|
||||
int remap_position(const position &pos) const {
|
||||
return pos.y * MAP_WIDTH + pos.x;
|
||||
}
|
||||
|
||||
position random_size(int min_width, int min_height,
|
||||
int max_width, int max_height,
|
||||
RNG &rng);
|
||||
|
||||
std::vector<std::pair<position, int>> gen_room_dims(RNG &rng);
|
||||
std::vector<std::pair<position, position>> distr_rooms(RNG &rng,
|
||||
std::vector<std::pair<position, int>>
|
||||
&room_dims);
|
||||
};
|
||||
|
||||
const std::string default_map =
|
||||
|
Reference in New Issue
Block a user