summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/maps.h
blob: c0098f07de6a5fe46016cb1fcf32014dffcdac89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**
 * @file
 * @brief Functions used to create vaults.
**/

#ifndef MAPS_H
#define MAPS_H

#include <vector>

#include "mapdef.h"  // for typedef depth_ranges
#include "unwind.h"

struct level_range;
class map_def;
struct map_file_place;
struct vault_placement;

typedef vector<map_def> map_vector;
typedef vector<const map_def *> mapref_vector;

map_section_type vault_main(vault_placement &vp, const map_def *vault,
                            bool check_place = false);

bool resolve_subvault(map_def &vault);

coord_def find_portal_place(const vault_placement *place, bool check_place);

const map_def *map_by_index(int index);
void strip_all_maps();
int map_count();

string vault_chance_tag(const map_def &map);

const map_def *find_map_by_name(const string &name);
const map_def *random_map_for_place(const level_id &place,
                                    bool minivault,
                                    maybe_bool extra = MB_MAYBE);
const map_def *random_map_in_depth(const level_id &lid,
                                   bool want_minivault = false,
                                   maybe_bool extra = MB_MAYBE);
const map_def *random_map_for_tag(const string &tag,
                                  bool check_depth = false,
                                  bool check_chance = false,
                                  maybe_bool extra = MB_MAYBE);
mapref_vector random_chance_maps_in_depth(const level_id &place,
                                          maybe_bool extra = MB_MAYBE);

void dump_map(const map_def &map);
void add_parsed_map(const map_def &md);

vector<string> find_map_matches(const string &name);

mapref_vector find_maps_for_tag (const string tag,
                                 bool check_depth = false,
                                 bool check_used = true);

void read_maps();
void reread_maps();
void read_map(const string &file);
void run_map_global_preludes();
void run_map_local_preludes();
string get_descache_path(const string &file, const string &ext);

typedef map<string, map_file_place> map_load_info_t;

extern map_load_info_t lc_loaded_maps;
extern string          lc_desfile;
extern map_def         lc_map;
extern level_range     lc_range;
extern depth_ranges    lc_default_depths;
extern dlua_chunk      lc_global_prelude;
extern bool            lc_run_global_prelude;

typedef bool (*map_place_check_t)(const map_def &, const coord_def &c,
                                  const coord_def &size);

typedef vector<coord_def> point_vector;
typedef vector<string> string_vector;

extern map_place_check_t map_place_valid;
extern point_vector      map_anchor_points;

// Use dgn_map_parameters to modify:
extern string_vector     map_parameters;

class dgn_map_parameters
{
public:
    dgn_map_parameters(const string &astring);
    dgn_map_parameters(const string_vector &parameters);
private:
    unwind_var<string_vector> mpar;
};

#ifdef DEBUG_DIAGNOSTICS
void mapstat_report_random_maps(FILE *outf, const level_id &place);
#endif

#endif