summaryrefslogtreecommitdiff
path: root/src/dungeon.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-04-14 06:39:21 +0200
committerBardur Arantsson <bardur@scientician.net>2015-04-14 06:39:21 +0200
commit08ff08397681d6839bae1fac89f86e1fa7bab289 (patch)
tree208ee16ee33b85c5a03a0874c6acefef742fb6a5 /src/dungeon.cc
parent25d4950957f86d0c31f77c2a0b39d918cad51a5f (diff)
Automatizer: Rework to use player-specific .atm file by default
Diffstat (limited to 'src/dungeon.cc')
-rw-r--r--src/dungeon.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/dungeon.cc b/src/dungeon.cc
index 953ea536..abcc6cae 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -62,6 +62,7 @@
#include "xtra1.hpp"
#include "xtra2.hpp"
+#include <boost/filesystem.hpp>
#include <cassert>
#define TY_CURSE_CHANCE 100
@@ -5077,12 +5078,20 @@ static void load_all_pref_files(void)
/* Process that file */
process_pref_file(buf);
- /* Process player specific automatizer sets */
- /* TODO: Disabled temporarily because it causes duplicate
- * rules on save and subsequent game load. */
- /* sprintf(buf2, "%s.atm", player_name); */
- /* path_build(buf, sizeof(buf), ANGBAND_DIR_USER, buf2); */
- /* automatizer_load(buf); */
+ /* Load automatizer settings. Character-specific automatizer
+ * file gets priority over the "template" file. We do not try
+ * to merge the two files since that would require tracking
+ * the providence of rules and such to avoid the same
+ * duplication problems as caused when saving macros/keymaps. */
+ boost::filesystem::path userDirectory(ANGBAND_DIR_USER);
+ if (automatizer_load(userDirectory / (std::string(player_name) + ".atm")))
+ {
+ // Done
+ }
+ else if (automatizer_load(userDirectory / "automat.atm"))
+ {
+ // Done
+ }
}
/*