summaryrefslogtreecommitdiff
path: root/stdafx.h
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-11-28 14:42:31 +0000
committerDarkvater <darkvater@openttd.org>2006-11-28 14:42:31 +0000
commit4e7109113750d383fae9086638c17646f6df74b5 (patch)
tree4cbabbc256d401dc659eee0bfc25178f517648c3 /stdafx.h
parent9253387001aafa9bd996a2e2906732373b20a43a (diff)
downloadopenttd-4e7109113750d383fae9086638c17646f6df74b5.tar.xz
(svn r7274) -Codechange [utf8]: Add input/output unicode support. This actually only changes win32
since it uses UTF16 for file access. To keep os-specific code to a minimum, OpenTTD uses UTF8 internally everywhere, converting to OS-type when needed (save/load/screenshot/etc.)
Diffstat (limited to 'stdafx.h')
-rw-r--r--stdafx.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/stdafx.h b/stdafx.h
index 00823e188..5d2d58103 100644
--- a/stdafx.h
+++ b/stdafx.h
@@ -154,6 +154,19 @@
# include <stddef.h>
#endif /* defined(_MSC_VER) */
+/* NOTE: the string returned by these functions is only valid until the next
+ * call to the same function and is not thread- or reentrancy-safe */
+#if !defined(STRGEN)
+# if defined(WIN32) || defined(WIN64)
+# define fopen(file, mode) _wfopen(OTTD2FS(file), L ## mode)
+ const char *FS2OTTD(const wchar_t *name);
+ const wchar_t *OTTD2FS(const char *name);
+# else
+# define fopen(file, mode) fopen(OTTD2FS(file), mode)
+ const char *FS2OTTD(const char *name);
+ const char *OTTD2FS(const char *name);
+# endif /* WIN32 */
+#endif /* STRGEN */
// Windows has always LITTLE_ENDIAN
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)