# HG changeset patch # User unc0rr # Date 1137103656 0 # Node ID 0f396d0c429dbc686f4e1ac6147ba1cf2dd81113 # Parent 8daf1ee0b9a3f6036b67693aa763a0491690c8fd - New /skip command - Fixed "AI: incorrect try to switch weapon" bug diff -r 8daf1ee0b9a3 -r 0f396d0c429d hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Thu Jan 12 16:33:26 2006 +0000 +++ b/hedgewars/CCHandlers.inc Thu Jan 12 22:07:36 2006 +0000 @@ -334,3 +334,9 @@ flagMakeCapture:= true end; +procedure chSkip(var s: shortstring); +begin +if not CurrentTeam.ExtDriven then SendIPC(','); +TurnTimeLeft:= 0 +end; + diff -r 8daf1ee0b9a3 -r 0f396d0c429d hedgewars/uAI.pas --- a/hedgewars/uAI.pas Thu Jan 12 16:33:26 2006 +0000 +++ b/hedgewars/uAI.pas Thu Jan 12 22:07:36 2006 +0000 @@ -37,7 +37,7 @@ procedure ProcessBot; implementation -uses uAIActions, uAIMisc, uMisc, uTeams, uConsts, uAIAmmoTests, uGears, SDLh; +uses uAIActions, uAIMisc, uMisc, uTeams, uConsts, uAIAmmoTests, uGears, SDLh, uConsole; procedure Think; var Targets: TTargets; @@ -56,7 +56,8 @@ Me.Y:= round(Gear.Y); end; repeat - if isInMultiShoot then with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do + if isInMultiShoot or (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].AttacksNum > 0) + then with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do a:= Ammo[CurSlot, CurAmmo].AmmoType else a:= TAmmoType(random(ord(High(TAmmoType)))); aa:= a; @@ -71,7 +72,7 @@ end; if a = High(TAmmoType) then a:= Low(TAmmoType) else inc(a) - until isInMultiShoot or (a = aa); + until isInMultiShoot or (a = aa) or (CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].AttacksNum > 0); inc(t) until (t >= Targets.Count) end; @@ -112,7 +113,8 @@ begin with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do - if ((Gear.State and (gstAttacked or gstAttacking or gstMoving or gstFalling)) <> 0) then exit; + if ((Gear.State and (gstAttacked or gstAttacking or gstMoving or gstFalling)) <> 0) + or isInMultiShoot then exit; FillTargets(Targets); @@ -125,8 +127,11 @@ if IsActionListEmpty then begin - AddAction(aia_Weapon, ord(amSkip), 1000); - AddAction(aia_Attack, aim_push, 1000); + if CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog].AttacksNum = 0 then + begin + AddAction(aia_Weapon, ord(amSkip), 1000); + AddAction(aia_Attack, aim_push, 1000); + end else ParseCommand('skip'); exit end; diff -r 8daf1ee0b9a3 -r 0f396d0c429d hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Thu Jan 12 16:33:26 2006 +0000 +++ b/hedgewars/uAIAmmoTests.pas Thu Jan 12 22:07:36 2006 +0000 @@ -49,10 +49,10 @@ Test: TAmmoTestProc; Flags: Longword; end = ( - ( Test: TestGrenade; + ( Test: nil;//TestGrenade; Flags: ctfNotFull; ), - ( Test: TestBazooka; + ( Test: nil;//TestBazooka; Flags: ctfNotFull or ctfBreach; ), ( Test: nil; diff -r 8daf1ee0b9a3 -r 0f396d0c429d hedgewars/uConsole.pas --- a/hedgewars/uConsole.pas Thu Jan 12 16:33:26 2006 +0000 +++ b/hedgewars/uConsole.pas Thu Jan 12 22:07:36 2006 +0000 @@ -279,6 +279,7 @@ RegisterVariable('grave' , vtCommand, @chGrave ); RegisterVariable('bind' , vtCommand, @chBind ); RegisterVariable('add' , vtCommand, @chAdd ); +RegisterVariable('skip' , vtCommand, @chSkip ); RegisterVariable('say' , vtCommand, @chSay ); RegisterVariable('+left' , vtCommand, @chLeft_p ); RegisterVariable('-left' , vtCommand, @chLeft_m ); diff -r 8daf1ee0b9a3 -r 0f396d0c429d hedgewars/uGears.pas --- a/hedgewars/uGears.pas Thu Jan 12 16:33:26 2006 +0000 +++ b/hedgewars/uGears.pas Thu Jan 12 22:07:36 2006 +0000 @@ -228,6 +228,7 @@ end; procedure DeleteGear(Gear: PGear); +var team: PTeam; begin if Gear.CollIndex < High(Longword) then DeleteCR(Gear); if Gear.Kind = gtHedgehog then @@ -239,8 +240,9 @@ exit end else begin - RecountTeamHealth(PHedgehog(Gear.Hedgehog).Team); + team:= PHedgehog(Gear.Hedgehog).Team; PHedgehog(Gear.Hedgehog).Gear:= nil; + RecountTeamHealth(team); end; if CurAmmoGear = Gear then CurAmmoGear:= nil; diff -r 8daf1ee0b9a3 -r 0f396d0c429d hedgewars/uIO.pas --- a/hedgewars/uIO.pas Thu Jan 12 16:33:26 2006 +0000 +++ b/hedgewars/uIO.pas Thu Jan 12 22:07:36 2006 +0000 @@ -184,6 +184,7 @@ 'S': ParseCommand('switch'); 'j': ParseCommand('ljump'); 'J': ParseCommand('hjump'); + ',': ParseCommand('skip'); 'N': begin tmpflag:= false; {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(extcmd[cmdcurpos].Time)){$ENDIF}