summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/macro.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-12-16 15:15:01 +0100
committerAdam Borowski <kilobyte@angband.pl>2010-12-16 16:53:03 +0100
commitc182b846613a797cb37fcda578553e40814b7e65 (patch)
tree7f843f40efe8972ea927ffb12501961880cdafe0 /crawl-ref/source/macro.cc
parent64ca3ade493233cf0d4c43dfc68cf22622d23b76 (diff)
downloadcrawl-ref-c182b846613a797cb37fcda578553e40814b7e65.tar.gz
crawl-ref-c182b846613a797cb37fcda578553e40814b7e65.zip
Fix an use of fstream, allow macro files to be in dirs with non-ASCII paths.
It also allows using non-ASCII characters inside, but save for arguments to lua functions, this is not really meaningful.
Diffstat (limited to 'crawl-ref/source/macro.cc')
-rw-r--r--crawl-ref/source/macro.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index 881e851064..45c01cbfeb 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -24,8 +24,6 @@
#include "macro.h"
#include "state.h"
-#include <iostream>
-#include <fstream>
#include <string>
#include <sstream>
#include <map>
@@ -988,13 +986,14 @@ static void _read_macros_from(const char* filename)
return;
std::string s;
- std::ifstream f(filename);
+ TextFileReader f(filename);
keyseq key, action;
bool keymap = false;
KeymapContext keymc = KMC_DEFAULT;
- while (f >> s)
+ while (!f.eof())
{
+ s = f.get_line();
trim_string(s); // remove white space from ends
if (s[0] == '#')