anchor.diff:  var
     G: TKMUnitGroup;
   begin
  +  Result := -1;
     try
       if InRange(aPlayer, 0, gHands.Count - 1) and (gHands[aPlayer].Enabled)
  -    and gTerrain.TileInMapCoords(X, Y) then
  +      and gTerrain.TileInMapCoords(X, Y) then
       begin
         G := gHands[aPlayer].UnitGroups.GetClosestGroup(KMPoint(X,Y), aGroupTypes);
         if G <> nil then
  
positive.code: function TKMScriptStates.ClosestHouse(aPlayer, X, Y, aHouseType: Integer): Integer;
  var
    HT: TKMHouseType;
    hasError: Boolean;
  begin
    hasError := False;
    if aHouseType = -1 then
      HT := htAny
    else
    if HouseTypeValid(aHouseType) then
      HT := HOUSE_ID_TO_TYPE[aHouseType]
    else
      hasError := True;
  
    if not hasError then
      Result := _ClosestHouse(aPlayer, X, Y, HT, 'States.ClosestHouse')
    else
      LogParamWarning('States.ClosestHouse', [aPlayer, X, Y, Byte(aHouseType)]);
  
negative.code:   B: Byte;
    GTS: TKMGroupTypeSet;
  begin
    GTS := [];
    for B in [Byte(Low(TKMGroupType))..Byte(High(TKMGroupType))] do
      if B in aGroupTypes then
  