diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2010-01-17 16:29:09 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2010-01-17 17:03:26 +1000 |
commit | 7cab36931b74bf99d3c6ee704a7ebf3b54d7a976 (patch) | |
tree | 663b3b75010fa4a3f27dce96095f4e6119d7e0ad /crawl-ref/source/mapdef.cc | |
parent | a660d9f8bb8aefeb80345f535d48ea26af865518 (diff) | |
download | crawl-ref-7cab36931b74bf99d3c6ee704a7ebf3b54d7a976.tar.gz crawl-ref-7cab36931b74bf99d3c6ee704a7ebf3b54d7a976.zip |
Convert fprop instances in mapdef.* to unsigned long. (greensnark)
fprop lists, and fprop_spec, now use unsigned long instead of int. This
matches env.pgrid, and means that there won't be size issues in future
when we end up with more feature properties.
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r-- | crawl-ref/source/mapdef.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 8f6f2fa02d..02b15e0eac 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -693,9 +693,16 @@ std::string map_lines::add_colour(const std::string &sub) bool map_fprop_list::parse(const std::string &fp, int weight) { - const int fprop = fp == "none" ? FPROP_NONE : str_to_fprop(fp); - if (fprop == -1) + unsigned long fprop; + + if (fp == "nothing") + fprop = FPROP_NONE; + else if (fp.empty()) + return (false); + else if (str_to_fprop(fp) == FPROP_NONE) return false; + else + fprop = str_to_fprop(fp); push_back(map_weighted_fprop(fprop, weight)); return true; @@ -4289,12 +4296,12 @@ int colour_spec::get_colour() ////////////////////////////////////////////////////////////////////////// // fprop_spec -int fprop_spec::get_property() +unsigned long fprop_spec::get_property() { if (fixed_prop != FPROP_NONE) return (fixed_prop); - int chosen = FPROP_NONE; + unsigned long chosen = FPROP_NONE; int cweight = 0; for (int i = 0, size = fprops.size(); i < size; ++i) if (x_chance_in_y(fprops[i].second, cweight += fprops[i].second)) |