Hardcode inclusion of default config file parts.
authorAdam Borowski <kilobyte@angband.pl>
Fri, 10 Aug 2012 18:48:54 +0000 (20:48 +0200)
committerAdam Borowski <kilobyte@angband.pl>
Fri, 10 Aug 2012 18:48:54 +0000 (20:48 +0200)
They're now effectively working as if they were written right in initfile.cc,
not being visible to the user.

For now, this makes it impossible to remove list items defined there.

crawl-ref/settings/init.txt
crawl-ref/source/dat/defaults/autopickup_exceptions.txt [moved from crawl-ref/settings/autopickup_exceptions.txt with 100% similarity]
crawl-ref/source/dat/defaults/food_colouring.txt [moved from crawl-ref/settings/food_colouring.txt with 100% similarity]
crawl-ref/source/dat/defaults/menu_colours.txt [moved from crawl-ref/settings/menu_colours.txt with 100% similarity]
crawl-ref/source/dat/defaults/messages.txt [moved from crawl-ref/settings/messages.txt with 100% similarity]
crawl-ref/source/dat/defaults/runrest_messages.txt [moved from crawl-ref/settings/runrest_messages.txt with 100% similarity]
crawl-ref/source/dat/defaults/standard_colours.txt [moved from crawl-ref/settings/standard_colours.txt with 100% similarity]
crawl-ref/source/initfile.cc

index 8030a14..a0e428d 100644 (file)
@@ -81,9 +81,6 @@
 # Rods are \ here.
 # autopickup = $?!:"/%
 
-# There is a long list of autopickup exceptions in
-include = autopickup_exceptions.txt
-
 drop_filter = useless_item
 
 # default_autopickup = false
@@ -161,17 +158,15 @@ auto_exclude = oklob,statue,curse skull,roxanne,hyperactive,lightning spire,mimi
 # tc_excluded       = lightmagenta
 # tc_exclude_circle = red
 
-# runrest options (require runrest.lua to be included above)
+# Interrupting run and rest compound commands:
 runrest_ignore_poison  = 2:30
 runrest_ignore_monster = butterfly:1
 # runrest_ignore_monster = swamp worm:3
-
-# The file runrest_messages.txt contains a list of default
-# runrest message settings. Add your own before this to override
-# later settings.
 # runrest_stop_message = You hear a.* slurping noise
 # runrest_ignore_message = Jiyva's power touches on your attributes
-include = runrest_messages.txt
+
+# A good number of runrest_messages is defined by default; you may want to
+# clear them or override some.
 
 trapwalk_safe_hp = dart:20,needle:15,arrow:35,bolt:45,spear:40,axe:45,blade:95
 
@@ -242,8 +237,7 @@ sort_menus = inv: true : equipped, freshness, charged
 # menu_colour_prefix_class = false
 # menu_colour_shops = false
 
-# Food is colour coded in standard_colours.txt as follows:
-include = standard_colours.txt
+# Food is colour coded by default as follows:
 #
 #   yellow     = preferred food                    ($preferred)
 #   darkgrey   = cannot be eaten at all            ($inedible)
@@ -256,12 +250,6 @@ include = standard_colours.txt
 # You can change colours by using something like
 # $contaminated := magenta
 
-include = food_colouring.txt
-
-# There is elaborate colouring of items in the inventory (and other menus)
-# depending on their usefulness, taking species and other criteria into account.
-include = menu_colours.txt
-
 # Colouring of autoinscribed god gifts
 menu_colour = pickup:green:god gift
 
@@ -270,14 +258,13 @@ menu_colour = inventory:white:\w \+\s
 menu_colour = inventory:white:\w \#\s
 
 # Colouring of messages
-# Messages are colour coded in standard_colours.txt as follows:
+# Messages are colour coded as follows:
 #
 #   lightred   = really important messages  ($danger)
 #   yellow     = significant messages       ($warning)
 #   lightred   = item damaged/destroyed     ($item_dmg [same as $danger])
 #   darkgrey   = boring, message clutter    ($boring)
 #
-include = messages.txt
 
 # Colouring for the notes
 menu_colour = notes:white:Reached XP level
index e46491f..0e2ef35 100644 (file)
@@ -1362,6 +1362,16 @@ static const char* lua_builtins[] =
     "clua/kills.lua",
 };
 
+static const char* config_defaults[] =
+{
+    "defaults/autopickup_exceptions.txt",
+    "defaults/runrest_messages.txt",
+    "defaults/standard_colours.txt",
+    "defaults/food_colouring.txt",
+    "defaults/menu_colours.txt",
+    "defaults/messages.txt",
+};
+
 // Returns an error message if the init.txt was not found.
 std::string read_init_file(bool runscript)
 {
@@ -1377,6 +1387,9 @@ std::string read_init_file(bool runscript)
                 mprf(MSGCH_ERROR, "Lua error: %s", clua.error.c_str());
         }
     }
+
+    for (unsigned int i = 0; i < ARRAYSZ(config_defaults); ++i)
+        Options.include(datafile_path(config_defaults[i]), false, runscript);
 #endif
 
     Options.filename     = "extra opts first";