diff options
author | maedhros <maedhros@openttd.org> | 2007-06-12 13:22:14 +0000 |
---|---|---|
committer | maedhros <maedhros@openttd.org> | 2007-06-12 13:22:14 +0000 |
commit | 94d390eac49841f350a357dbfc7e0904276c9dd9 (patch) | |
tree | 5ee61ed1866ad23ad460d7ef74060ce9760f90df /src/newgrf_text.cpp | |
parent | 8f7dea3f4f9ef108d0dc5257f10862bd8752d109 (diff) | |
download | openttd-94d390eac49841f350a357dbfc7e0904276c9dd9.tar.xz |
(svn r10114) -Fix: Only load newgrf error messages if the language matches the current
language. Since only one error can be loaded anyway, if the language didn't
match you'd get "Undefined string". Also since we're only loading one language
there's no need to use AddGRFString any more.
Diffstat (limited to 'src/newgrf_text.cpp')
-rw-r--r-- | src/newgrf_text.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 5c977992f..d05b0c2d3 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -445,6 +445,20 @@ void SetCurrentGrfLangID(const char *iso_name) _currentLangID = ret; } +bool CheckGrfLangID(byte lang_id, byte grf_version) +{ + if (grf_version < 7) { + switch (_currentLangID) { + case GRFLX_GERMAN: return (lang_id & GRFLB_GERMAN) != 0; + case GRFLX_FRENCH: return (lang_id & GRFLB_FRENCH) != 0; + case GRFLX_SPANISH: return (lang_id & GRFLB_SPANISH) != 0; + default: return (lang_id & (GRFLB_ENGLISH | GRFLB_AMERICAN)) != 0; + } + } + + return (lang_id == _currentLangID || lang_id == GRFLX_UNSPECIFIED); +} + /** * House cleaning. * Remove all strings and reset the text counter. |