anchor.diff:    UpdatePlayer(playerId);
   
     //There should be exactly one default human player
  -  if Sender = ChkBox_PlayerTypes[playerId, 0] then
  +  if Sender = ChkBox_PlayerTypes[playerId, mptDefault] then
     begin
       gGame.MapEditor.DefaultHuman := playerId;
       gGame.MapEditor.PlayerHuman[playerId] := True;
     end;
   
  -  if Sender = ChkBox_PlayerTypes[playerId, 1] then
  -  begin
  -    gGame.MapEditor.PlayerHuman[playerId] := ChkBox_PlayerTypes[playerId, 1].Checked;
  +  if Sender = ChkBox_PlayerTypes[playerId, mptHuman] then
  +  begin
  +    gGame.MapEditor.PlayerHuman[playerId] := ChkBox_PlayerTypes[playerId, mptHuman].Checked;
       //User cannot set player type undetermined
  -    if not ChkBox_PlayerTypes[playerId, 1].Checked
  -        and not ChkBox_PlayerTypes[playerId, 2].Checked
  -        and not ChkBox_PlayerTypes[playerId, 3].Checked then
  +    if not ChkBox_PlayerTypes[playerId, mptHuman].Checked
  +        and not ChkBox_PlayerTypes[playerId, mptClassicAI].Checked
  +        and not ChkBox_PlayerTypes[playerId, mptAdvancedAI].Checked then
           gGame.MapEditor.PlayerClassicAI[playerId] := True;
     end;
   
  -  if (Sender = ChkBox_PlayerTypes[playerId, 2])
  -    or (Sender = ChkBox_PlayerTypes[playerId, 3]) then
  -  begin
  -    gGame.MapEditor.PlayerClassicAI[playerId] := ChkBox_PlayerTypes[playerId, 2].Checked;
  -    gGame.MapEditor.PlayerAdvancedAI[playerId] := ChkBox_PlayerTypes[playerId, 3].Checked;
  -    if not ChkBox_PlayerTypes[playerId, 1].Checked then
  +  if (Sender = ChkBox_PlayerTypes[playerId, mptClassicAI])
  +    or (Sender = ChkBox_PlayerTypes[playerId, mptAdvancedAI]) then
  +  begin
  +    gGame.MapEditor.PlayerClassicAI[playerId] := ChkBox_PlayerTypes[playerId, mptClassicAI].Checked;
  +    gGame.MapEditor.PlayerAdvancedAI[playerId] := ChkBox_PlayerTypes[playerId, mptAdvancedAI].Checked;
  +    if not ChkBox_PlayerTypes[playerId, mptHuman].Checked then
       begin
         //User cannot set player type undetermined
  -      if not ChkBox_PlayerTypes[playerId, 2].Checked
  -        and not ChkBox_PlayerTypes[playerId, 3].Checked then
  +      if not ChkBox_PlayerTypes[playerId, mptClassicAI].Checked
  +        and not ChkBox_PlayerTypes[playerId, mptAdvancedAI].Checked then
           gGame.MapEditor.PlayerHuman[playerId] := True;
         //Can't be 2 default AI types (without human)
  -//      if CheckBox_PlayerTypes[PlayerId, 2].Checked
  -//        and CheckBox_PlayerTypes[PlayerId, 3].Checked then
  +//      if CheckBox_PlayerTypes[PlayerId, mptClassicAI].Checked
  +//        and CheckBox_PlayerTypes[PlayerId, mptAdvancedAI].Checked then
   //      begin
  -//        if (Sender = CheckBox_PlayerTypes[PlayerId, 2]) then
  +//        if (Sender = CheckBox_PlayerTypes[PlayerId, mptClassicAI]) then
   //          gGame.MapEditor.PlayerAdvancedAI[PlayerId] := False
   //        else
   //          gGame.MapEditor.PlayerClassicAI[PlayerId] := False;
  
positive.code: 
  procedure TKMMapEdMissionPlayers.UpdatePlayerTypes;
  var
    I, K: Integer;
    enabledCnt, checkedCnt: array [0..2] of Integer;
    hasAssets, isAllEnabled: Boolean;
  begin
    gGame.MapEditor.ValidatePlayerTypes;
  
    for K := Low(enabledCnt) to High(enabledCnt) do
    begin
      enabledCnt[K] := 0;
      checkedCnt[K] := 0;
    end;
  
    for I := 0 to gHands.Count - 1 do
    begin
      hasAssets := gHands[I].HasAssets;
      ChkBox_PlayerTypes[I, 0].Enabled := hasAssets;
      ChkBox_PlayerTypes[I, 1].Enabled := hasAssets and not (gGame.MapEditor.DefaultHuman = I);
      ChkBox_PlayerTypes[I, 2].Enabled := hasAssets;
      ChkBox_PlayerTypes[I, 3].Enabled := hasAssets;
  
      ChkBox_PlayerTypes[I, 0].Checked := hasAssets and (gGame.MapEditor.DefaultHuman = I);
      ChkBox_PlayerTypes[I, 1].Checked := hasAssets and gGame.MapEditor.PlayerHuman[I];
      ChkBox_PlayerTypes[I, 2].Checked := hasAssets and gGame.MapEditor.PlayerClassicAI[I];
      ChkBox_PlayerTypes[I, 3].Checked := hasAssets and gGame.MapEditor.PlayerAdvancedAI[I];
  
      for K := 0 to 2 do
      begin
        enabledCnt[K] := enabledCnt[K] + Byte(ChkBox_PlayerTypes[I, K + 1].Enabled);
        checkedCnt[K] := checkedCnt[K] + Byte(ChkBox_PlayerTypes[I, K + 1].Checked
                                          and ChkBox_PlayerTypes[I, K + 1].Enabled);
      end;
    end;
  
    isAllEnabled := False;
    for K := 0 to 2 do
    begin
      ChkBox_PlayerTypesAll[K].Enabled := enabledCnt[K] > 0;
      isAllEnabled := isAllEnabled or ChkBox_PlayerTypesAll[K].Enabled;
  
      //Uncheck if all are unchecked and disabled
      if not ChkBox_PlayerTypesAll[K].Enabled
        and (checkedCnt[K] = 0) then
        ChkBox_PlayerTypesAll[K].Uncheck;
  
      if enabledCnt[K] > 0 then
      begin
  
        if checkedCnt[K] = 0 then
          ChkBox_PlayerTypesAll[K].Uncheck //Uncheck if all is unchecked
        else
        if checkedCnt[K] >= enabledCnt[K] then
          ChkBox_PlayerTypesAll[K].Check //Check if all checked
        else
          ChkBox_PlayerTypesAll[K].SemiCheck; //SemiCheck in other cases
      end;
      if ChkBox_PlayerTypesAll[K].Checked then
        ChkBox_PlayerTypesAll[K].Hint := Format(gResTexts[TX_MAPED_PLAYER_TYPE_DISALLOW_ALL_HINT],
                                                [gResTexts[PLAYER_TYPE_TX[K]]])
      else
        ChkBox_PlayerTypesAll[K].Hint := Format(gResTexts[TX_MAPED_PLAYER_TYPE_ALLOW_ALL_HINT],
                                                [gResTexts[PLAYER_TYPE_TX[K]]]);
    end;
    Label_PlayerTypesAll.Enabled := isAllEnabled;
  end;
  
negative.code:   KM_Defaults, KM_Pics;
  
  type
    TKMMapEdPlayerType = (mptDefault, mptHuman, mptClassicAI, mptAdvancedAI);
  
    TKMMapEdMissionPlayers = class
    private
      fPlayerIdToDelete: TKMHandID;
  