summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/exclude.h
blob: eb1630a1f2064b4546a55e0d77c29fcc8d5970f9 (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
#ifndef EXCLUDE_H
#define EXCLUDE_H

#include "los.h"

bool need_auto_exclude(const monsters *mon, bool sleepy = false);
void set_auto_exclude(const monsters *mon);
void remove_auto_exclude(const monsters *mon, bool sleepy = false);

void init_exclusion_los();
void update_exclusion_los(std::vector<coord_def> changed);

bool is_exclude_root(const coord_def &p);
void cycle_exclude_radius(const coord_def &p);
void del_exclude(const coord_def &p);
void set_exclude(const coord_def &p, int radius = LOS_RADIUS,
                 bool autoexcl = false, bool vaultexcl = false);
void maybe_remove_autoexclusion(const coord_def &p);
std::string get_exclusion_desc();
void clear_excludes();

struct travel_exclude
{
    coord_def     pos;          // exclusion centre
    int           radius;       // exclusion radius
    los_def       los;          // los from exclusion centre
    bool          uptodate;     // Is los up to date?
    bool          autoex;       // Was set automatically.
    monster_type  mon;          // Monster around which exclusion is centered.
    bool          vault;        // Is this exclusion set by a vault?

    travel_exclude(const coord_def &p, int r = LOS_RADIUS,
                   bool autoex = false, monster_type mons = MONS_NO_MONSTER,
                   bool vault = false);

    int radius_sq() const;
    void set_los();
    bool in_bounds(const coord_def& p) const;
    bool affects(const coord_def& p) const;
};

typedef std::vector<travel_exclude> exclvec;
extern exclvec curr_excludes; // in travel.cc

bool is_excluded(const coord_def &p, const exclvec &exc = curr_excludes);

class writer;
class reader;
void marshallExcludes(writer& outf, const exclvec& excludes);
void unmarshallExcludes(reader& inf, char minorVersion, exclvec& excludes);

#endif