src/strings.cpp
branchnoai
changeset 9626 79f2b5a0cdd7
parent 9624 b71483f2330f
child 9628 b5c2449616b5
equal deleted inserted replaced
9625:3301b1b3889c 9626:79f2b5a0cdd7
  1099 				return s;
  1099 				return s;
  1100 			}
  1100 			}
  1101 	}
  1101 	}
  1102 }
  1102 }
  1103 
  1103 
       
  1104 extern void SortNetworkLanguages();
       
  1105 extern void SortTownGeneratorNames();
       
  1106 
  1104 bool ReadLanguagePack(int lang_index)
  1107 bool ReadLanguagePack(int lang_index)
  1105 {
  1108 {
  1106 	int tot_count, i;
  1109 	int tot_count, i;
  1107 	size_t len;
  1110 	size_t len;
  1108 	char **langpack_offs;
  1111 	char **langpack_offs;
  1154 	const char *c_file = strrchr(_dynlang.ent[lang_index].file, PATHSEPCHAR) + 1;
  1157 	const char *c_file = strrchr(_dynlang.ent[lang_index].file, PATHSEPCHAR) + 1;
  1155 	ttd_strlcpy(_dynlang.curr_file, c_file, lengthof(_dynlang.curr_file));
  1158 	ttd_strlcpy(_dynlang.curr_file, c_file, lengthof(_dynlang.curr_file));
  1156 
  1159 
  1157 	_dynlang.curr = lang_index;
  1160 	_dynlang.curr = lang_index;
  1158 	SetCurrentGrfLangID(_langpack->isocode);
  1161 	SetCurrentGrfLangID(_langpack->isocode);
       
  1162 	SortNetworkLanguages();
       
  1163 	SortTownGeneratorNames();
  1159 	return true;
  1164 	return true;
  1160 }
  1165 }
  1161 
  1166 
  1162 /** Determine the current charset based on the environment
  1167 /** Determine the current charset based on the environment
  1163  * First check some default values, after this one we passed ourselves
  1168  * First check some default values, after this one we passed ourselves
  1187 {
  1192 {
  1188 	const Language *cmp1 = (const Language*)a;
  1193 	const Language *cmp1 = (const Language*)a;
  1189 	const Language *cmp2 = (const Language*)b;
  1194 	const Language *cmp2 = (const Language*)b;
  1190 
  1195 
  1191 	return strcmp(cmp1->file, cmp2->file);
  1196 	return strcmp(cmp1->file, cmp2->file);
       
  1197 }
       
  1198 
       
  1199 int CDECL StringIDSorter(const void *a, const void *b)
       
  1200 {
       
  1201 	const StringID va = *(const StringID*)a;
       
  1202 	const StringID vb = *(const StringID*)b;
       
  1203 	char stra[512];
       
  1204 	char strb[512];
       
  1205 	GetString(stra, va, lastof(stra));
       
  1206 	GetString(strb, vb, lastof(strb));
       
  1207 
       
  1208 	return strcmp(stra, strb);
  1192 }
  1209 }
  1193 
  1210 
  1194 /**
  1211 /**
  1195  * Checks whether the given language is already found.
  1212  * Checks whether the given language is already found.
  1196  * @param langs    languages we've found so fa
  1213  * @param langs    languages we've found so fa