# HG changeset patch # User nemo # Date 1290049747 18000 # Node ID 3836973380b9d29fab8000b1027f926fee29ea13 # Parent ae172b2b03ed8d09751126facfd156775cec5dc9 remove some more PHedgehog casts diff -r ae172b2b03ed -r 3836973380b9 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Wed Nov 17 22:26:34 2010 +0300 +++ b/hedgewars/GSHandlers.inc Wed Nov 17 22:09:07 2010 -0500 @@ -78,15 +78,15 @@ if (d > 1) and not gi^.Invulnerable and (GetRandom(2) = 0) then begin if (CurrentHedgehog^.Gear = gi) then - PlaySound(sndOops, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) + PlaySound(sndOops, gi^.Hedgehog^.Team^.voicepack) else begin if (gi^.State and gstMoving) = 0 then gi^.State := gi^.State or gstLoser; if d > r div 2 then - PlaySound(sndNooo, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) + PlaySound(sndNooo, gi^.Hedgehog^.Team^.voicepack) else - PlaySound(sndUhOh, PHedgehog(gi^.Hedgehog)^.Team^.voicepack); + PlaySound(sndUhOh, gi^.Hedgehog^.Team^.voicepack); end; end; end; @@ -1109,7 +1109,7 @@ begin DeleteGear(Gear); isCursorVisible := false; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); exit end; @@ -1356,10 +1356,10 @@ begin if (Gear^.State and gstAttacked) = 0 then begin - OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); + OnUsedAmmo(HHGear^.Hedgehog^); Gear^.State := Gear^.State or gstAttacked end; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) + ApplyAmmoChanges(HHGear^.Hedgehog^) end; begin @@ -2021,7 +2021,7 @@ Gear^.doStep := @doStepFirePunchWork; DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); - PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), PHedgehog(HHGear^.Hedgehog)^.Team^. + PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), HHGear^.Hedgehog^.Team^. voicepack) end; @@ -2049,7 +2049,7 @@ end; DeleteGear(Gear); isCursorVisible := false; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); exit end; @@ -2278,11 +2278,11 @@ HHGear := Gear^.Hedgehog^.Gear; Msg := Gear^.Message and not gmSwitch; DeleteGear(Gear); - OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + OnUsedAmmo(HHGear^.Hedgehog^); + ApplyAmmoChanges(HHGear^.Hedgehog^); HHGear := CurrentHedgehog^.Gear; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); HHGear^.Message := Msg; exit end; @@ -3152,7 +3152,7 @@ end; DeleteGear(Gear); isCursorVisible := false; - ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); + ApplyAmmoChanges(HHGear^.Hedgehog^); // if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); // Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall) @@ -4321,13 +4321,13 @@ resgear^.Health := graves[i]^.Health; PHedgehog(graves[i]^.Hedgehog)^.Gear := resgear; DeleteGear(graves[i]); - RenderHealth(PHedgehog(resgear^.Hedgehog)^); - RecountTeamHealth(Phedgehog(resgear^.Hedgehog)^.Team); - PHedgehog(resgear^.Hedgehog)^.Effects[heResurrected]:= true; - if PHedgehog(resgear^.Hedgehog)^.Hat = 'NoHat' then + RenderHealth(resgear^.Hedgehog^); + RecountTeamHealth(resgear^.Hedgehog^.Team); + resgear^.Hedgehog^.Effects[heResurrected]:= true; + if resgear^.Hedgehog^.Hat = 'NoHat' then begin - FreeTexture(PHedgehog(resgear^.Hedgehog)^.HatTex); - PHedgehog(resgear^.Hedgehog)^.HatTex := Surface2Tex( + FreeTexture(resgear^.Hedgehog^.HatTex); + resgear^.Hedgehog^.HatTex := Surface2Tex( LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone), True) end diff -r ae172b2b03ed -r 3836973380b9 hedgewars/HHHandlers.inc --- a/hedgewars/HHHandlers.inc Wed Nov 17 22:26:34 2010 +0300 +++ b/hedgewars/HHHandlers.inc Wed Nov 17 22:09:07 2010 -0500 @@ -454,16 +454,16 @@ posCaseUtility, posCaseAmmo: begin a:= Gear^.AmmoType; - AddAmmo(PHedgehog(HH^.Hedgehog)^, a); + AddAmmo(HH^.Hedgehog^, a); // Possibly needs to check shared clan ammo game flag once added. // On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up - if (not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven - or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0))) - or (PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex = LocalClan) + if (not (HH^.Hedgehog^.Team^.ExtDriven + or (HH^.Hedgehog^.BotLevel > 0))) + or (HH^.Hedgehog^.Team^.Clan^.ClanIndex = LocalClan) or (GameType = gmtDemo) then begin s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')'; - AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); + AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); // show ammo icon vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo); @@ -474,12 +474,12 @@ end; posCaseHealth: begin inc(HH^.Health, Gear^.Health); - PHedgehog(HH^.Hedgehog)^.Effects[hePoisoned] := false; + HH^.Hedgehog^.Effects[hePoisoned] := false; str(Gear^.Health, s); s:= '+' + s; - AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); - RenderHealth(PHedgehog(HH^.Hedgehog)^); - RecountTeamHealth(PHedgehog(HH^.Hedgehog)^.Team); + AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); + RenderHealth(HH^.Hedgehog^); + RecountTeamHealth(HH^.Hedgehog^.Team); i:= 0; while i < Gear^.Health do diff -r ae172b2b03ed -r 3836973380b9 hedgewars/uAI.pas --- a/hedgewars/uAI.pas Wed Nov 17 22:26:34 2010 +0300 +++ b/hedgewars/uAI.pas Wed Nov 17 22:09:07 2010 -0500 @@ -66,7 +66,7 @@ Score, i: LongInt; a, aa: TAmmoType; begin -BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel; +BotLevel:= Me^.Hedgehog^.BotLevel; for i:= 0 to Pred(Targets.Count) do if (Targets.ar[i].Score >= 0) and (not StopThinking) then @@ -195,7 +195,7 @@ Actions.Pos:= 0; Actions.Score:= 0; Stack.Count:= 0; -BotLevel:= PHedgehog(Me^.Hedgehog)^.BotLevel; +BotLevel:= Me^.Hedgehog^.BotLevel; tmp:= random(2) + 1; Push(0, Actions, Me^, tmp); @@ -322,7 +322,7 @@ FillBonuses((Me^.State and gstAttacked) <> 0); for a:= Low(TAmmoType) to High(TAmmoType) do - CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and HHHasAmmo(PHedgehog(Me^.Hedgehog)^, a); + CanUseAmmo[a]:= Assigned(AmmoTests[a].proc) and HHHasAmmo(Me^.Hedgehog^, a); {$IFDEF DEBUGFILE}AddFileLog('Enter Think Thread');{$ENDIF} BeginThread(@Think, Me, ThinkThread) end; diff -r ae172b2b03ed -r 3836973380b9 hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Wed Nov 17 22:26:34 2010 +0300 +++ b/hedgewars/uAIMisc.pas Wed Nov 17 22:09:07 2010 -0500 @@ -131,7 +131,7 @@ begin bonuses.Count:= 0; -MyClan:= PHedgehog(ThinkingHH^.Hedgehog)^.Team^.Clan; +MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan; Gear:= GearsList; while Gear <> nil do begin diff -r ae172b2b03ed -r 3836973380b9 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Wed Nov 17 22:26:34 2010 +0300 +++ b/hedgewars/uGears.pas Wed Nov 17 22:09:07 2010 -0500 @@ -197,7 +197,7 @@ 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^.Hedgehog:= HHGear^.Hedgehog; // the tag needs the tag to determine the text color AllInactive:= false; HHGear^.Active:= true; end; @@ -267,8 +267,8 @@ gear^.Angle:= cMaxAngle div 2; gear^.Z:= cHHZ; if (GameFlags and gfAISurvival) <> 0 then - if PHedgehog(gear^.Hedgehog)^.BotLevel > 0 then - PHedgehog(gear^.Hedgehog)^.Effects[heResurrectable] := true; + if gear^.Hedgehog^.BotLevel > 0 then + gear^.Hedgehog^.Effects[heResurrectable] := true; end; gtShell: begin gear^.Radius:= 4; @@ -929,10 +929,10 @@ while t <> nil do begin t^.PortalCounter:= 0; - if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < PHedgehog(t^.Hedgehog)^.InitialHealth) then + if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < t^.Hedgehog^.InitialHealth) then begin - t^.Health:= PHedgehog(t^.Hedgehog)^.InitialHealth; - RenderHealth(PHedgehog(t^.Hedgehog)^); + t^.Health:= t^.Hedgehog^.InitialHealth; + RenderHealth(t^.Hedgehog^); end; t:= t^.NextGear end; @@ -1613,11 +1613,11 @@ if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex); Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16); end; - tempTeam := PHedgehog(gear^.Hedgehog)^.Team; + tempTeam := gear^.Hedgehog^.Team; DeleteCI(gear); FindPlace(gear, false, 0, LAND_WIDTH); if gear <> nil then begin - RenderHealth(PHedgehog(gear^.Hedgehog)^); + RenderHealth(gear^.Hedgehog^); ScriptCall('onGearResurrect', gear^.uid); end; RecountTeamHealth(tempTeam); diff -r ae172b2b03ed -r 3836973380b9 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Wed Nov 17 22:26:34 2010 +0300 +++ b/hedgewars/uScript.pas Wed Nov 17 22:09:07 2010 -0500 @@ -299,7 +299,7 @@ else begin gear := GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then - lua_pushinteger(L, PHedgehog(gear^.Hedgehog)^.BotLevel) + lua_pushinteger(L, gear^.Hedgehog^.BotLevel) else lua_pushnil(L); end; @@ -319,7 +319,7 @@ gear:= GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then begin - lua_pushinteger(L, PHedgehog(gear^.Hedgehog)^.Team^.Clan^.ClanIndex) + lua_pushinteger(L, gear^.Hedgehog^.Team^.Clan^.ClanIndex) end else lua_pushnil(L); @@ -340,7 +340,7 @@ gear:= GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then begin - lua_pushstring(L, str2pchar(PHedgehog(gear^.Hedgehog)^.Team^.TeamName)) + lua_pushstring(L, str2pchar(gear^.Hedgehog^.Team^.TeamName)) end else lua_pushnil(L); @@ -361,7 +361,7 @@ gear:= GearByUID(lua_tointeger(L, 1)); if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then begin - lua_pushstring(L, str2pchar(PHedgehog(gear^.Hedgehog)^.Name)) + lua_pushstring(L, str2pchar(gear^.Hedgehog^.Name)) end else lua_pushnil(L); @@ -570,7 +570,7 @@ else begin gear := GearByUID(lua_tointeger(L, 1)); if gear <> nil then - PHedgehog(gear^.Hedgehog)^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_tointeger(L, 3) <> 0; + gear^.Hedgehog^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_tointeger(L, 3) <> 0; end; lc_seteffect := 0; end; diff -r ae172b2b03ed -r 3836973380b9 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Wed Nov 17 22:26:34 2010 +0300 +++ b/hedgewars/uVariables.pas Wed Nov 17 22:09:07 2010 -0500 @@ -2241,4 +2241,4 @@ cReadyDelay := 0; end; -end. \ No newline at end of file +end.