]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Improve wrapping
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 17 Aug 2015 07:51:47 +0000 (17:51 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 17 Aug 2015 07:51:47 +0000 (17:51 +1000)
qcsrc/menu/xonotic/dialog_media_guide_description.qc

index 33462e52638e13b253e5fecba57ced921d35e091..6b1e596cd71c1041d64eb7dbd9bb18ae59e7a0ad 100644 (file)
@@ -33,10 +33,13 @@ CLASS(XonoticGuideDescription, XonoticListBox)
         string currentWrapped = this.descriptionWrapped;
         if (currentWrapped) strunzone(currentWrapped);
         string wrapped = "";
-        for (getWrappedLine_remaining = desc; getWrappedLine_remaining; ) {
-            // FIXME: calculate this
-            string s = getWrappedLine(1.275, this.realFontSize, draw_TextWidth_WithColors);
-            wrapped = sprintf("%s\n%s", wrapped, s);
+        for (int i = 0, n = tokenizebyseparator(desc, "\n"); i < n; ++i) {
+            string line = "";
+            for (getWrappedLine_remaining = argv(i); getWrappedLine_remaining; ) {
+                string s = getWrappedLine(1, this.realFontSize, draw_TextWidth_WithColors);
+                line = sprintf("%s\n%s", line, s);
+            }
+            wrapped = strcat(wrapped, line);
         }
         this.descriptionWrapped = strzone(wrapped);