strings_func.h

Go to the documentation of this file.
00001 /* $Id: strings_func.h 14828 2009-01-04 15:32:25Z smatz $ */
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 void InjectDParam(uint amount);
00015 
00016 static inline void SetDParamX(uint64 *s, uint n, uint64 v)
00017 {
00018   s[n] = v;
00019 }
00020 
00021 static inline void SetDParam(uint n, uint64 v)
00022 {
00023   extern uint64 _decode_parameters[20];
00024 
00025   assert(n < lengthof(_decode_parameters));
00026   _decode_parameters[n] = v;
00027 }
00028 
00029 void SetDParamStr(uint n, const char *str);
00030 
00031 static inline uint64 GetDParamX(const uint64 *s, uint n)
00032 {
00033   return s[n];
00034 }
00035 
00036 static inline uint64 GetDParam(uint n)
00037 {
00038   extern uint64 _decode_parameters[20];
00039 
00040   assert(n < lengthof(_decode_parameters));
00041   return _decode_parameters[n];
00042 }
00043 
00044 static inline void CopyInDParam(int offs, const uint64 *src, int num)
00045 {
00046   extern uint64 _decode_parameters[20];
00047   memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num));
00048 }
00049 
00050 static inline void CopyOutDParam(uint64 *dst, int offs, int num)
00051 {
00052   extern uint64 _decode_parameters[20];
00053   memcpy(dst, _decode_parameters + offs, sizeof(uint64) * (num));
00054 }
00055 
00056 extern DynamicLanguages _dynlang; // defined in strings.cpp
00057 
00058 bool ReadLanguagePack(int index);
00059 void InitializeLanguagePacks();
00060 
00061 int CDECL StringIDSorter(const void *a, const void *b);
00062 
00064 struct StringIDCompare
00065 {
00066   bool operator()(StringID s1, StringID s2) const { return StringIDSorter(&s1, &s2) < 0; }
00067 };
00068 
00069 void CheckForMissingGlyphsInLoadedLanguagePack();
00070 
00071 #endif /* STRINGS_TYPE_H */

Generated on Thu Sep 24 19:35:06 2009 for OpenTTD by  doxygen 1.5.6