hedgewars/uVisualGears.pas
changeset 2051 949fe7df09b6
parent 2047 805f7b62cff6
child 2143 ad05f6b2d1c0
--- 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);