diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-04-09 03:20:40 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-04-09 11:02:10 +0200 |
commit | 8bf01c43c17c1111a580daa0e3906cae1cccef6a (patch) | |
tree | 4dac3070de755a493361e782829304da26d26531 /crawl-ref/source/l_debug.cc | |
parent | 441f6435328c8c2e68de689e1a4c7dc687a0760c (diff) | |
download | crawl-ref-8bf01c43c17c1111a580daa0e3906cae1cccef6a.tar.gz crawl-ref-8bf01c43c17c1111a580daa0e3906cae1cccef6a.zip |
Use FixedBitArray instead of large arrays of bools.
The only cost is having assignments be a function, as you can't overload
operator[] to have separate bits be lvalues.
Diffstat (limited to 'crawl-ref/source/l_debug.cc')
-rw-r--r-- | crawl-ref/source/l_debug.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crawl-ref/source/l_debug.cc b/crawl-ref/source/l_debug.cc index 89caf21ae2..14ad7c555b 100644 --- a/crawl-ref/source/l_debug.cc +++ b/crawl-ref/source/l_debug.cc @@ -78,7 +78,7 @@ LUAFN(debug_flush_map_memory) { dgn_flush_map_memory(); init_level_connectivity(); - you.unique_creatures.init(false); + you.unique_creatures.reset(); return 0; } @@ -248,7 +248,7 @@ LUAFN(debug_handle_monster_move) return 0; } -static FixedVector<bool, NUM_MONSTERS> saved_uniques; +static FixedBitVector<NUM_MONSTERS> saved_uniques; LUAFN(debug_save_uniques) { @@ -258,18 +258,18 @@ LUAFN(debug_save_uniques) LUAFN(debug_reset_uniques) { - you.unique_creatures.init(false); + you.unique_creatures.reset(); return 0; } LUAFN(debug_randomize_uniques) { - you.unique_creatures.init(false); + you.unique_creatures.reset(); for (monster_type mt = MONS_0; mt < NUM_MONSTERS; ++mt) { if (!mons_is_unique(mt)) continue; - you.unique_creatures[mt] = coinflip(); + you.unique_creatures.set(mt, coinflip()); } return 0; } @@ -280,11 +280,10 @@ static bool _check_uniques() { bool ret = true; - FixedVector<bool, NUM_MONSTERS> uniques_on_level; - uniques_on_level.init(false); + FixedBitVector<NUM_MONSTERS> uniques_on_level; for (monster_iterator mi; mi; ++mi) if (mons_is_unique(mi->type)) - uniques_on_level[mi->type] = true; + uniques_on_level.set(mi->type); for (monster_type mt = MONS_0; mt < NUM_MONSTERS; ++mt) { |