summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Moore <neil@s-z.org>2014-08-17 03:13:49 -0400
committerNeil Moore <neil@s-z.org>2014-08-17 03:21:55 -0400
commit78d49c70c6717bd2366269afa961294d5a5f8d04 (patch)
tree8a68f21e7863992a48d9700b2ef9dfe849422bdc
parent392fa5e58279f52e3286c9a65b2a7cf615f62192 (diff)
downloadcrawl-ref-78d49c70c6717bd2366269afa961294d5a5f8d04.tar.gz
crawl-ref-78d49c70c6717bd2366269afa961294d5a5f8d04.zip
Make multiple KMASK lines for the same glyph work (qw)
It turns out that the later mask was overriding the earlier one. Instead, combine the masks. Resolve conflicts (no_monster_gen versus !no_monster_gen for example) in favour of the later mask. In particular, this allows grunt_temple_overflow_order_and_chaos_1 to place again; it was broken by 0.16-a0-179-g90b15e8. Thanks to elliptic and gammafunk for helping find and debug the problem.
-rw-r--r--crawl-ref/source/mapdef.cc14
-rw-r--r--crawl-ref/source/mapdef.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index c46b6a58cf..0ef583e43a 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -5792,6 +5792,18 @@ void map_flags::clear()
flags_set = flags_unset = 0;
}
+map_flags &map_flags::operator |= (const map_flags &o)
+{
+ flags_set |= o.flags_set;
+ flags_unset |= o.flags_unset;
+
+ // In the event of conflict, the later flag set (o here) wins.
+ flags_set &= ~o.flags_unset;
+ flags_unset &= ~o.flags_set;
+
+ return *this;
+}
+
typedef map<string, unsigned long> flag_map;
map_flags map_flags::parse(const string flag_list[],
@@ -6059,7 +6071,7 @@ string keyed_mapspec::set_mask(const string &s, bool garbage)
{"vault", "no_item_gen", "no_monster_gen", "no_pool_fixup",
"UNUSED",
"no_wall_fixup", "opaque", "no_trap_gen", ""};
- map_mask = map_flags::parse(flag_list, s);
+ map_mask |= map_flags::parse(flag_list, s);
}
catch (const string &error)
{
diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h
index c48e59671b..d005cd5dff 100644
--- a/crawl-ref/source/mapdef.h
+++ b/crawl-ref/source/mapdef.h
@@ -842,6 +842,7 @@ struct map_flags
map_flags();
void clear();
+ map_flags &operator |= (const map_flags &o);
static map_flags parse(const string flag_list[],
const string &s) throw(string);