anchor.diff:      SQR_MAX_DISTANCE = 20*20;
     var
       K: Integer;
  -    Distance, BestDistance: Single;
  +    distance, bestDistance: Single;
     begin
       aRes := KMPOINT_ZERO; // Set default point to zero so there is not integer overflow during evaluation if resource does not exist
  -    BestDistance := 1e10;
  +    bestDistance := 1e10;
       for K := 0 to aList.Count - 1 do
       begin
  -      Distance := KMDistanceSqr(aLoc, aList[K]);
  -      if (Distance < BestDistance) then
  +      distance := KMDistanceSqr(aLoc, aList[K]);
  +      if (distance < bestDistance) then
         begin
  -        BestDistance := Distance;
  +        bestDistance := distance;
           aRes := aList[K];
         end;
       end;
  -    Result := BestDistance < SQR_MAX_DISTANCE;
  +    Result := bestDistance < SQR_MAX_DISTANCE;
     end;
   
     // Place road and return true if it is possible
  
positive.code: //Defeated player remains in place, but does no actions
  procedure TKMHandAI.Defeat(aShowDefeatMessage: Boolean = True);
  begin
    if fWonOrLost = wolNone then
    begin
      fWonOrLost := wolLost;
  
      //Let the game know
      gGame.PlayerDefeat(fOwner, aShowDefeatMessage);
  
      //Script may have additional event processors
      gScriptEvents.ProcPlayerDefeated(fOwner);
    end;
  end;
  
  
  
negative.code:               //If we are a warrior we can also attack that unit ourselves
                if aUnit is TKMUnitWarrior then
                begin
                  group := gHands[fOwner].UnitGroups.GetGroupByMember(TKMUnitWarrior(aUnit));
                  //It's ok for the group to be nil, the warrior could still be walking out of the barracks
                  if (group <> nil) and not group.IsDead then
                    //If we are already in the process of attacking something, don't change our minds,
                    //otherwise you can make a unit walk backwards and forwards forever between two groups of archers
                    if not group.InFight then
                      //Make sure the group could possibly reach the offenders
                      if group.CanWalkTo(aAttacker.Position, group.FightMaxRange) then
                        group.OrderAttackUnit(aAttacker, True);
                end;
              end;
            end;
  