Changeset - r27593:06cdc72f3f62
[Not reviewed]
master
0 2 0
Rubidium - 15 months ago 2023-06-15 14:54:50
rubidium@openttd.org
Codechange: move implementation of Set/GetDParam to strings.cpp
2 files changed with 25 insertions and 21 deletions:
0 comments (0 inline, 0 general)
src/strings.cpp
Show inline comments
 
@@ -93,6 +93,27 @@ int64 StringParameters::GetInt64()
 
	return this->data[this->offset++];
 
}
 

	
 

	
 
/**
 
 * 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.
 
 */
 
void SetDParam(uint n, uint64_t v)
 
{
 
	_global_string_params.SetParam(n, v);
 
}
 

	
 
/**
 
 * Get the current string parameter at index \a n from the global string parameter array.
 
 * @param n Index of the string parameter.
 
 * @return Value of the requested string parameter.
 
 */
 
uint64_t GetDParam(uint n)
 
{
 
	return _global_string_params.GetParam(n);
 
}
 

	
 
/**
 
 * Set DParam n to some number that is suitable for string size computations.
 
 * @param n Index of the string parameter.
 
@@ -101,7 +122,7 @@ int64 StringParameters::GetInt64()
 
 * @param min_count Minimum number of digits independent of \a max.
 
 * @param size  Font of the number
 
 */
 
void SetDParamMaxValue(uint n, uint64 max_value, uint min_count, FontSize size)
 
void SetDParamMaxValue(uint n, uint64_t max_value, uint min_count, FontSize size)
 
{
 
	uint num_digits = 1;
 
	while (max_value >= 10) {
src/strings_func.h
Show inline comments
 
@@ -199,17 +199,8 @@ static inline int64 PackVelocity(uint sp
 
	return speed | (static_cast<uint64>(type) << 56);
 
}
 

	
 
/**
 
 * 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)
 
{
 
	_global_string_params.SetParam(n, v);
 
}
 

	
 
void SetDParamMaxValue(uint n, uint64 max_value, uint min_count = 0, FontSize size = FS_NORMAL);
 
void SetDParam(uint n, uint64_t v);
 
void SetDParamMaxValue(uint n, uint64_t max_value, uint min_count = 0, FontSize size = FS_NORMAL);
 
void SetDParamMaxDigits(uint n, uint count, FontSize size = FS_NORMAL);
 

	
 
void SetDParamStr(uint n, const char *str);
 
@@ -220,15 +211,7 @@ void CopyInDParam(const uint64 *src, int
 
void CopyOutDParam(uint64 *dst, int num);
 
void CopyOutDParam(uint64 *dst, const char **strings, StringID string, int num);
 

	
 
/**
 
 * Get the current string parameter at index \a n from the global string parameter array.
 
 * @param n Index of the string parameter.
 
 * @return Value of the requested string parameter.
 
 */
 
static inline uint64 GetDParam(uint n)
 
{
 
	return _global_string_params.GetParam(n);
 
}
 
uint64_t GetDParam(uint n);
 

	
 
extern TextDirection _current_text_dir; ///< Text direction of the currently selected language
 

	
0 comments (0 inline, 0 general)