File: fprop.cc

package info (click to toggle)
crawl 2%3A0.7.1-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 30,420 kB
  • ctags: 23,018
  • sloc: cpp: 244,317; ansic: 16,144; perl: 2,214; makefile: 984; python: 488; objc: 250; ruby: 200; sh: 140
file content (72 lines) | stat: -rw-r--r-- 1,605 bytes parent folder | download
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
/*
 * File:      envmap.cc
 * Summary:   Functions dealing with env.map_knowledge.
 */

#include "AppHdr.h"

#include "fprop.h"

#include "coord.h"
#include "env.h"
#include "stuff.h"

bool is_sanctuary(const coord_def& p)
{
    if (!map_bounds(p))
        return (false);
    const bool sanct = (testbits(env.pgrid(p), FPROP_SANCTUARY_1)
                        || testbits(env.pgrid(p), FPROP_SANCTUARY_2));
    if (sanct)
        ASSERT(in_bounds(env.sanctuary_pos));
    return (sanct);
}

bool is_bloodcovered(const coord_def& p)
{
    return (testbits(env.pgrid(p), FPROP_BLOODY));
}

bool is_tide_immune(const coord_def &p)
{
    return (env.pgrid(p) & FPROP_NO_TIDE);
}

bool is_moldy(const coord_def & p)
{
    return (env.pgrid(p) & FPROP_MOLD
            || env.pgrid(p) & FPROP_GLOW_MOLD);
}

bool glowing_mold(const coord_def & p)
{
    return (env.pgrid(p) & FPROP_GLOW_MOLD);
}

void remove_mold(const coord_def & p)
{
    env.pgrid(p) &= ~FPROP_MOLD;
    env.pgrid(p) &= ~FPROP_GLOW_MOLD;
}

feature_property_type str_to_fprop(const std::string &str)
{
    if (str == "bloody")
        return (FPROP_BLOODY);
    if (str == "mold")
        return (FPROP_MOLD);
    if (str == "no_cloud_gen")
        return (FPROP_NO_CLOUD_GEN);
    if (str == "no_rtele_into")
        return (FPROP_NO_RTELE_INTO);
    if (str == "no_ctele_into")
        return (FPROP_NO_CTELE_INTO);
    if (str == "no_tele_into")
        return (FPROP_NO_TELE_INTO);
    if (str == "no_tide")
        return (FPROP_NO_TIDE);
    if (str == "no_submerge")
        return (FPROP_NO_SUBMERGE);

    return (FPROP_NONE);
}