Engine translation: With '::' can now suppress colons for highlighting
authorWuzzy <Wuzzy2@mail.ru>
Fri, 26 Oct 2018 06:15:57 +0200
changeset 14000 6938cab93016
parent 13999 3ae88a9f9dca
child 14001 3183c4dc6e53
Engine translation: With '::' can now suppress colons for highlighting
hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Fri Oct 26 04:54:29 2018 +0200
+++ b/hedgewars/uStore.pas	Fri Oct 26 06:15:57 2018 +0200
@@ -936,7 +936,7 @@
     font: THWFont;
     r, r2: TSDL_Rect;
     wa, ha: LongInt;
-    tmpline, tmpline2, tmpdesc: ansistring;
+    tmpline, tmpline2, tmpline3, tmpdesc: ansistring;
 begin
 // make sure there is a caption as well as a sub caption - description is optional
 if length(caption) = 0 then
@@ -1023,17 +1023,27 @@
     r2:= r;
     if length(tmpline) > 0 then
         begin
-        r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, PChar(tmpline));
 
-        // render highlighted caption (if there is a ':')
+        // Render highlighted caption if there is a ':',
+        // from the beginning of the line to (and including) the ':'.
+        // With '::', the colons will be suppressed in the final text.
         tmpline2:= _S'';
         SplitByCharA(tmpline, tmpline2, ':');
         if length(tmpline2) > 0 then
             begin
-            tmpline:= tmpline + ':';
+            if (tmpline2[1] <> ':') then
+                begin
+                tmpline:= tmpline + ':';
+                tmpline3:= tmpline + tmpline2;
+                end
+            else
+                tmpline3:= tmpline + Copy(tmpline2, 2, Length(tmpline2)-1);
+            r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, PChar(tmpline3));
             WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, PChar(tmpline));
-            end;
-        end
+            end
+        else
+            r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, PChar(tmpline));
+        end;
     end;
 
 if length(extra) > 0 then