diff -r c828cabe33af -r c5348fe9077c hedgewars/uChat.pas --- a/hedgewars/uChat.pas Thu Jun 04 19:57:04 2015 +0300 +++ b/hedgewars/uChat.pas Sat Jun 06 22:10:11 2015 +0200 @@ -152,6 +152,9 @@ UpdateCursorCoords(); end; +(* This procedure [re]renders a texture showing str for the chat line cl. + * It will use the color stored in cl and update width + *) procedure RenderChatLineTex(var cl: TChatLine; var str: shortstring); var strSurface, resSurface: PSDL_Surface; @@ -161,6 +164,8 @@ shadowint = $80 shl AShift; begin +FreeAndNilTexture(cl.Tex); + font:= CheckCJKFont(ansistring(str), fnt16); // get render size of text @@ -199,9 +204,6 @@ procedure SetLine(var cl: TChatLine; str: shortstring; isInput: boolean); var color : TSDL_Color; begin -if cl.Tex <> nil then - FreeAndNilTexture(cl.Tex); - if isInput then begin cl.s:= str; @@ -232,16 +234,14 @@ // For uStore texture recreation procedure ReloadLines; -var i, t: LongWord; +var i: LongWord; begin if InputStr.s <> '' then SetLine(InputStr, InputStr.s, true); for i:= 0 to MaxStrIndex do if Strs[i].s <> '' then begin - t:= Strs[i].Time; - SetLine(Strs[i], Strs[i].s, false); - Strs[i].Time:= t + RenderChatLineTex(Strs[i], Strs[i].s); end; end;