# HG changeset patch # User unc0rr # Date 1242244425 0 # Node ID 949fe7df09b6198ebc690748a85a996c2772108d # Parent 8149802b4f149b338367e91556f1b7481abd6ec7 Fix engine crash due to screwing up visual gears list in speechbubbles handler diff -r 8149802b4f14 -r 949fe7df09b6 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Wed May 13 01:30:08 2009 +0000 +++ b/hedgewars/uVisualGears.pas Wed May 13 19:53:45 2009 +0000 @@ -253,17 +253,20 @@ if Gear^.Timer = 0 then begin - PHedgehog(Gear^.Hedgehog)^.SpeechGear:= nil; + if PHedgehog(Gear^.Hedgehog)^.SpeechGear = Gear then + PHedgehog(Gear^.Hedgehog)^.SpeechGear:= nil; DeleteVisualGear(Gear) end; end; procedure doStepSpeechBubble(Gear: PVisualGear; Steps: Longword); begin -if (PHedgehog(Gear^.Hedgehog)^.SpeechGear <> nil) then DeleteVisualGear(PHedgehog(Gear^.Hedgehog)^.SpeechGear); +with PHedgehog(Gear^.Hedgehog)^ do + if SpeechGear <> nil then SpeechGear^.Timer:= 0; + PHedgehog(Gear^.Hedgehog)^.SpeechGear:= Gear; -Gear^.Timer:= max(Length(Gear^.Text)*150,3000); +Gear^.Timer:= max(Length(Gear^.Text) * 150, 3000); Gear^.Tex:= RenderSpeechBubbleTex(Gear^.Text, Gear^.FrameTicks, fnt16);