File diff r23543:34dad07c4bfe → r23544:ac6a6a81e4c4
src/strings.cpp
Show inline comments
 
@@ -67,25 +67,28 @@ void StringParameters::ClearTypeInformat
 

	
 
/**
 
 * Read an int64 from the argument array. The offset is increased
 
 * so the next time GetInt64 is called the next value is read.
 
 */
 
int64 StringParameters::GetInt64(WChar type)
 
{
 
	if (this->offset >= this->num_param) {
 
		DEBUG(misc, 0, "Trying to read invalid string parameter");
 
		return 0;
 
	}
 
	if (this->type != NULL) {
 
		assert(this->type[this->offset] == 0 || this->type[this->offset] == type);
 
		if (this->type[this->offset] != 0 && this->type[this->offset] != type) {
 
			DEBUG(misc, 0, "Trying to read string parameter with wrong type");
 
			return 0;
 
		}
 
		this->type[this->offset] = type;
 
	}
 
	return this->data[this->offset++];
 
}
 

	
 
/**
 
 * Shift all data in the data array by the given amount to make
 
 * room for some extra parameters.
 
 */
 
void StringParameters::ShiftParameters(uint amount)
 
{
 
	assert(amount <= this->num_param);
 
@@ -1406,26 +1409,27 @@ static char *FormatString(char *buff, co
 
					if (st->indtype != IT_INVALID) {
 
						/* Special case where the industry provides the name for the station */
 
						const IndustrySpec *indsp = GetIndustrySpec(st->indtype);
 

	
 
						/* Industry GRFs can change which might remove the station name and
 
						 * thus cause very strange things. Here we check for that before we
 
						 * actually set the station name. */
 
						if (indsp->station_name != STR_NULL && indsp->station_name != STR_UNDEFINED) {
 
							str = indsp->station_name;
 
						}
 
					}
 

	
 
					int64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
 
					StringParameters tmp_params(args_array);
 
					uint64 args_array[] = {STR_TOWN_NAME, st->town->index, st->index};
 
					WChar types_array[] = {0, SCC_TOWN_NAME, SCC_NUM};
 
					StringParameters tmp_params(args_array, 3, types_array);
 
					buff = GetStringWithArgs(buff, str, &tmp_params, last);
 
				}
 
				break;
 
			}
 

	
 
			case SCC_TOWN_NAME: { // {TOWN}
 
				const Town *t = Town::GetIfValid(args->GetInt32(SCC_TOWN_NAME));
 
				if (t == NULL) break;
 

	
 
				if (t->name != NULL) {
 
					int64 args_array[] = {(int64)(size_t)t->name};
 
					StringParameters tmp_params(args_array);