summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/macro.cc
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-10 00:16:41 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-10 00:16:41 +0000
commitca066cbdff4b735dbf04266147f9d2a98b91f4b8 (patch)
tree390ed77c59f1eff6116afd2872194fdf5966308f /crawl-ref/source/macro.cc
parent38ccc5f47d34e511bfeddf3a989ca0923b8af4c4 (diff)
downloadcrawl-ref-ca066cbdff4b735dbf04266147f9d2a98b91f4b8.tar.gz
crawl-ref-ca066cbdff4b735dbf04266147f9d2a98b91f4b8.zip
For 1909388: command key changes
Added init.txt option additional_macro_file, which does what you expect. Macros are read after the player's macro.txt. Documented new option. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3565 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/macro.cc')
-rw-r--r--crawl-ref/source/macro.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index 94b640db2b..29a2c7b242 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -825,11 +825,10 @@ void macro_add_query( void )
redraw_screen();
}
-
/*
* Initializes the macros.
*/
-int macro_init( void )
+static void _read_macros_from(const char* filename)
{
std::string s;
std::ifstream f;
@@ -837,7 +836,7 @@ int macro_init( void )
bool keymap = false;
KeymapContext keymc = KC_DEFAULT;
- f.open( get_macro_file().c_str() );
+ f.open( filename );
while (f >> s)
{
@@ -867,10 +866,25 @@ int macro_init( void )
macro_add( (keymap ? Keymaps[keymc] : Macros), key, action );
}
}
-
- return (0);
}
+int macro_init( void )
+{
+ _read_macros_from(get_macro_file().c_str());
+
+ const std::vector<std::string>& files = Options.additional_macro_files;
+ for (std::vector<std::string>::const_iterator it = files.begin();
+ it != files.end();
+ ++it)
+ {
+ _read_macros_from(it->c_str());
+ }
+
+
+ return 0;
+}
+
+
void macro_userfn(const char *keys, const char *regname)
{
// TODO: Implement.