58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
#ifndef __LEVEL_H__
|
|
#define __LEVEL_H__
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <vector>
|
|
#include "display.h"
|
|
#include "gold.h"
|
|
#include "enemies.h"
|
|
#include "potions.h"
|
|
#include "constants.h"
|
|
#include "map.h"
|
|
|
|
class level {
|
|
private:
|
|
static const int MAX_POTION_CNT = 15;
|
|
static const int MAX_ENEMIE_CNT = 30;
|
|
static const int MIN_POTION_CNT = 10;
|
|
static const int MIN_ENEMIE_CNT = 20;
|
|
static const int GOLD_CNT = 10;
|
|
|
|
const feature enabled_features;
|
|
game_map map;
|
|
character *player;
|
|
std::vector<std::unique_ptr<character>>pchlist;
|
|
std::vector<std::unique_ptr<potion>>pplist;
|
|
character_list chlist;
|
|
potion_list plist;
|
|
gold_list glist;
|
|
public:
|
|
// randomly generate a map
|
|
level(character *player, RNG *rng, const feature enabled_features);
|
|
// read map from a string
|
|
level(const std::string &map_data, character *player, RNG *rng,
|
|
const feature enabled_features);
|
|
void print(display *out) const;
|
|
|
|
bool is_available(const position &pos) const;
|
|
position_list get_available_around(const position &pos) const;
|
|
position get_up_stairs() const;
|
|
position get_down_stairs() const;
|
|
|
|
// you can delete the pointers to the stuff
|
|
character_list &get_chlist();
|
|
potion_list &get_plist();
|
|
gold_list &get_glist();
|
|
private:
|
|
// every gen will delete the positions in tiles
|
|
void gen_potions(RNG *rng, std::vector<position_list> &tiles);
|
|
void gen_gold(RNG *rng, std::vector<position_list> &tiles);
|
|
void gen_enemies(RNG *rng, std::vector<position_list> &tiles);
|
|
|
|
position get_rand_pos(RNG *rng, std::vector<position_list> &tiles);
|
|
gold_list dragon_hoard();
|
|
};
|
|
|
|
#endif
|