summaryrefslogtreecommitdiff
path: root/src/ini.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2011-03-03 20:53:09 +0000
committeralberth <alberth@openttd.org>2011-03-03 20:53:09 +0000
commit722296e79747610b7822c07f2edd908563456d92 (patch)
tree5abad466c49bbae08ee041eef2a2773d884c8267 /src/ini.cpp
parentd19a9f5df5ca670857ae82ae8e02e065a0035974 (diff)
downloadopenttd-722296e79747610b7822c07f2edd908563456d92.tar.xz
(svn r22168) -Codechange: Move ini file IO and file error reporting to virtual functions.
Diffstat (limited to 'src/ini.cpp')
-rw-r--r--src/ini.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ini.cpp b/src/ini.cpp
index 3dc1219bb..c8cf317ac 100644
--- a/src/ini.cpp
+++ b/src/ini.cpp
@@ -105,3 +105,15 @@ bool IniFile::SaveToDisk(const char *filename)
return true;
}
+
+/* virtual */ FILE *IniFile::OpenFile(const char *filename, size_t *size)
+{
+ /* Open the text file in binary mode to prevent end-of-line translations
+ * done by ftell() and friends, as defined by K&R. */
+ return FioFOpenFile(filename, "rb", DATA_DIR, size);
+}
+
+/* virtual */ void IniFile::ReportFileError(const char * const pre, const char * const buffer, const char * const post)
+{
+ ShowInfoF("%s%s%s", pre, buffer, post);
+}