src/newgrf_text.cpp
branchgamebalance
changeset 9913 e79cd19772dd
parent 9911 0b8b245a2391
equal deleted inserted replaced
9912:1ac8aac92385 9913:e79cd19772dd
   436 	byte i;
   436 	byte i;
   437 
   437 
   438 	for (i=0; i < lengthof(iso_codes); i++) {
   438 	for (i=0; i < lengthof(iso_codes); i++) {
   439 		if (strncmp(iso_codes[i].code, iso_name, strlen(iso_codes[i].code)) == 0) {
   439 		if (strncmp(iso_codes[i].code, iso_name, strlen(iso_codes[i].code)) == 0) {
   440 			/* We found a match, so let's use it. */
   440 			/* We found a match, so let's use it. */
   441 			ret = i;
   441 			ret = iso_codes[i].grfLangID;
   442 			break;
   442 			break;
   443 		}
   443 		}
   444 	}
   444 	}
   445 	_currentLangID = ret;
   445 	_currentLangID = ret;
       
   446 }
       
   447 
       
   448 bool CheckGrfLangID(byte lang_id, byte grf_version)
       
   449 {
       
   450 	if (grf_version < 7) {
       
   451 		switch (_currentLangID) {
       
   452 			case GRFLX_GERMAN:  return (lang_id & GRFLB_GERMAN)  != 0;
       
   453 			case GRFLX_FRENCH:  return (lang_id & GRFLB_FRENCH)  != 0;
       
   454 			case GRFLX_SPANISH: return (lang_id & GRFLB_SPANISH) != 0;
       
   455 			default:            return (lang_id & (GRFLB_ENGLISH | GRFLB_AMERICAN)) != 0;
       
   456 		}
       
   457 	}
       
   458 
       
   459 	return (lang_id == _currentLangID || lang_id == GRFLX_UNSPECIFIED);
   446 }
   460 }
   447 
   461 
   448 /**
   462 /**
   449  * House cleaning.
   463  * House cleaning.
   450  * Remove all strings and reset the text counter.
   464  * Remove all strings and reset the text counter.