src/gfx.cpp
branchnoai
changeset 9545 179f651eb116
parent 9517 be1775555bbd
child 6708 77b9506be3c3
equal deleted inserted replaced
9544:54705d209c44 9545:179f651eb116
   529 		}
   529 		}
   530 	}
   530 	}
   531 }
   531 }
   532 
   532 
   533 
   533 
   534 uint DrawStringMultiLine(int x, int y, StringID str, int maxw)
   534 uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
   535 {
   535 {
   536 	char buffer[512];
   536 	char buffer[512];
   537 	uint32 tmp;
   537 	uint32 tmp;
   538 	int num, mt;
   538 	int num, mt;
   539 	uint total_height;
   539 	uint total_height;
   545 	tmp = FormatStringLinebreaks(buffer, maxw);
   545 	tmp = FormatStringLinebreaks(buffer, maxw);
   546 	num = GB(tmp, 0, 16);
   546 	num = GB(tmp, 0, 16);
   547 
   547 
   548 	mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
   548 	mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
   549 	total_height = (num + 1) * mt;
   549 	total_height = (num + 1) * mt;
       
   550 
       
   551 	if (maxh != -1 && total_height > (uint)maxh) {
       
   552 		num = maxh / mt - 1;
       
   553 		if (num < 1) return 0;
       
   554 
       
   555 		total_height = (num + 1) * mt;
       
   556 	}
   550 
   557 
   551 	src = buffer;
   558 	src = buffer;
   552 
   559 
   553 	for (;;) {
   560 	for (;;) {
   554 		DoDrawString(src, x, y, 0xFE);
   561 		DoDrawString(src, x, y, 0xFE);