455 |
456 |
456 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
457 team:= PHedgehog(Gear^.Hedgehog)^.Team; |
457 if CurrentHedgehog^.Gear = Gear then |
458 if CurrentHedgehog^.Gear = Gear then |
458 FreeActionsList; // to avoid ThinkThread on drawned gear |
459 FreeActionsList; // to avoid ThinkThread on drawned gear |
459 |
460 |
|
461 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
460 if PHedgehog(Gear^.Hedgehog)^.King then |
462 if PHedgehog(Gear^.Hedgehog)^.King then |
461 begin |
463 begin |
462 // are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough |
464 // are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough |
463 k:= 0; |
465 k:= false; |
464 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
466 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
465 if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then inc(k); |
467 if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then k:= true; |
466 if k < 2 then // current dying king is count of 1 |
468 if not k then |
467 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
469 for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
468 TeamGoneEffect(team^.Clan^.Teams[i]^) |
470 TeamGoneEffect(team^.Clan^.Teams[i]^) |
469 end; |
471 end; |
470 |
|
471 PHedgehog(Gear^.Hedgehog)^.Gear:= nil; |
|
472 inc(KilledHHs); |
472 inc(KilledHHs); |
473 RecountTeamHealth(team) |
473 RecountTeamHealth(team) |
474 end; |
474 end; |
475 {$IFDEF DEBUGFILE} |
475 {$IFDEF DEBUGFILE} |
476 with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind))); |
476 with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind))); |