summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/externs.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-26 15:30:07 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-26 15:30:07 +0000
commita844f8e10213c19b6e48d6ff98e97bc9f026a42a (patch)
tree9cada2344ca78a2c2de555dc8b7fa943ee7382fe /crawl-ref/source/externs.h
parent1f1939b11a6ed95f769644c21e53589a1e7abeb9 (diff)
downloadcrawl-ref-a844f8e10213c19b6e48d6ff98e97bc9f026a42a.tar.gz
crawl-ref-a844f8e10213c19b6e48d6ff98e97bc9f026a42a.zip
Better support for settings files that include other files:
- Files can be included as "include foo" in .crawlrc instead of using the Lua call: : crawl.read_options('foo'). include foo and the Lua crawl.read_options('foo') are not equivalent - Lua only runs after the start of a new game, which is too late for some option settings. - Crawl searches for included files in this sequence: - Absolute paths: use the path directly (but not if DATA_DIR_PATH is set, since we don't want Crawl to read arbitrary files on multiuser systems). - Search relative to the including file. - Search relative to any -rcdir(s) provided. - Search in the data file search path. - The data file search path now includes settings/ for when we move rc stuff to settings/ .gitignore: ignore saves and morgue dirs correctly. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5256 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/externs.h')
-rw-r--r--crawl-ref/source/externs.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index b6e6e2bf18..340acef5df 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1561,7 +1561,23 @@ public:
void read_options(InitLineInput &, bool runscripts,
bool clear_aliases = true);
+ void include(const std::string &file, bool resolve, bool runscript);
+ void report_error(const std::string &error);
+
+ std::string resolve_include(const std::string &file,
+ const char *type = "");
+
+ bool was_included(const std::string &file) const;
+
+ static std::string resolve_include(
+ std::string including_file,
+ std::string included_file,
+ const std::vector<std::string> *rcdirs = NULL)
+ throw (std::string);
+
public:
+ std::string filename; // The name of the file containing options.
+
// View options
std::vector<feature_override> feature_overrides;
std::vector<mon_display> mon_glyph_overrides;
@@ -1872,6 +1888,7 @@ public:
private:
std::map<std::string, std::string> aliases;
+ std::set<std::string> included; // Files we've included already.
public:
// Convenience accessors for the second-class options in named_options.
@@ -1922,6 +1939,7 @@ private:
void add_mon_glyph_override(const std::string &);
mon_display parse_mon_glyph(const std::string &s) const;
void set_option_fragment(const std::string &s);
+ bool include_file_directive(const std::string &line, bool runscript);
static const std::string interrupt_prefix;
};