# HG changeset patch # User Stepan777 # Date 1342182942 -14400 # Node ID 27bfd8bbde7ece626ea904c7b85eaa5e0d236d7c # Parent e82a076df09b8d1e3731efe5a3184c48b0a53c00# Parent 92535bc7e9288d2246a02c770e9878d435ebd6b0 merge diff -r e82a076df09b -r 27bfd8bbde7e QTfrontend/ui/page/pageplayrecord.cpp --- a/QTfrontend/ui/page/pageplayrecord.cpp Tue Jul 10 21:58:19 2012 +0400 +++ b/QTfrontend/ui/page/pageplayrecord.cpp Fri Jul 13 16:35:42 2012 +0400 @@ -169,7 +169,11 @@ if(!ok) QMessageBox::critical(this, tr("Error"), tr("Cannot delete file")); else - FillFromDir(recType); + { + int i = DemosList->row(curritem); + delete curritem; + DemosList->setCurrentRow(i < DemosList->count() ? i : DemosList->count() - 1); + } } bool PagePlayDemo::isSave() diff -r e82a076df09b -r 27bfd8bbde7e gameServer/ClientIO.hs --- a/gameServer/ClientIO.hs Tue Jul 10 21:58:19 2012 +0400 +++ b/gameServer/ClientIO.hs Fri Jul 13 16:35:42 2012 +0400 @@ -66,12 +66,11 @@ killReciever . B.unpack $ quitMessage answer Exception.handle - (\(e :: Exception.IOException) -> unless (isQuit answer) . killReciever $ show e) $ + (\(e :: Exception.SomeException) -> unless (isQuit answer) . killReciever $ show e) $ sendAll s $ B.unlines answer `B.snoc` '\n' if isQuit answer then - do - Exception.handle (\(_ :: Exception.IOException) -> putStrLn "error on sClose") $ sClose s + sClose s else clientSendLoop s tId chan ci diff -r e82a076df09b -r 27bfd8bbde7e hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Tue Jul 10 21:58:19 2012 +0400 +++ b/hedgewars/VGSHandlers.inc Fri Jul 13 16:35:42 2012 +0400 @@ -27,6 +27,7 @@ procedure doStepFlake(Gear: PVisualGear; Steps: Longword); var sign: real; + moved: boolean; begin if vobCount = 0 then exit; @@ -84,21 +85,37 @@ end else begin + moved:= false; if round(X) < cLeftScreenBorder then - X:= X + cScreenSpace + begin + X:= X + cScreenSpace; + moved:= true + end else if round(X) > cRightScreenBorder then + begin X:= X - cScreenSpace; + moved:= true + end; // if round(Y) < (LAND_HEIGHT - 1024 - 75) then Y:= Y + 25.0; // For if flag is set for flakes rising upwards? if (Gear^.Layer = 2) and (round(Y) - 225 > LAND_HEIGHT) then begin X:= cLeftScreenBorder + random(cScreenSpace); - Y:= Y - (1024 + 250 + random(50)) // TODO - configure in theme (jellies for example could use limited range) + Y:= Y - (1024 + 250 + random(50)); // TODO - configure in theme (jellies for example could use limited range) + moved:= true end else if (Gear^.Layer <> 2) and (round(Y) + 50 > LAND_HEIGHT) then begin X:= cLeftScreenBorder + random(cScreenSpace); - Y:= Y - (1024 + random(25)) + Y:= Y - (1024 + random(25)); + moved:= true + end; + if moved then + begin + Angle:= random(360); + dx:= 0.0000038654705 * random(10000); + dy:= 0.000003506096 * random(7000); + if random(2) = 0 then dx := -dx end; Timer:= 0; tdX:= 0; diff -r e82a076df09b -r 27bfd8bbde7e hedgewars/uAI.pas --- a/hedgewars/uAI.pas Tue Jul 10 21:58:19 2012 +0400 +++ b/hedgewars/uAI.pas Fri Jul 13 16:35:42 2012 +0400 @@ -336,7 +336,9 @@ switchesNum:= 0; switchImmediatelyAvailable:= (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtSwitcher); -switchCount:= HHHasAmmo(PGear(Me)^.Hedgehog^, amSwitch); +if PGear(Me)^.Hedgehog^.BotLevel <> 5 then + switchCount:= HHHasAmmo(PGear(Me)^.Hedgehog^, amSwitch) +else switchCount:= 0; if (PGear(Me)^.State and gstAttacked) = 0 then if Targets.Count > 0 then @@ -390,6 +392,11 @@ BackMe:= PGear(Me)^; while (not StopThinking) and (BestActions.Count = 0) do begin +(* + // Maybe this would get a bit of movement out of them? Hopefully not *toward* water. Need to check how often he'd choose that strategy + if SuddenDeathDmg and ((hwRound(BackMe.Y)+cWaterRise*2) > cWaterLine) then + AddBonus(hwRound(BackMe.X), hwRound(BackMe.Y), 250, -40); +*) FillBonuses(true); WalkMe:= BackMe; Actions.Count:= 0; diff -r e82a076df09b -r 27bfd8bbde7e hedgewars/uAIAmmoTests.pas --- a/hedgewars/uAIAmmoTests.pas Tue Jul 10 21:58:19 2012 +0400 +++ b/hedgewars/uAIAmmoTests.pas Fri Jul 13 16:35:42 2012 +0400 @@ -599,6 +599,7 @@ d: Longword; fallDmg, valueResult: LongInt; begin +if Me^.Hedgehog^.BotLevel > 3 then exit(BadTurn); dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; Level:= Level; // avoid compiler hint ap.ExplR:= 0; @@ -648,6 +649,7 @@ d: Longword; fallDmg, valueResult: LongInt; begin +if Me^.Hedgehog^.BotLevel > 3 then exit(BadTurn); dmgMod:= 0.01 * hwFloat2Float(cDamageModifier) * cDamagePercent; Level:= Level; // avoid compiler hint ap.ExplR:= 0; diff -r e82a076df09b -r 27bfd8bbde7e hedgewars/uAIMisc.pas --- a/hedgewars/uAIMisc.pas Tue Jul 10 21:58:19 2012 +0400 +++ b/hedgewars/uAIMisc.pas Fri Jul 13 16:35:42 2012 +0400 @@ -54,6 +54,7 @@ procedure freeModule; procedure FillTargets; +procedure AddBonus(x, y: LongInt; r: Longword; s: LongInt); inline; procedure FillBonuses(isAfterAttack: boolean); procedure AwareOfExplosion(x, y, r: LongInt); inline; @@ -80,6 +81,11 @@ ar: array[0..Pred(MAXBONUS)] of TBonus; end; + walkbonuses: record + Count: Longword; + ar: array[0..Pred(MAXBONUS div 8)] of TBonus; // don't use too many + end; + implementation uses uCollisions, uVariables, uUtils, uDebug, uLandTexture; @@ -140,9 +146,22 @@ end; end; +procedure AddWalkBonus(x, y: LongInt; r: Longword; s: LongInt); inline; +begin +if(walkbonuses.Count < MAXBONUS div 8) then + begin + walkbonuses.ar[walkbonuses.Count].x:= x; + walkbonuses.ar[walkbonuses.Count].y:= y; + walkbonuses.ar[walkbonuses.Count].Radius:= r; + walkbonuses.ar[walkbonuses.Count].Score:= s; + inc(walkbonuses.Count); + end; +end; + procedure FillBonuses(isAfterAttack: boolean); var Gear: PGear; MyClan: PClan; + i: Longint; begin bonuses.Count:= 0; MyClan:= ThinkingHH^.Hedgehog^.Team^.Clan; @@ -178,7 +197,9 @@ if Gear^.Damage >= Gear^.Health then AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 60, -25) else - if isAfterAttack and (ThinkingHH^.Hedgehog <> Gear^.Hedgehog) then + if isAfterAttack + and (ThinkingHH^.Hedgehog <> Gear^.Hedgehog) + and ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_1) then if (ClansCount > 2) or (MyClan = Gear^.Hedgehog^.Team^.Clan) then AddBonus(hwRound(Gear^.X), hwRound(Gear^.Y), 150, -3) // hedgehog-friend else @@ -190,6 +211,13 @@ if isAfterAttack and (KnownExplosion.Radius > 0) then with KnownExplosion do AddBonus(X, Y, Radius + 10, -Radius); +if isAfterAttack then + begin + for i:= 0 to Pred(walkbonuses.Count) do + with walkbonuses.ar[i] do + AddBonus(X, Y, Radius, Score); + walkbonuses.Count:= 0 + end; end; procedure AwareOfExplosion(x, y, r: LongInt); inline; @@ -642,7 +670,7 @@ end; function HHGo(Gear, AltGear: PGear; var GoInfo: TGoInfo): boolean; -var pX, pY: LongInt; +var pX, pY, tY: LongInt; begin HHGo:= false; AltGear^:= Gear^; @@ -650,12 +678,16 @@ GoInfo.Ticks:= 0; GoInfo.FallPix:= 0; GoInfo.JumpType:= jmpNone; - +tY:= hwRound(Gear^.Y); repeat pX:= hwRound(Gear^.X); pY:= hwRound(Gear^.Y); if pY + cHHRadius >= cWaterLine then - exit(false); + begin + if AltGear^.Hedgehog^.BotLevel < 4 then + AddWalkBonus(pX, tY, 250, -40); + exit(false) + end; // hog is falling if (Gear^.State and gstMoving) <> 0 then @@ -667,6 +699,8 @@ Goinfo.FallPix:= 0; // try ljump instead of fall with damage HHJump(AltGear, jmpLJump, GoInfo); + if AltGear^.Hedgehog^.BotLevel < 4 then + AddWalkBonus(pX, tY, 175, -20); exit(false) end; Gear^.Y:= Gear^.Y + Gear^.dY; diff -r e82a076df09b -r 27bfd8bbde7e hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Tue Jul 10 21:58:19 2012 +0400 +++ b/hedgewars/uGearsHedgehog.pas Fri Jul 13 16:35:42 2012 +0400 @@ -355,7 +355,6 @@ newGear:= AddGear(hwRound(lx), hwRound(ly), gtResurrector, 0, _0, _0, 0); newGear^.SoundChannel := LoopSound(sndResurrector); end; - //amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0); amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000); amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000); amIceGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtIceGun, 0, _0, _0, 0);