From 78d49c70c6717bd2366269afa961294d5a5f8d04 Mon Sep 17 00:00:00 2001 From: Neil Moore Date: Sun, 17 Aug 2014 03:13:49 -0400 Subject: 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. --- crawl-ref/source/mapdef.cc | 14 +++++++++++++- crawl-ref/source/mapdef.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) 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 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); -- cgit v1.2.3