src/station_gui.cpp
changeset 8041 9483d3e46b3e
parent 8040 92c69fcd0d61
child 8106 e6790dd9e750
equal deleted inserted replaced
8040:92c69fcd0d61 8041:9483d3e46b3e
   805 		bool first = true;
   805 		bool first = true;
   806 
   806 
   807 		b = InlineString(b, STR_000C_ACCEPTS);
   807 		b = InlineString(b, STR_000C_ACCEPTS);
   808 
   808 
   809 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   809 		for (CargoID i = 0; i < NUM_CARGO; i++) {
   810 			if (b >= endof(_userstring) - 5 - 1) break;
   810 			if (b >= lastof(_userstring) - (1 + 2 * 4)) break; // ',' or ' ' and two calls to Utf8Encode()
   811 			if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) {
   811 			if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) {
   812 				if (first) {
   812 				if (first) {
   813 					first = false;
   813 					first = false;
   814 				} else {
   814 				} else {
   815 					/* Add a comma if this is not the first item */
   815 					/* Add a comma if this is not the first item */
   822 
   822 
   823 		/* If first is still true then no cargo is accepted */
   823 		/* If first is still true then no cargo is accepted */
   824 		if (first) b = InlineString(b, STR_00D0_NOTHING);
   824 		if (first) b = InlineString(b, STR_00D0_NOTHING);
   825 
   825 
   826 		*b = '\0';
   826 		*b = '\0';
       
   827 
       
   828 		/* Make sure we detect any buffer overflow */
       
   829 		assert(b < endof(_userstring));
       
   830 
   827 		DrawStringMultiLine(2, 67, STR_SPEC_USERSTRING, 245);
   831 		DrawStringMultiLine(2, 67, STR_SPEC_USERSTRING, 245);
   828 	} else { // extended window with list of cargo ratings
   832 	} else { // extended window with list of cargo ratings
   829 		DrawString(2, 67, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING);
   833 		DrawString(2, 67, STR_3034_LOCAL_RATING_OF_TRANSPORT, TC_FROMSTRING);
   830 
   834 
   831 		y = 77;
   835 		y = 77;