strings_func.h

Go to the documentation of this file.
00001 /* $Id: strings_func.h 12015 2008-01-29 17:09:00Z peter1138 $ */
00002 
00005 #ifndef STRINGS_FUNC_H
00006 #define STRINGS_FUNC_H
00007 
00008 #include "strings_type.h"
00009 
00010 char *InlineString(char *buf, StringID string);
00011 char *GetString(char *buffr, StringID string, const char *last);
00012 const char *GetStringPtr(StringID string);
00013 
00014 extern char _userstring[128];
00015 
00016 void InjectDParam(int amount);
00017 
00018 static inline void SetDParamX(uint64 *s, uint n, uint64 v)
00019 {
00020   s[n] = v;
00021 }
00022 
00023 static inline void SetDParam(uint n, uint64 v)
00024 {
00025   extern uint64 _decode_parameters[20];
00026 
00027   assert(n < lengthof(_decode_parameters));
00028   _decode_parameters[n] = v;
00029 }
00030 
00031 /* Used to bind a C string name to a dparam number.
00032  * NOTE: This has a short lifetime. You can't
00033  *       use this string much later or it will be gone. */
00034 void SetDParamStr(uint n, const char *str);
00035 
00039 StringID BindCString(const char *str);
00040 
00041 static inline uint64 GetDParamX(const uint64 *s, uint n)
00042 {
00043   return s[n];
00044 }
00045 
00046 static inline uint64 GetDParam(uint n)
00047 {
00048   extern uint64 _decode_parameters[20];
00049 
00050   assert(n < lengthof(_decode_parameters));
00051   return _decode_parameters[n];
00052 }
00053 
00054 static inline void CopyInDParam(int offs, const uint64 *src, int num)
00055 {
00056   extern uint64 _decode_parameters[20];
00057   memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num));
00058 }
00059 
00060 static inline void CopyOutDParam(uint64 *dst, int offs, int num)
00061 {
00062   extern uint64 _decode_parameters[20];
00063   memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num));
00064 }
00065 
00066 extern DynamicLanguages _dynlang; // defined in strings.cpp
00067 
00068 bool ReadLanguagePack(int index);
00069 void InitializeLanguagePacks();
00070 
00071 int CDECL StringIDSorter(const void *a, const void *b);
00072 
00074 struct StringIDCompare
00075 {
00076   bool operator()(StringID s1, StringID s2) const { return StringIDSorter(&s1, &s2) < 0; }
00077 };
00078 
00079 void CheckForMissingGlyphsInLoadedLanguagePack();
00080 
00081 #endif /* STRINGS_TYPE_H */

Generated on Wed Oct 1 17:03:24 2008 for openttd by  doxygen 1.5.6