hey sheepluva, how about just this? lets you have an anonymous one too.
authornemo
Tue, 11 May 2010 13:59:57 +0000
changeset 3459 c552aa44108d
parent 3458 11cd56019f00
child 3460 d957d5f7b58d
hey sheepluva, how about just this? lets you have an anonymous one too.
hedgewars/VGSHandlers.inc
hedgewars/uGears.pas
--- a/hedgewars/VGSHandlers.inc	Mon May 10 17:48:06 2010 +0000
+++ b/hedgewars/VGSHandlers.inc	Tue May 11 13:59:57 2010 +0000
@@ -430,9 +430,7 @@
 procedure doStepHealthTagWork(Gear: PVisualGear; Steps: Longword);
 begin
 if Steps > Gear^.Timer then
-    begin
-    DeleteVisualGear(Gear);
-    end
+    DeleteVisualGear(Gear)
 else
     begin
     dec(Gear^.Timer, Steps);
@@ -457,9 +455,10 @@
 Gear^.dY:= -_0_08;
 
 str(Gear^.State, s);
-Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16);
-// if you segfault here you probably added this healthtag directly
-// maybe you should call spawnHealthTagForHH() in uGears.pas instead
+if Gear^.Hedgehog <> nil then
+    Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16)
+else
+    Gear^.Tex:= RenderStringTex(s, cWhiteColor, fnt16);
 
 if hwRound(Gear^.Y) < cWaterLine then
     Gear^.doStep:= @doStepHealthTagWork
--- a/hedgewars/uGears.pas	Mon May 10 17:48:06 2010 +0000
+++ b/hedgewars/uGears.pas	Tue May 11 13:59:57 2010 +0000
@@ -194,7 +194,7 @@
         ptmp:= tmp;
         tmp:= tmp^.NextGear
         end;
-
+    
     if ptmp <> tmp then
         begin
         Gear^.NextGear:= ptmp^.NextGear;
@@ -222,12 +222,9 @@
 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
 var tag: PVisualGear;
 begin
-tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);if (tag <> nil) then
-    begin
+tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);
+if (tag <> nil) then
     tag^.Hedgehog:= PHedgehog(HHGear^.Hedgehog); // the tag needs the tag to determine the text color
-    tag^.doStep(tag,1); // do this now because the Gear could already be deleted on next step call
-    tag^.Hedgehog:= nil
-    end;
 AllInactive:= false;
 HHGear^.Active:= true;
 end;