Changeset - r28415:a1abaeadf082
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 11 months ago 2024-01-07 20:48:47
j.g.rennison@gmail.com
Fix: String gender scan with SCC_INDUSTRY_NAME (#11697)
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/strings.cpp
Show inline comments
 
@@ -1466,20 +1466,20 @@ static void FormatString(StringBuilder &
 

	
 
				case SCC_INDUSTRY_NAME: { // {INDUSTRY}
 
					const Industry *i = Industry::GetIfValid(args.GetNextParameter<IndustryID>());
 
					if (i == nullptr) break;
 

	
 
					static bool use_cache = true;
 
					if (use_cache) { // Use cached version if first call
 
						AutoRestoreBackup cache_backup(use_cache, false);
 
						builder += i->GetCachedName();
 
					} else if (_scan_for_gender_data) {
 
					if (_scan_for_gender_data) {
 
						/* Gender is defined by the industry type.
 
						 * STR_FORMAT_INDUSTRY_NAME may have the town first, so it would result in the gender of the town name */
 
						auto tmp_params = ArrayStringParameters<0>();
 
						FormatString(builder, GetStringPtr(GetIndustrySpec(i->type)->name), tmp_params, next_substr_case_index);
 
					} else if (use_cache) { // Use cached version if first call
 
						AutoRestoreBackup cache_backup(use_cache, false);
 
						builder += i->GetCachedName();
 
					} else {
 
						/* First print the town name and the industry type name. */
 
						auto tmp_params = MakeParameters(i->town->index, GetIndustrySpec(i->type)->name);
 
						FormatString(builder, GetStringPtr(STR_FORMAT_INDUSTRY_NAME), tmp_params, next_substr_case_index);
 
					}
 
					next_substr_case_index = 0;
0 comments (0 inline, 0 general)