# HG changeset patch # User unc0rr # Date 1158254450 0 # Node ID e593d5266e01f8a6df713cf34c9e89042bc24358 # Parent e6084b0c9316fab1599400e7e3af875cc3eb8805 - Fix crash in AI - Dont allow to add more than 5 teams diff -r e6084b0c9316 -r e593d5266e01 hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Wed Sep 13 19:26:16 2006 +0000 +++ b/hedgewars/CCHandlers.inc Thu Sep 14 17:20:50 2006 +0000 @@ -47,8 +47,15 @@ end; procedure chAddTeam(var s: shortstring); +const TeamsCount: Longword = 0; begin -if isDeveloperMode then AddTeam; +if isDeveloperMode then + begin + inc(TeamsCount); + TryDo(TeamsCount <= 5, 'Too many teams', true); + AddTeam + end; + if GameType in [gmtDemo, gmtSave] then CurrentTeam.ExtDriven:= true end; diff -r e6084b0c9316 -r e593d5266e01 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Wed Sep 13 19:26:16 2006 +0000 +++ b/hedgewars/uGears.pas Thu Sep 14 17:20:50 2006 +0000 @@ -79,7 +79,7 @@ implementation uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, - uLand, uIO, uLandGraphics, uAIMisc, uLocale; + uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI; var RopePoints: record Count: Longword; HookAngle: integer; @@ -207,7 +207,7 @@ end; gtCase: begin Result.Radius:= 16; - Result.Elasticity:= 0.6 + Result.Elasticity:= 0.4 end; gtDEagleShot: begin Result.Radius:= 1; @@ -263,6 +263,8 @@ begin team:= PHedgehog(Gear.Hedgehog).Team; PHedgehog(Gear.Hedgehog).Gear:= nil; + if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].Gear = Gear then + FreeActionsList; // to avoid ThinkThread on drawned gear RecountTeamHealth(team); end; {$IFDEF DEBUGFILE}AddFileLog('DeleteGear: handle = '+inttostr(integer(Gear)));{$ENDIF}