anchor.diff:      //Alliances
       for k:=1 to fPlayers.Count do
         if k<>i then
  -        AddCommand(ct_SetAlliance,2,k-1,byte(fPlayers.Player[i].Alliances[k])); //0=enemy, 1=ally
  +        AddCommand(ct_SetAlliance, [k-1,byte(fPlayers.Player[i].Alliances[k])]); //0=enemy, 1=ally
       AddData(''); //NL
       //Release/block houses
       ReleaseAllHouses := true;
  
positive.code:       CurHouse := TKMHouse(fPlayers.Player[i].Houses.Items[k]);
        if not CurHouse.IsDestroyed then
        begin
          AddCommand(ct_SetHouse,3,byte(CurHouse.GetHouseType)-1,CurHouse.GetPosition.X-1,CurHouse.GetPosition.Y-1);
          if CurHouse.IsDamaged then
            AddCommand(ct_SetHouseDamage,1,CurHouse.GetDamage);
        end;
      end;
      AddData(''); //NL
  
negative.code:   CurHouse: TKMHouse;
    ReleaseAllHouses: boolean;
    SaveString: string;
  
    procedure AddData(aText:string);
    begin
      if CommandLayerCount = -1 then //No layering
        SaveString := SaveString + aText + eol //Add to the string normally
      else
      begin
        case (CommandLayerCount mod COMMANDLAYERS) of
          0:   SaveString := SaveString + eol + aText //Put a line break every 4 commands
          else SaveString := SaveString + ' ' + aText; //Just put spaces so commands "layer"
        end;
        inc(CommandLayerCount);
      end
    end;
  
    procedure AddCommand(aCommand:TKMCommandType; aComParam:TKMCommandParamType; aParams:array of integer); overload;
    var OutData: string; i:integer;
    begin
      OutData := '!' + COMMANDVALUES[aCommand];
  
      if aComParam <> cpt_Unknown then
        OutData := OutData + ' ' + PARAMVALUES[aComParam];
  
      for i:=Low(aParams) to High(aParams) do
        OutData := OutData + ' ' + IntToStr(aParams[i]);
  
      AddData(OutData);
    end;
  
    procedure AddCommand(aCommand:TKMCommandType; aParams:array of integer); overload;
    begin
      AddCommand(aCommand, cpt_Unknown, aParams);
    end;
  
  begin
    //Write out a KaM format mission file to aFileName
  
    //todo: it will be right to remove empty players before save
    //Update Count, IDs, Alliances, Goals
  
    //Put data into stream
    SaveString := '';
  