anchor.diff:  end;
   
   
  -function TMissionParser.AlignPlayersCount:integer;
  -var ActivePlayer:array of boolean; i,k:integer; FirstEmpty:integer;
  -begin
  -  //Scan active players
  -  SetLength(ActivePlayer, fPlayers.Count);
  -
  -  Result := 0;
  -  for i:=0 to fPlayers.Count-1 do
  -  begin
  -    //We can fill the array right before use, cos FirstEmpty scans only preceding entries
  -    ActivePlayer[i] := (fPlayers.Player[i].Stats.GetHouseQty(ht_Any) +
  -                        fPlayers.Player[i].Stats.GetUnitQty(ut_Any)) <> 0;
  -
  -    if ActivePlayer[i] then begin
  -      inc(Result);
  -      FirstEmpty := -1; //Scan previous entries to find first empty spot
  -      for k:=i-1 downto 0 do //Check only previous players
  -      if not ActivePlayer[k] then
  -        FirstEmpty := k;
  -
  -      if FirstEmpty <> -1 then begin
  -        fPlayers.MovePlayer(i, FirstEmpty); //Move player From-To
  -        ActivePlayer[i] := true; //From becomes free
  -        ActivePlayer[FirstEmpty] := false; //To becomes used
  -      end;
  -    end;
  -  end;
  -end;
  -
  -
  +//Write out a KaM format mission file to aFileName
   function TMissionParser.SaveDATFile(const aFileName:string):boolean;
   const
     COMMANDLAYERS = 4;
  
positive.code: procedure TMissionParser.UnloadMission;
  begin
    FreeAndNil(fPlayers);
    CurrentPlayerIndex := 0;
    fGame.MissionMode := mm_Normal; //by Default
  end;
  
  
negative.code:   k, l: integer;
    CommandType: TKMCommandType;
  begin
    Result := ''; //Set it right from the start
    UnloadMission; //Call function which will reset fPlayers and other stuff
  
    fOpenedMissionName := aFileName; //Used in MAP loading later on
  
    //Read the mission file into FileText
    FileText := ReadMissionFile(aFileName);
  