anchor.diff:    RequiredHouses[htButchers] := Min(RequiredHouses[htButchers], Ceil(Stats.GetHouseQty(htSwine)/3 - fCityStats.Houses[htButchers]));
     RequiredHouses[htTannery] := Min(RequiredHouses[htTannery], Ceil(Stats.GetHouseQty(htSwine)/2 - fCityStats.Houses[htTannery]));
     RequiredHouses[htArmorWorkshop] := Min(RequiredHouses[htArmorWorkshop], Stats.GetHouseTotal(htTannery)*2 - fCityStats.Houses[htArmorWorkshop]);
  -
  +  // Consideration of wood production
     RequiredHouses[htWeaponWorkshop] := RequiredHouses[htWeaponWorkshop] * Byte( (RequiredHouses[htTannery] > 0) OR (WEAP_WORKSHOP_DELAY < aTick) OR (aTick > (gGame.GameOptions.Peacetime-20) * 10 * 60) );
   
     if (gGame.GameTickCount < WINEYARD_DELAY) then
  
positive.code: var
    HT: TKMHouseType;
    Stats: TKMHandStats;
  begin
    Stats := gHands[fOwner].Stats;
    for HT := Low(RequiredHouses) to High(RequiredHouses) do
      RequiredHouses[HT] := 0;
  
    UpdateCityStats();
    UpdateBasicHouses(aTick, False);
    UpdateWareBalance();
  
    // Consideration of corn delay - only remove all required houses, builder will find the right one if they are not removed
  
negative.code:   // 1 Storehouse
    RequiredHouses[htStore] := 1 - fCityStats.Houses[htStore];
    // 1 Barracks (build only when we have weapons and (from X tick or Y ticks before peace end -> avoid to build barracks in 1 minute when is still peace and we have predefined weapons in storehouse))
    RequiredHouses[htBarracks] := Byte(aInitialization OR ((gHands[fOwner].Stats.GetWareBalance(wt_Warfare) > 0) AND ((aTick > BARRACKS_PEACE_DELAY * 600) OR (aTick > (gGame.GameOptions.Peacetime - BARRACKS_BEFORE_PEACE_END) * 600)))) - fCityStats.Houses[htBarracks];
    // Schools (at least 1 + WarriorsPerMinute criterium)
    RequiredHouses[htSchool] := Max( 0,  Max(1, Byte(  (fCityStats.Houses[htBarracks] > 0) OR aInitialization ) * (Ceil(fMaxSoldiersInMin / SCHOOL_PRODUCTION))) - fCityStats.Houses[htSchool]  );
    // Inn (at least 1 after INN_TIME_LIMIT + CitizensCnt criterium)
    RequiredHouses[htInn] := Max(0, Ceil(  Byte( (aTick > INN_TIME_LIMIT) OR aInitialization ) * fCityStats.CitizensCnt / 80  ) - fCityStats.Houses[htInn]);
    // Marketplace - 1. after FIRST_MARKETPLACE; 2. after SECOND_MARKETPLACE
  