strings_func.h

Go to the documentation of this file.
00001 /* $Id: strings_func.h 17790 2009-10-17 20:34:09Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef STRINGS_FUNC_H
00013 #define STRINGS_FUNC_H
00014 
00015 #include "strings_type.h"
00016 
00017 char *InlineString(char *buf, StringID string);
00018 char *GetString(char *buffr, StringID string, const char *last);
00019 char *GetStringWithArgs(char *buffr, uint string, int64 *argv, const char *last);
00020 const char *GetStringPtr(StringID string);
00021 
00022 void InjectDParam(uint amount);
00023 
00030 static inline void SetDParamX(uint64 *s, uint n, uint64 v)
00031 {
00032   s[n] = v;
00033 }
00034 
00040 static inline void SetDParam(uint n, uint64 v)
00041 {
00042   extern uint64 _decode_parameters[20];
00043 
00044   assert(n < lengthof(_decode_parameters));
00045   _decode_parameters[n] = v;
00046 }
00047 
00048 void SetDParamStr(uint n, const char *str);
00049 
00056 static inline uint64 GetDParamX(const uint64 *s, uint n)
00057 {
00058   return s[n];
00059 }
00060 
00066 static inline uint64 GetDParam(uint n)
00067 {
00068   extern uint64 _decode_parameters[20];
00069 
00070   assert(n < lengthof(_decode_parameters));
00071   return _decode_parameters[n];
00072 }
00073 
00080 static inline void CopyInDParam(int offs, const uint64 *src, int num)
00081 {
00082   extern uint64 _decode_parameters[20];
00083   memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num));
00084 }
00085 
00092 static inline void CopyOutDParam(uint64 *dst, int offs, int num)
00093 {
00094   extern uint64 _decode_parameters[20];
00095   memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num));
00096 }
00097 
00098 extern DynamicLanguages _dynlang; // defined in strings.cpp
00099 
00100 bool ReadLanguagePack(int index);
00101 void InitializeLanguagePacks();
00102 const char *GetCurrentLanguageIsoCode();
00103 
00104 int CDECL StringIDSorter(const StringID *a, const StringID *b);
00105 
00107 struct StringIDCompare
00108 {
00109   bool operator()(StringID s1, StringID s2) const { return StringIDSorter(&s1, &s2) < 0; }
00110 };
00111 
00112 void CheckForMissingGlyphsInLoadedLanguagePack();
00113 
00114 #endif /* STRINGS_TYPE_H */

Generated on Sat Jul 31 21:37:53 2010 for OpenTTD by  doxygen 1.6.1