Changeset - r28049:ba228e3a54fc
[Not reviewed]
master
0 2 0
Peter Nelson - 13 months ago 2023-10-28 15:08:44
peter1138@openttd.org
Fix d42a78f: Some raw drop down list strings may need token processing. (#11400)

Storing the raw string without processing though GetString() caused token
processing to be skipped.
2 files changed with 9 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/widgets/dropdown.cpp
Show inline comments
 
@@ -36,6 +36,13 @@ DropDownListStringItem::DropDownListStri
 
{
 
}
 

	
 
DropDownListStringItem::DropDownListStringItem(const std::string &string, int result, bool masked) : DropDownListItem(result, masked)
 
{
 
	/* A raw string may contain parsable tokens, so it needs to be passed through GetString. */
 
	SetDParamStr(0, string);
 
	this->string = GetString(STR_JUST_RAW_STRING);
 
}
 

	
 
uint DropDownListStringItem::Width() const
 
{
 
	return GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
src/widgets/dropdown_type.h
Show inline comments
 
@@ -37,10 +37,10 @@ public:
 
 */
 
class DropDownListStringItem : public DropDownListItem {
 
public:
 
	const std::string string; ///< String of item
 
	std::string string; ///< String of item
 

	
 
	DropDownListStringItem(StringID string, int result, bool masked);
 
	DropDownListStringItem(const std::string &string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
 
	DropDownListStringItem(const std::string &string, int result, bool masked);
 

	
 
	bool Selectable() const override { return true; }
 
	uint Width() const override;
0 comments (0 inline, 0 general)