misc_gui.c
changeset 2063 ae866a12f2df
parent 2049 538e73c53f54
child 2070 47b1f29d4671
equal deleted inserted replaced
2062:57db03be52ad 2063:ae866a12f2df
    73 			SetDParam(0, lid->town->townnametype);
    73 			SetDParam(0, lid->town->townnametype);
    74 			SetDParam(1, lid->town->townnameparts);
    74 			SetDParam(1, lid->town->townnameparts);
    75 		}
    75 		}
    76 		DrawStringCentered(140,60, STR_01A8_LOCAL_AUTHORITY, 0);
    76 		DrawStringCentered(140,60, STR_01A8_LOCAL_AUTHORITY, 0);
    77 
    77 
    78 		str = STR_01CE_CARGO_ACCEPTED - 1;
    78 		{
    79 
    79 			char buf[512];
    80 		/* XXX if a tile accepts more cargo types than there are template strings
    80 			char *p = GetString(buf, STR_01CE_CARGO_ACCEPTED);
    81 		 * this breaks */
    81 			bool found = false;
    82 		for (i = 0; i < NUM_CARGO; ++i) {
    82 
    83 			if (lid->ac[i] > 0) {
    83 			for (i = 0; i < NUM_CARGO; ++i) {
    84 				if (lid->ac[i] < 8) {
    84 				if (lid->ac[i] > 0) {
    85 					SetDParam(idx++, STR_01D1_8);
    85 					// Add a comma between each item.
    86 					SetDParam(idx++, lid->ac[i]);
    86 					if (found) { *p++ = ','; *p++ = ' '; }
       
    87 					found = true;
       
    88 
       
    89 					// If the accepted value is less than 8, show it in 1/8:ths
       
    90 					if (lid->ac[i] < 8) {
       
    91 						int32 argv[2] = {
       
    92 							lid->ac[i],
       
    93 							_cargoc.names_s[i]
       
    94 						};
       
    95 						p = GetStringWithArgs(p, STR_01D1_8, argv);
       
    96 					} else {
       
    97 						p = GetString(p, _cargoc.names_s[i]);
       
    98 					}
    87 				}
    99 				}
    88 				SetDParam(idx++, _cargoc.names_s[i]);
       
    89 				str++;
       
    90 			}
   100 			}
    91 		}
   101 
    92 
   102 			if (found)
    93 		if (str != (STR_01CE_CARGO_ACCEPTED - 1))
   103 				DrawStringMultiCenter(140, 76, BindCString(buf), 276);
    94 			DrawStringMultiCenter(140, 76, str, 276);
   104 		}
    95 
   105 
    96 		if (lid->td.build_date != 0) {
   106 		if (lid->td.build_date != 0) {
    97 			SetDParam(0,lid->td.build_date);
   107 			SetDParam(0,lid->td.build_date);
    98 			DrawStringCentered(140,71, STR_BUILD_DATE, 0);
   108 			DrawStringCentered(140,71, STR_BUILD_DATE, 0);
    99 		}
   109 		}