Changeset - r2585:9036ffa11877
[Not reviewed]
master
0 1 0
Darkvater - 18 years ago 2005-11-02 23:31:04
darkvater@openttd.org
(svn r3122) - Fix (regression): recent change to strgen which 'fixed' all strings with wrong plural forms. Thanks for glx for pointing this out (after I changed his original patch which was correct..whohoo braindeadness; here I come)
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
strgen/strgen.c
Show inline comments
 
@@ -51,13 +51,13 @@ enum {
 
typedef struct Case {
 
	int caseidx;
 
	char *string;
 
	struct Case *next;
 
} Case;
 

	
 
static bool _masterlang;
 
static bool _translated;
 
static const char* _file = "(unknown file)";
 
static int _cur_line;
 
static int _errors, _warnings;
 

	
 
typedef struct LangString {
 
	char *name;							// Name of the string
 
@@ -329,13 +329,13 @@ static void EmitPlural(char *buf, int va
 
	}
 

	
 
	if (nw == 0)
 
		Fatal("%s: No plural words", _cur_ident);
 

	
 
	if (_plural_form_counts[_lang_pluralform] != nw)
 
		if (_masterlang) {
 
		if (_translated) {
 
			Fatal("%s: Invalid number of plural forms. Expecting %d, found %d.", _cur_ident,
 
				_plural_form_counts[_lang_pluralform], nw);
 
		} else {
 
			Warning("'%s' is untranslated. Tweaking english string to allow compilation for plural forms", _cur_ident);
 
			if (nw > _plural_form_counts[_lang_pluralform]) {
 
				nw = _plural_form_counts[_lang_pluralform];
 
@@ -1154,12 +1154,14 @@ static void WriteLangfile(const char *fi
 
				cmdp = ls->translated;
 
			} else {
 
				casep = ls->english_case;
 
				cmdp = ls->english;
 
			}
 

	
 
			_translated = !(cmdp == ls->english);
 

	
 
			if (casep) {
 
				Case *c;
 
				int num;
 
				// Need to output a case-switch.
 
				// It has this format
 
				// <0x9E> <NUM CASES> <CASE1> <LEN1> <STRING1> <CASE2> <LEN2> <STRING2> <CASE3> <LEN3> <STRING3> <STRINGDEFAULT>
 
@@ -1221,25 +1223,23 @@ int CDECL main(int argc, char* argv[])
 
		show_todo = 2;
 
		argc--, argv++;
 
	}
 

	
 

	
 
	if (argc == 1) {
 
		_masterlang = true;
 
		// parse master file
 
		ParseFile("lang/english.txt", true);
 
		MakeHashOfStrings();
 
		if (_errors) return 1;
 

	
 
		// write english.lng and strings.h
 

	
 
		WriteLangfile("lang/english.lng", 0);
 
		WriteStringsH("table/strings.h");
 

	
 
	} else if (argc == 2) {
 
		_masterlang = false;
 
		ParseFile("lang/english.txt", true);
 
		MakeHashOfStrings();
 
		ParseFile(argv[1], false);
 

	
 
		if (_errors) return 1;
 

	
0 comments (0 inline, 0 general)