From 7cab36931b74bf99d3c6ee704a7ebf3b54d7a976 Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Sun, 17 Jan 2010 16:29:09 +1000 Subject: 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. --- crawl-ref/source/mapdef.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/mapdef.cc') 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)) -- cgit v1.2.3-54-g00ecf