File diff r6955:42f59093f6f9 → r6956:6398843f1341
src/strings.cpp
Show inline comments
 
@@ -19,24 +19,25 @@
 
#include "industry.h"
 
#include "variables.h"
 
#include "newgrf_text.h"
 
#include "table/control_codes.h"
 
#include "music.h"
 
#include "date.h"
 
#include "industry.h"
 
#include "fileio.h"
 
#include "helpers.hpp"
 
#include "cargotype.h"
 
#include "group.h"
 
#include "debug.h"
 
#include "newgrf_townname.h"
 

	
 
/* for opendir/readdir/closedir */
 
# include "fios.h"
 

	
 
DynamicLanguages _dynlang;
 
char _userstring[128];
 

	
 
static char *StationGetSpecialString(char *buff, int x, const char* last);
 
static char *GetSpecialTownNameString(char *buff, int ind, uint32 seed, const char* last);
 
static char *GetSpecialPlayerNameString(char *buff, int ind, const int32 *argv, const char* last);
 

	
 
static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei, const char* last);
 
@@ -816,39 +817,53 @@ static char* FormatString(char* buff, co
 
				}
 
				buff = GetStringWithArgs(buff, str, temp, last);
 
				break;
 
			}
 

	
 
			case SCC_STATION_NAME: { // {STATION}
 
				const Station* st = GetStation(GetInt32(&argv));
 

	
 
				if (!st->IsValid()) { // station doesn't exist anymore
 
					buff = GetStringWithArgs(buff, STR_UNKNOWN_DESTINATION, NULL, last);
 
				} else {
 
					int32 temp[2];
 
					temp[0] = st->town->townnametype;
 
					temp[1] = st->town->townnameparts;
 
					temp[0] = STR_TOWN;
 
					temp[1] = st->town->index;
 
					buff = GetStringWithArgs(buff, st->string_id, temp, last);
 
				}
 
				break;
 
			}
 

	
 
			case SCC_TOWN_NAME: { // {TOWN}
 
				const Town* t = GetTown(GetInt32(&argv));
 
				int32 temp[1];
 

	
 
				assert(IsValidTown(t));
 

	
 
				temp[0] = t->townnameparts;
 
				buff = GetStringWithArgs(buff, t->townnametype, temp, last);
 
				uint32 grfid = t->townnamegrfid;
 

	
 
				if (grfid == 0) {
 
					/* Original town name */
 
					buff = GetStringWithArgs(buff, t->townnametype, temp, last);
 
				} else {
 
					/* Newgrf town name */
 
					if (GetGRFTownName(grfid) != NULL) {
 
						/* The grf is loaded */
 
						buff = GRFTownNameGenerate(buff, t->townnamegrfid, t->townnametype, t->townnameparts, last);
 
					} else {
 
						/* Fallback to english original */
 
						buff = GetStringWithArgs(buff, SPECSTR_TOWNNAME_ENGLISH, temp, last);
 
					}
 
				}
 
				break;
 
			}
 

	
 
			case SCC_GROUP_NAME: { // {GROUP}
 
				const Group *g = GetGroup(GetInt32(&argv));
 
				int32 args[1];
 

	
 
				assert(IsValidGroup(g));
 

	
 
				args[0] = g->index;
 
				buff = GetStringWithArgs(buff, (g->string_id == STR_SV_GROUP_NAME) ? (StringID)STR_GROUP_NAME_FORMAT : g->string_id, args, last);