mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
Cleanup: remove old backup/restore of string parameters
This commit is contained in:
parent
6313b8a4cb
commit
05ef3f0998
@ -153,50 +153,6 @@ void SetDParamMaxDigits(size_t n, uint count, FontSize size)
|
||||
SetDParam(n, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy \a num string parameters from array \a src into the global string parameter array.
|
||||
* @param src Source array of string parameters.
|
||||
* @param num Number of string parameters to copy.
|
||||
*/
|
||||
void CopyInDParam(const uint64 *src, int num)
|
||||
{
|
||||
for (int i = 0; i < num; i++) SetDParam(i, src[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy \a num string parameters from the global string parameter array to the \a dst array.
|
||||
* @param dst Destination array of string parameters.
|
||||
* @param num Number of string parameters to copy.
|
||||
*/
|
||||
void CopyOutDParam(uint64 *dst, int num)
|
||||
{
|
||||
for (int i = 0; i < num; i++) dst[i] = GetDParam(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy \a num string parameters from the global string parameter array to the \a dst array.
|
||||
* Furthermore clone raw string parameters into \a strings and amend the data in \a dst.
|
||||
* @param dst Destination array of string parameters.
|
||||
* @param strings Destination array for clone of the raw strings. Must be of same length as dst. Deallocation left to the caller.
|
||||
* @param string The string used to determine where raw strings are and where there are no raw strings.
|
||||
* @param num Number of string parameters to copy.
|
||||
*/
|
||||
void CopyOutDParam(uint64 *dst, const char **strings, StringID string, int num)
|
||||
{
|
||||
/* Just get the string to extract the type information. */
|
||||
GetString(string);
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
if (_global_string_params.GetTypeAtOffset(i) == SCC_RAW_STRING_POINTER) {
|
||||
strings[i] = stredup((const char *)(size_t)_global_string_params.GetParam(i));
|
||||
dst[i] = (size_t)strings[i];
|
||||
} else {
|
||||
strings[i] = nullptr;
|
||||
dst[i] = _global_string_params.GetParam(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the parameters from the backup into the global string parameter array.
|
||||
* @param backup The backup to copy from.
|
||||
|
@ -86,10 +86,6 @@ void SetDParamStr(size_t n, const char *str);
|
||||
void SetDParamStr(size_t n, const std::string &str);
|
||||
void SetDParamStr(size_t n, std::string &&str) = delete; // block passing temporaries to SetDParamStr
|
||||
|
||||
void CopyInDParam(const uint64 *src, int num);
|
||||
void CopyOutDParam(uint64 *dst, int num);
|
||||
void CopyOutDParam(uint64 *dst, const char **strings, StringID string, int num);
|
||||
|
||||
void CopyInDParam(const span<const StringParameterBackup> backup);
|
||||
void CopyOutDParam(std::vector<StringParameterBackup> &backup, size_t num);
|
||||
void CopyOutDParam(std::vector<StringParameterBackup> &backup, size_t num, StringID string);
|
||||
|
Loading…
Reference in New Issue
Block a user