anchor.diff:  
   function TKMHouseMarket.RatioFrom: Byte;
   var
  -  CostFrom, CostTo: Single;
  +  costFrom, costTo: Single;
   begin
     if (fResFrom <> wtNone) and (fResTo <> wtNone) then
     begin
       //When trading target ware is priced higher
  -    CostFrom := gRes.Wares[fResFrom].MarketPrice;
  -    CostTo := gRes.Wares[fResTo].MarketPrice * MARKET_TRADEOFF_FACTOR;
  -    Result := Round(CostTo / Min(CostFrom, CostTo));
  +    costFrom := gRes.Wares[fResFrom].MarketPrice;
  +    costTo := gRes.Wares[fResTo].MarketPrice * MARKET_TRADEOFF_FACTOR;
  +    Result := Round(costTo / Min(costFrom, costTo));
     end else
       Result := 1;
   end;
   
   
   function TKMHouseMarket.RatioTo: Byte;
  -var CostFrom, CostTo: Single;
  +var
  +  costFrom, costTo: Single;
   begin
     if (fResFrom <> wtNone) and (fResTo <> wtNone) then
     begin
       //When trading target ware is priced higher
  -    CostFrom := gRes.Wares[fResFrom].MarketPrice;
  -    CostTo := gRes.Wares[fResTo].MarketPrice * MARKET_TRADEOFF_FACTOR;
  -    Result := Round(CostFrom / Min(CostFrom, CostTo));
  +    costFrom := gRes.Wares[fResFrom].MarketPrice;
  +    costTo := gRes.Wares[fResTo].MarketPrice * MARKET_TRADEOFF_FACTOR;
  +    Result := Round(costFrom / Min(costFrom, costTo));
     end else
       Result := 1;
   end;
  
positive.code: 
  procedure TKMHouseMarket.SetResInCnt(aWareType: TKMWareType; aValue: Word);
  var
    CntChange: Integer;
  begin
    Assert(aWareType in [WARE_MIN..WARE_MAX]);
  
    CntChange := aValue - fMarketResIn[aWareType];
  
    fMarketResIn[aWareType] := aValue;
  
    if CntChange <> 0 then
      gScriptEvents.ProcHouseWareCountChanged(Self, aWareType, ResToTrade[aWareType], CntChange);
  end;
  
  
  procedure TKMHouseMarket.SetResOutCnt(aWareType: TKMWareType; aValue: Word);
  var
    CntChange: Integer;
  begin
    Assert(aWareType in [WARE_MIN..WARE_MAX]);
  
    CntChange := aValue - fMarketResOut[aWareType];
  
    fMarketResOut[aWareType] := aValue;
  
    if CntChange <> 0 then
      gScriptEvents.ProcHouseWareCountChanged(Self, aWareType, ResToTrade[aWareType], CntChange);
  end;
  
  
  
negative.code:   if TradeInProgress and (ResToTrade[fResFrom] >= RatioFrom) then
    begin
      //How much can we trade
      tradeCount := Min((ResToTrade[fResFrom] div RatioFrom), fTradeAmount);
  
      ResToTrade[fResFrom] := ResToTrade[fResFrom] - tradeCount * RatioFrom;
      gHands[fOwner].Stats.WareConsumed(fResFrom, tradeCount * RatioFrom);
      Dec(fTradeAmount, tradeCount);
      SetResOutCnt(fResTo, fMarketResOut[fResTo] + tradeCount * RatioTo);
      gHands[fOwner].Stats.WareProduced(fResTo, tradeCount * RatioTo);
      gHands[fOwner].Deliveries.Queue.AddOffer(Self, fResTo, tradeCount * RatioTo);
  
      gScriptEvents.ProcMarketTrade(Self, fResFrom, fResTo);
      gScriptEvents.ProcWareProduced(Self, fResTo, tradeCount * RatioTo);
      gSoundPlayer.Play(sfxnTrade, fPosition);
    end;
  end;
  