anchor.diff:                         gicArmyFormation, gicArmyWalk, gicArmyStorm]
       then
       begin
  -      srcGroup := gHands.GetGroupByUID(Params[1]);
  +      srcGroup := gHands.GetGroupByUID(Params[0]);
         if (srcGroup = nil) or srcGroup.IsDead //Group has died before command could be executed
         or (srcGroup.Owner <> aCommand.HandIndex) then //Potential exploit
           Exit;
       end;
       if CommandType in [gicArmyLink] then
       begin
  -      TgtGroup := gHands.GetGroupByUID(Params[2]);
  +      TgtGroup := gHands.GetGroupByUID(Params[1]);
         if (TgtGroup = nil) or TgtGroup.IsDead //Unit has died before command could be executed
         or (TgtGroup.Owner <> aCommand.HandIndex) then //Potential exploit
           Exit;
       end;
       if CommandType in [gicArmyAttackUnit] then
       begin
  -      tgtUnit := gHands.GetUnitByUID(Params[2]);
  +      tgtUnit := gHands.GetUnitByUID(Params[1]);
         if (tgtUnit = nil) or tgtUnit.IsDeadOrDying then //Unit has died before command could be executed
           Exit;
       end;
  
positive.code:                 [GetEnumName(TypeInfo(TKMGameInputCommandType), Integer(aGIC)),
                   GetEnumName(TypeInfo(TKMGameInputCommandPackType), Integer(COMMAND_PACK_TYPES[aGIC]))]));
    Result := MakeEmptyCommand(aGIC);
    Result.Params[1] := aParam1;
    Result.Params[2] := aParam2;
    Result.Params[3] := aParam3;
    Result.Params[4] := aParam4;
  end;
  
  
  
negative.code:       gicHouseDeliveryModePrev:   //Delivery mode has to be delayed, to avoid occasional delivery mode button clicks
                                    srcHouse.SetPrevDeliveryMode;
        gicHouseClosedForWorkerTgl: srcHouse.IsClosedForWorker := not srcHouse.IsClosedForWorker;
        gicHouseOrderProduct:      srcHouse.ResOrder[Params[1]] := srcHouse.ResOrder[Params[1]] + Params[2];
        gicHouseMarketFrom:        TKMHouseMarket(srcHouse).ResFrom := TKMWareType(Params[1]);
        gicHouseMarketTo:          TKMHouseMarket(srcHouse).ResTo := TKMWareType(Params[1]);
        gicHouseStoreNotAcceptFlag:   TKMHouseStore(srcHouse).ToggleNotAcceptFlag(TKMWareType(Params[1]));
        gicHStoreNotAllowTakeOutFlag:
                                   TKMHouseStore(srcHouse).ToggleNotAcceptTakeOutFlag(TKMWareType(Params[1]));
        gicHouseWoodcutterMode:    TKMHouseWoodcutters(srcHouse).WoodcutterMode := TKMWoodcutterMode(Params[1]);
        gicHouseBarracksAcceptFlag:
                                    TKMHouseBarracks(srcHouse).ToggleNotAcceptFlag(TKMWareType(Params[1]));
        gicHBarracksNotAllowTakeOutFlag:
                                    TKMHouseBarracks(srcHouse).ToggleNotAllowTakeOutFlag(TKMWareType(Params[1]));
        gicHBarracksAcceptRecruitsTgl:
                                    TKMHouseBarracks(srcHouse).ToggleAcceptRecruits;
        gicHouseBarracksEquip:     TKMHouseBarracks(srcHouse).Equip(TKMUnitType(Params[1]), Params[2]);
        gicHouseBarracksRally:     TKMHouseBarracks(srcHouse).FlagPoint := KMPoint(Params[1], Params[2]);
        gicHouseTownHallEquip:     TKMHouseTownHall(srcHouse).Equip(TKMUnitType(Params[1]), Params[2]);
        gicHouseTownHallRally:     TKMHouseTownHall(srcHouse).FlagPoint := KMPoint(Params[1], Params[2]);
        gicHouseTownHallMaxGold:   TKMHouseTownHall(srcHouse).GoldMaxCnt := EnsureRange(Params[1], 0, High(Word));
        gicHouseSchoolTrain:       TKMHouseSchool(srcHouse).AddUnitToQueue(TKMUnitType(Params[1]), Params[2]);
        gicHouseSchoolTrainChOrder:TKMHouseSchool(srcHouse).ChangeUnitTrainOrder(Params[1], Params[2]);
        gicHouseSchoolTrainChLastUOrder: TKMHouseSchool(srcHouse).ChangeUnitTrainOrder(Params[1]);
        gicHouseRemoveTrain:       TKMHouseSchool(srcHouse).RemUnitFromQueue(Params[1]);
        gicHouseWoodcuttersCutting: TKMHouseWoodcutters(srcHouse).FlagPoint := KMPoint(Params[1], Params[2]);
        gicHouseArmorWSDeliveryToggle:   TKMHouseArmorWorkshop(srcHouse).ToggleResDelivery(TKMWareType(Params[1]));
  
        gicWareDistributionChange:  begin
                                      P.Stats.WareDistribution[TKMWareType(Params[0]), TKMHouseType(Params[1])] := Params[2];
                                      P.Houses.UpdateResRequest;
                                    end;
        gicWareDistributions:       begin
  