diff options
author | alberth <alberth@openttd.org> | 2009-07-25 07:49:49 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-07-25 07:49:49 +0000 |
commit | 59c48fee8bda56a788310f6d83b99087d518fb0f (patch) | |
tree | 361d0852066b29d2a96ca1cd2a2466931b037014 /src/strings_func.h | |
parent | 63f2da749283621907039d551aaeb1294539fc92 (diff) | |
download | openttd-59c48fee8bda56a788310f6d83b99087d518fb0f.tar.xz |
(svn r16946) -Doc: Adding docs for some string parameter manipulation functions.
Diffstat (limited to 'src/strings_func.h')
-rw-r--r-- | src/strings_func.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/strings_func.h b/src/strings_func.h index a1b090195..674d0ae3a 100644 --- a/src/strings_func.h +++ b/src/strings_func.h @@ -13,11 +13,22 @@ const char *GetStringPtr(StringID string); void InjectDParam(uint amount); +/** + * Set a string parameter \a v at index \a n in a given array \a s. + * @param s Array of string parameters. + * @param n Index of the string parameter. + * @param v Value of the string parameter. + */ static inline void SetDParamX(uint64 *s, uint n, uint64 v) { s[n] = v; } +/** + * Set a string parameter \a v at index \a n in the global string parameter array. + * @param n Index of the string parameter. + * @param v Value of the string parameter. + */ static inline void SetDParam(uint n, uint64 v) { extern uint64 _decode_parameters[20]; @@ -28,11 +39,23 @@ static inline void SetDParam(uint n, uint64 v) void SetDParamStr(uint n, const char *str); +/** + * Get the current string parameter at index \a n from parameter array \a s. + * @param s Array of string parameters. + * @param n Index of the string parameter. + * @return Value of the requested string parameter. + */ static inline uint64 GetDParamX(const uint64 *s, uint n) { return s[n]; } +/** + * Get the current string parameter at index \a n from the global string parameter array. + * @param s Array of string parameters. + * @param n Index of the string parameter. + * @return Value of the requested string parameter. + */ static inline uint64 GetDParam(uint n) { extern uint64 _decode_parameters[20]; @@ -41,12 +64,24 @@ static inline uint64 GetDParam(uint n) return _decode_parameters[n]; } +/** + * Copy \a num string parameters from array \a src into the global string parameter array. + * @param offs Index in the global array to copy the first string parameter to. + * @param src Source array of string parameters. + * @param num Number of string parameters to copy. + */ static inline void CopyInDParam(int offs, const uint64 *src, int num) { extern uint64 _decode_parameters[20]; memcpy(_decode_parameters + offs, src, sizeof(uint64) * (num)); } +/** + * Copy \a num string parameters from the global string parameter array to the \a dst array. + * @param dst Destination array of string parameters. + * @param offs Index in the global array to copy the first string parameter from. + * @param num Number of string parameters to copy. + */ static inline void CopyOutDParam(uint64 *dst, int offs, int num) { extern uint64 _decode_parameters[20]; |