File diff r16430:b3f65f9bc976 → r16431:ec558deca9d7
src/strings.cpp
Show inline comments
 
@@ -31,26 +31,27 @@
 
#include "vehicle_base.h"
 
#include "engine_base.h"
 
#include "strgen/strgen.h"
 
#include "townname_func.h"
 
#include "string_func.h"
 
#include "company_base.h"
 
#include "smallmap_gui.h"
 
#include "debug.h"
 

	
 
#include "table/strings.h"
 
#include "table/control_codes.h"
 

	
 
DynamicLanguages _dynlang;     ///< Language information of the program.
 
uint64 _decode_parameters[20]; ///< Global array of string parameters. To access, use #SetDParam.
 
DynamicLanguages _dynlang;       ///< Language information of the program.
 
TextDirection _current_text_dir; ///< Text direction of the currently selected language
 
uint64 _decode_parameters[20];   ///< Global array of string parameters. To access, use #SetDParam.
 

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

	
 
static char *FormatString(char *buff, const char *str, int64 *argv, uint casei, const char *last);
 

	
 
struct LanguagePack : public LanguagePackHeader {
 
	char data[]; // list of strings
 
};
 

	
 
static char **_langpack_offs;
 
@@ -1376,25 +1377,25 @@ bool ReadLanguagePack(int lang_index)
 
	}
 

	
 
	free(_langpack);
 
	_langpack = lang_pack;
 

	
 
	free(_langpack_offs);
 
	_langpack_offs = langpack_offs;
 

	
 
	const char *c_file = strrchr(_dynlang.ent[lang_index].file, PATHSEPCHAR) + 1;
 
	strecpy(_dynlang.curr_file, c_file, lastof(_dynlang.curr_file));
 

	
 
	_dynlang.curr = lang_index;
 
	_dynlang.text_dir = (TextDirection)lang_pack->text_dir;
 
	_current_text_dir = (TextDirection)lang_pack->text_dir;
 
	SetCurrentGrfLangID(_langpack->newgrflangid);
 
	InitializeSortedCargoSpecs();
 
	SortIndustryTypes();
 
	BuildIndustriesLegend();
 
	SortNetworkLanguages();
 
	return true;
 
}
 

	
 
/* Win32 implementation in win32.cpp.
 
 * OS X implementation in os/macosx/macos.mm. */
 
#if !(defined(WIN32) || defined(__APPLE__))
 
/**
 
@@ -1692,20 +1693,20 @@ void CheckForMissingGlyphsInLoadedLangua
 
	 * For right-to-left languages we need the ICU library. If
 
	 * we do not have support for that library we warn the user
 
	 * about it with a message. As we do not want the string to
 
	 * be translated by the translators, we 'force' it into the
 
	 * binary and 'load' it via a BindCString. To do this
 
	 * properly we have to set the colour of the string,
 
	 * otherwise we end up with a lot of artefacts. The colour
 
	 * 'character' might change in the future, so for safety
 
	 * we just Utf8 Encode it into the string, which takes
 
	 * exactly three characters, so it replaces the "XXX" with
 
	 * the colour marker.
 
	 */
 
	if (_dynlang.text_dir != TD_LTR) {
 
	if (_current_text_dir != TD_LTR) {
 
		static char *err_str = strdup("XXXThis version of OpenTTD does not support right-to-left languages. Recompile with icu enabled.");
 
		Utf8Encode(err_str, SCC_YELLOW);
 
		SetDParamStr(0, err_str);
 
		ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
 
	}
 
#endif
 
}