anchor.diff:  
     TKMSettledUnit = class(TKMUnit)
     private
  -    procedure FreeAndNilHomeNTask(CleanTask: Boolean = False);
  +    procedure CleanHousePointer(aFreeAndNilTask: Boolean = False);
     protected
       function FindHome: Boolean;
       procedure ProceedHouseClosedForWorker;
  
positive.code: end;
  
  
  procedure TKMSettledUnit.FreeAndNilHomeNTask(CleanTask: Boolean = False);
  begin
    if CleanTask then
      FreeAndNil(fUnitTask);
    fHome.GetHasOwner := False;
    gHands.CleanUpHousePointer(fHome);
  
negative.code: // Manage house is closed for worker process
  procedure TKMSettledUnit.ProceedHouseClosedForWorker;
  var
    wGoingInsideHouse: Boolean;
    wThrowingRock: Boolean;
    wGoingForEating: Boolean;
    wWentOutShowHungry: Boolean;
    wWantToGoOutShowHungry: Boolean;
    wWalkingOutside: Boolean;
    wWorkingInsideHouse: Boolean;
    wWorkingOutsideHouse: Boolean;
    wHasNoTask: Boolean;
    wIsInsideHouse: Boolean;
  begin
    if (fHome <> nil)
      and not fHome.IsDestroyed
      and fHome.IsClosedForWorker
      and not(fUnitTask is TTaskDie)then
      begin
        wGoingInsideHouse := (fCurrentAction is TUnitActionGoInOut) and ((TUnitActionGoInOut(fCurrentAction)).Direction = gd_GoInside);
        // let recruits finish throwing animation
        wThrowingRock := (fUnitTask is TTaskThrowRock) and (fHome.GetState in [hst_Work]);
        // do not cancel eating task
        wGoingForEating := (fUnitTask is TTaskGoEat);
        // cancel GoOutShowHungry task if we outside of the house
        wWentOutShowHungry := (fUnitTask is TTaskGoOutShowHungry) and fVisible;
        // cancel GoOutShowHungry task and go out of the house, if we inside of it
        wWantToGoOutShowHungry := (fUnitTask is TTaskGoOutShowHungry) and not fVisible;
        // We are on the way to somewhere. AbandonWalk 'n cancel task.
        wWalkingOutside := (fCurrentAction is TUnitActionWalkTo) and not TUnitActionWalkTo(fCurrentAction).DoingExchange;
        // Assume worker is inside the house if not Visible.
        wIsInsideHouse := not Visible;
        // Working inside house
        wWorkingInsideHouse := (fUnitTask is TTaskMining) and wIsInsideHouse;
        // Working outside
        wWorkingOutsideHouse := (fUnitTask is TTaskMining) and not wIsInsideHouse;
        // Somehow no task
        wHasNoTask := (fUnitTask = nil);
        if (not wThrowingRock) then
          if (wGoingForEating) then
          begin
            // do not cancel eating task
            CleanHousePointer;
          end else
          begin
            if (wWalkingOutside) then begin
              AbandonWalk;
              CleanHousePointer(True);
            end else
            if (wWentOutShowHungry
              or (wWorkingOutsideHouse and not wGoingInsideHouse)
              or (wHasNoTask and not (wIsInsideHouse or wGoingInsideHouse))) then
            begin
              CleanHousePointer(True);
            end else
            if (wIsInsideHouse or wWantToGoOutShowHungry) then
            begin
              SetActionGoIn(ua_Walk, gd_GoOutside, fHome); //Walk outside the house
              // If working inside - first we need to set house state to Idle, then to Empty
              fHome.SetState(hst_Idle);
              fHome.SetState(hst_Empty);
              CleanHousePointer(True)
            end;
          end;
      end;
  