src/gfx.cpp
branchnoai
changeset 9545 179f651eb116
parent 9517 be1775555bbd
child 6708 77b9506be3c3
--- a/src/gfx.cpp	Sun Mar 25 23:39:05 2007 +0000
+++ b/src/gfx.cpp	Sun Mar 25 23:51:30 2007 +0000
@@ -531,7 +531,7 @@
 }
 
 
-uint DrawStringMultiLine(int x, int y, StringID str, int maxw)
+uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
 {
 	char buffer[512];
 	uint32 tmp;
@@ -548,6 +548,13 @@
 	mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
 	total_height = (num + 1) * mt;
 
+	if (maxh != -1 && total_height > (uint)maxh) {
+		num = maxh / mt - 1;
+		if (num < 1) return 0;
+
+		total_height = (num + 1) * mt;
+	}
+
 	src = buffer;
 
 	for (;;) {