# HG changeset patch # User nemo # Date 1321294418 18000 # Node ID c6f73d8e87e2822a3afe82092d95f4317fe95bd7 # Parent fb9aeddcb046204fea3e139865535354d80c02de Skip rerendering the caption if the text is unchanged. Scripts make heavy use of caption, often onGameTick diff -r fb9aeddcb046 -r c6f73d8e87e2 hedgewars/uCaptions.pas --- a/hedgewars/uCaptions.pas Mon Nov 14 13:28:16 2011 +0400 +++ b/hedgewars/uCaptions.pas Mon Nov 14 13:13:38 2011 -0500 @@ -35,17 +35,24 @@ type TCaptionStr = record Tex: PTexture; EndTime: LongWord; + Text: shortstring; end; var Captions: array[TCapGroup] of TCaptionStr; procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup); begin - if Captions[Group].Tex <> nil then + if (Captions[Group].Tex <> nil) and (Captions[Group].Text <> s) then + begin FreeTexture(Captions[Group].Tex); - Captions[Group].Tex:= nil; - - Captions[Group].Tex:= RenderStringTex(s, Color, fntBig); + Captions[Group].Tex:= nil + end; + + if Captions[Group].Text <> s then + begin + Captions[Group].Text:= s; + Captions[Group].Tex:= RenderStringTex(s, Color, fntBig) + end; case Group of capgrpGameState: Captions[Group].EndTime:= RealTicks + 2200