diff --git a/src/strings_func.h b/src/strings_func.h --- 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, uin 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];