Make note_skill_levels default to what it used to, make it a simple list option.
authorAdam Borowski <kilobyte@angband.pl>
Fri, 10 Aug 2012 22:32:47 +0000 (00:32 +0200)
committerAdam Borowski <kilobyte@angband.pl>
Fri, 10 Aug 2012 22:32:47 +0000 (00:32 +0200)
No point in having it be a full list -- this way, it can be easily replaced,
and having to type the old values is not a chore.  You can += or -= too if
you really want.

(Really, this option and friends should just receive an optioncide...)

crawl-ref/docs/options_guide.txt
crawl-ref/settings/init.txt
crawl-ref/source/initfile.cc
crawl-ref/source/notes.cc
crawl-ref/source/options.h

index ff8c17c..fac25eb 100644 (file)
@@ -1937,9 +1937,9 @@ note_hp_percent = 5
         repetitions of notes based on the same incident.
 
 note_skill_levels = 1,5,13,27
-        This sets which skill levels are noteworthy. You can have
-        multiple note_skill_levels lines. The default is nothing (no
-        notes.)
+        This sets which skill levels are noteworthy. It's a single line,
+        although you can use += as a continuation. The default is levels
+        1, 5, 10, 15, 27.
 
 note_all_skill_levels = false
         This is a shortcut for note_skill_levels = 1,2,..,27. If you set
index e676083..e5598cc 100644 (file)
@@ -411,7 +411,7 @@ force_more_message = Found .* abyssal rune of Zot
 #
 # user_note_prefix=@@@
 # note_hp_percent = 5
-note_skill_levels = 1,5,10,15,27
+# note_skill_levels = 1,5,10,15,27
 # note_all_skill_levels = true
 # note_skill_max  = false
 # note_xom_effects = false
index aed1e7d..925fdd3 100644 (file)
@@ -1063,7 +1063,12 @@ void game_options::reset_options()
     autoinscribe_artefacts = true;
     autoinscribe_cursed = true;
     note_items.clear();
-    note_skill_levels.clear();
+    note_skill_levels.reset();
+    note_skill_levels.set(1);
+    note_skill_levels.set(5);
+    note_skill_levels.set(10);
+    note_skill_levels.set(15);
+    note_skill_levels.set(27);
     auto_spell_letters.clear();
     force_more_message.clear();
     sound_mappings.clear();
@@ -2760,12 +2765,14 @@ void game_options::read_option_line(const std::string &str, bool runscript)
 
     else if (key == "note_skill_levels")
     {
+        if (!plus_equal && !minus_equal)
+            note_skill_levels.reset();
         std::vector<std::string> thesplit = split_string(",", field);
         for (unsigned i = 0; i < thesplit.size(); ++i)
         {
             int num = atoi(thesplit[i].c_str());
             if (num > 0 && num <= 27)
-                note_skill_levels.push_back(num);
+                note_skill_levels.set(num, !minus_equal);
             else
             {
                 report_error("Bad skill level to note -- %s\n",
index 78f1c8a..68d59e7 100644 (file)
@@ -44,15 +44,6 @@ static int _real_god_power(int religion, int idx)
     return count;
 }
 
-static bool _is_noteworthy_skill_level(int level)
-{
-    for (unsigned int i = 0; i < Options.note_skill_levels.size(); ++i)
-        if (level == Options.note_skill_levels[i])
-            return true;
-
-    return false;
-}
-
 static bool _is_highest_skill(int skill)
 {
     for (int i = 0; i < NUM_SKILLS; ++i)
@@ -168,7 +159,7 @@ static bool _is_noteworthy(const Note& note)
     if (note.type == NOTE_GAIN_SKILL || note.type == NOTE_LOSE_SKILL)
     {
         if (Options.note_all_skill_levels
-            || _is_noteworthy_skill_level(note.second)
+            || note.second <= 27 && Options.note_skill_levels[note.second]
             || Options.note_skill_max && _is_highest_skill(note.first))
         {
             return true;
index ecaf3f2..29ae245 100644 (file)
@@ -184,7 +184,7 @@ public:
     std::vector<text_pattern> note_messages;  // Interesting messages
     std::vector<std::pair<text_pattern, std::string> > autoinscriptions;
     std::vector<text_pattern> note_items;     // Objects to note
-    std::vector<int> note_skill_levels;       // Skill levels to note
+    FixedBitVector<27+1> note_skill_levels;   // Skill levels to note
     std::vector<std::pair<text_pattern, std::string> > auto_spell_letters;
 
     bool        autoinscribe_artefacts; // Auto-inscribe identified artefacts.