strings.c
changeset 236 da0ae9d977e0
parent 233 dd177a8c9f19
child 240 f1efbac04112
equal deleted inserted replaced
235:74233a1c6a53 236:da0ae9d977e0
   431 		}
   431 		}
   432 
   432 
   433 		// 0x85 is used as escape character..
   433 		// 0x85 is used as escape character..
   434 		case 0x85:
   434 		case 0x85:
   435 			switch(*str++) {
   435 			switch(*str++) {
   436 			case 0:
   436 			case 0: /* {CURRCOMPACT} */
   437 				buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt32(), true);
   437 				buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt32(), true);
   438 				break;
   438 				break;
   439 			case 1: // {INT32}
   439 			case 1: /* {INT32} */
   440 				buff = FormatNoCommaNumber(buff, GetParamInt32());
   440 				buff = FormatNoCommaNumber(buff, GetParamInt32());
   441 				break;
   441 				break;
   442 
   442 			case 2: /* {REV} */
   443 			case 2: // {REV}
       
   444 #ifdef WITH_REV
   443 #ifdef WITH_REV
   445 				buff = str_cat(buff, (const byte*)_openttd_revision);
   444 				buff = str_cat(buff, (const byte*)_openttd_revision);
   446 #endif
   445 #endif
   447 				break;
   446 				break;
   448 			case 3: { // {SHORTCARGO}
   447 			case 3: { /* {SHORTCARGO} */
   449 				// Layout:
   448 				// Short description of cargotypes. Layout:
   450 				// 8-bit = cargo type
   449 				// 8-bit = cargo type
   451 				// 16-bit = cargo count
   450 				// 16-bit = cargo count
   452 				char *s;
   451 				char *s;
   453 				uint16 cargo_str = _cargo_string_list[_opt.landscape][(byte)GetParamInt8()];
   452 				uint16 cargo_str = _cargo_string_list[_opt.landscape][(byte)GetParamInt8()];
   454 				uint16 multiplier = (cargo_str == STR_LITERS) ? 1000 : 1;
   453 				uint16 multiplier = (cargo_str == STR_LITERS) ? 1000 : 1;
   456 				buff = FormatCommaNumber(buff, GetParamInt16() * multiplier );
   455 				buff = FormatCommaNumber(buff, GetParamInt16() * multiplier );
   457 				s = GetStringPtr(cargo_str);
   456 				s = GetStringPtr(cargo_str);
   458 
   457 
   459 				memcpy(buff++, " ", 1);
   458 				memcpy(buff++, " ", 1);
   460 				while (*s) *buff++ = *s++;
   459 				while (*s) *buff++ = *s++;
       
   460 			}	break;
       
   461 			case 4: /* {CURRCOMPACT64} */
       
   462 				// 64 bit compact currency-unit
       
   463 				buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt64(), true);
   461 				break;
   464 				break;
   462 			}
       
   463 
   465 
   464 			default:
   466 			default:
   465 				error("!invalid escape sequence in string");
   467 				error("!invalid escape sequence in string");
   466 			}
   468 			}
   467 			break;
   469 			break;