# HG changeset patch # User nemo # Date 1321311404 18000 # Node ID ef4288298e57a77cf26753d58d5490182714730e # Parent b812bfcfeb496446040d89a8684117ef82b3aedc reset chat lines too diff -r b812bfcfeb49 -r ef4288298e57 hedgewars/uCaptions.pas --- a/hedgewars/uCaptions.pas Mon Nov 14 23:46:23 2011 +0200 +++ b/hedgewars/uCaptions.pas Mon Nov 14 17:56:44 2011 -0500 @@ -44,7 +44,7 @@ procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); begin - if (Captions[Group].Tex <> nil) and (Captions[Group].Text <> s) then + if Captions[Group].Text <> s then begin FreeTexture(Captions[Group].Tex); Captions[Group].Tex:= nil @@ -69,7 +69,7 @@ begin for Group:= Low(TCapGroup) to High(TCapGroup) do begin - if Captions[Group].Tex <> nil then FreeTexture(Captions[Group].Tex); + FreeTexture(Captions[Group].Tex); Captions[Group].Tex:= RenderStringTex(Captions[Group].Text, Captions[Group].Color, fntBig) end end; diff -r b812bfcfeb49 -r ef4288298e57 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Mon Nov 14 23:46:23 2011 +0200 +++ b/hedgewars/uChat.pas Mon Nov 14 17:56:44 2011 -0500 @@ -24,6 +24,7 @@ procedure initModule; procedure freeModule; +procedure ReloadLines; procedure AddChatString(s: shortstring); procedure DrawChat; @@ -72,15 +73,15 @@ cl.s:= str; if isInput then -begin + begin color:= colors[#6]; str:= UserNick + '> ' + str + '_' -end + end else -begin + begin color:= colors[str[1]]; delete(str, 1, 1) -end; + end; font:= CheckCJKFont(str, fnt16); w:= 0; h:= 0; // avoid compiler hints @@ -99,6 +100,14 @@ SDL_FreeSurface(resSurface) end; +// For uStore texture recreation +procedure ReloadLines; +var i: LongWord; +begin + SetLine(InputStr, InputStr.s, true); + for i:= 0 to MaxStrIndex do SetLine(Strs[i], Strs[i].s, false) +end; + procedure AddChatString(s: shortstring); begin if not ChatReady then @@ -370,20 +379,14 @@ missedCount:= 0; inputStr.Tex := nil; - for i:= 0 to MaxStrIndex do - begin - Strs[i].Tex := nil; - end; + for i:= 0 to MaxStrIndex do Strs[i].Tex := nil; end; procedure freeModule; var i: ShortInt; begin FreeTexture(InputStr.Tex); - for i:= 0 to MaxStrIndex do - begin - FreeTexture(Strs[i].Tex); - end; + for i:= 0 to MaxStrIndex do FreeTexture(Strs[i].Tex); end; end. diff -r b812bfcfeb49 -r ef4288298e57 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Mon Nov 14 23:46:23 2011 +0200 +++ b/hedgewars/uStore.pas Mon Nov 14 17:56:44 2011 -0500 @@ -21,7 +21,7 @@ unit uStore; interface -uses sysutils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions; +uses sysutils, uConsts, SDLh, GLunit, uTypes, uLandTexture, uCaptions, uChat; procedure initModule; procedure freeModule; @@ -1043,6 +1043,7 @@ ResetLand; ReloadCaptions; + ReloadLines; UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT) end;