Changeset - r19953:b132b7dde65f
[Not reviewed]
master
0 1 0
frosch - 11 years ago 2013-01-12 17:20:31
frosch@openttd.org
(svn r24909) -Codechange: Remove implicit bool -> integer conversion.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/strings.cpp
Show inline comments
 
@@ -503,61 +503,61 @@ static char *FormatGenericCurrency(char 
 

	
 
	return buff;
 
}
 

	
 
/**
 
 * Determine the "plural" index given a plural form and a number.
 
 * @param count       The number to get the plural index of.
 
 * @param plural_form The plural form we want an index for.
 
 * @return The plural index for the given form.
 
 */
 
static int DeterminePluralForm(int64 count, int plural_form)
 
{
 
	/* The absolute value determines plurality */
 
	uint64 n = abs(count);
 

	
 
	switch (plural_form) {
 
		default:
 
			NOT_REACHED();
 

	
 
		/* Two forms: singular used for one only.
 
		 * Used in:
 
		 *   Danish, Dutch, English, German, Norwegian, Swedish, Estonian, Finnish,
 
		 *   Greek, Hebrew, Italian, Portuguese, Spanish, Esperanto */
 
		case 0:
 
			return n != 1;
 
			return n != 1 ? 1 : 0;
 

	
 
		/* Only one form.
 
		 * Used in:
 
		 *   Hungarian, Japanese, Korean, Turkish */
 
		case 1:
 
			return 0;
 

	
 
		/* Two forms: singular used for 0 and 1.
 
		 * Used in:
 
		 *   French, Brazilian Portuguese */
 
		case 2:
 
			return n > 1;
 
			return n > 1 ? 1 : 0;
 

	
 
		/* Three forms: special cases for 0, and numbers ending in 1 except when ending in 11.
 
		 * Used in:
 
		 *   Latvian */
 
		case 3:
 
			return n % 10 == 1 && n % 100 != 11 ? 0 : n != 0 ? 1 : 2;
 

	
 
		/* Five forms: special cases for 1, 2, 3 to 6, and 7 to 10.
 
		 * Used in:
 
		 *   Gaelige (Irish) */
 
		case 4:
 
			return n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4;
 

	
 
		/* Three forms: special cases for numbers ending in 1 except when ending in 11, and 2 to 9 except when ending in 12 to 19.
 
		 * Used in:
 
		 *   Lithuanian */
 
		case 5:
 
			return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
 

	
 
		/* Three forms: special cases for numbers ending in 1 except when ending in 11, and 2 to 4 except when ending in 12 to 14.
 
		 * Used in:
 
		 *   Croatian, Russian, Ukrainian */
 
		case 6:
 
			return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
0 comments (0 inline, 0 general)