public static void DoExtraAnimalIcons(Transferable trad, Rect rect, ref float curX)
        {
            Pawn pawn = trad.AnyThing as Pawn;

            if (pawn != null && pawn.RaceProps.Animal)
            {
                if (pawn.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond, null) != null)
                {
                    Rect rect2 = new Rect(curX - TransferableUIUtility.BondIconWidth, (rect.height - TransferableUIUtility.BondIconWidth) / 2f, TransferableUIUtility.BondIconWidth, TransferableUIUtility.BondIconWidth);
                    curX -= TransferableUIUtility.BondIconWidth;
                    GUI.DrawTexture(rect2, TransferableUIUtility.BondIcon);
                    string iconTooltipText = TrainableUtility.GetIconTooltipText(pawn);
                    if (!iconTooltipText.NullOrEmpty())
                    {
                        TooltipHandler.TipRegion(rect2, iconTooltipText);
                    }
                }
                if (pawn.health.hediffSet.HasHediff(HediffDefOf.Pregnant, true))
                {
                    Rect rect3 = new Rect(curX - TransferableUIUtility.PregnancyIconWidth, (rect.height - TransferableUIUtility.PregnancyIconWidth) / 2f, TransferableUIUtility.PregnancyIconWidth, TransferableUIUtility.PregnancyIconWidth);
                    curX -= TransferableUIUtility.PregnancyIconWidth;
                    TooltipHandler.TipRegion(rect3, PawnColumnWorker_Pregnant.GetTooltipText(pawn));
                    GUI.DrawTexture(rect3, TransferableUIUtility.PregnantIcon);
                }
            }
        }
        public static void DoCountAdjustInterface(Rect rect, Transferable trad, int index, int min, int max, bool flash = false, List <TransferableCountToTransferStoppingPoint> extraStoppingPoints = null, bool readOnly = false)
        {
            TransferableUIUtility.stoppingPoints.Clear();
            if (extraStoppingPoints != null)
            {
                TransferableUIUtility.stoppingPoints.AddRange(extraStoppingPoints);
            }
            for (int i = TransferableUIUtility.stoppingPoints.Count - 1; i >= 0; i--)
            {
                if (TransferableUIUtility.stoppingPoints[i].threshold != 0 && (TransferableUIUtility.stoppingPoints[i].threshold <= min || TransferableUIUtility.stoppingPoints[i].threshold >= max))
                {
                    TransferableUIUtility.stoppingPoints.RemoveAt(i);
                }
            }
            bool flag = false;

            for (int j = 0; j < TransferableUIUtility.stoppingPoints.Count; j++)
            {
                if (TransferableUIUtility.stoppingPoints[j].threshold == 0)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                TransferableUIUtility.stoppingPoints.Add(new TransferableCountToTransferStoppingPoint(0, "0", "0"));
            }
            TransferableUIUtility.DoCountAdjustInterfaceInternal(rect, trad, index, min, max, flash, readOnly);
        }
        public static void DoCountAdjustInterface(Rect rect, Transferable trad, int index, int min, int max, bool flash = false, List <TransferableCountToTransferStoppingPoint> extraStoppingPoints = null, bool readOnly = false)
        {
            stoppingPoints.Clear();
            if (extraStoppingPoints != null)
            {
                stoppingPoints.AddRange(extraStoppingPoints);
            }
            for (int num = stoppingPoints.Count - 1; num >= 0; num--)
            {
                if (stoppingPoints[num].threshold != 0 && (stoppingPoints[num].threshold <= min || stoppingPoints[num].threshold >= max))
                {
                    stoppingPoints.RemoveAt(num);
                }
            }
            bool flag = false;

            for (int i = 0; i < stoppingPoints.Count; i++)
            {
                if (stoppingPoints[i].threshold == 0)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                stoppingPoints.Add(new TransferableCountToTransferStoppingPoint(0, "0", "0"));
            }
            DoCountAdjustInterfaceInternal(rect, trad, index, min, max, flash, readOnly);
        }
        public static void DoExtraAnimalIcons(Transferable trad, Rect rect, ref float curX)
        {
            Pawn pawn = trad.AnyThing as Pawn;

            if (pawn == null || !pawn.RaceProps.Animal)
            {
                return;
            }
            if (pawn.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) != null)
            {
                Rect rect2 = new Rect(curX - BondIconWidth, (rect.height - BondIconWidth) / 2f, BondIconWidth, BondIconWidth);
                curX -= BondIconWidth;
                GUI.DrawTexture(rect2, BondIcon);
                if (Mouse.IsOver(rect2))
                {
                    string iconTooltipText = TrainableUtility.GetIconTooltipText(pawn);
                    if (!iconTooltipText.NullOrEmpty())
                    {
                        TooltipHandler.TipRegion(rect2, iconTooltipText);
                    }
                }
            }
            if (pawn.health.hediffSet.HasHediff(HediffDefOf.Pregnant, mustBeVisible: true))
            {
                Rect rect3 = new Rect(curX - PregnancyIconWidth, (rect.height - PregnancyIconWidth) / 2f, PregnancyIconWidth, PregnancyIconWidth);
                curX -= PregnancyIconWidth;
                if (Mouse.IsOver(rect3))
                {
                    TooltipHandler.TipRegion(rect3, PawnColumnWorker_Pregnant.GetTooltipText(pawn));
                }
                GUI.DrawTexture(rect3, PregnantIcon);
            }
        }
 public static void DrawTransferableInfo(Transferable trad, Rect idRect, Color labelColor)
 {
     if (trad.HasAnyThing)
     {
         if (Mouse.IsOver(idRect))
         {
             Widgets.DrawHighlight(idRect);
         }
         Rect rect = new Rect(0f, 0f, 27f, 27f);
         Widgets.ThingIcon(rect, trad.AnyThing, 1f);
         Widgets.InfoCardButton(40f, 0f, trad.AnyThing);
         Text.Anchor = TextAnchor.MiddleLeft;
         Rect rect2 = new Rect(80f, 0f, (float)(idRect.width - 80.0), idRect.height);
         Text.WordWrap = false;
         GUI.color     = labelColor;
         Widgets.Label(rect2, trad.Label);
         GUI.color     = Color.white;
         Text.WordWrap = true;
         TooltipHandler.TipRegion(idRect, new TipSignal(delegate
         {
             if (!trad.HasAnyThing)
             {
                 return(string.Empty);
             }
             string text           = trad.Label;
             string tipDescription = trad.TipDescription;
             if (!tipDescription.NullOrEmpty())
             {
                 text = text + ": " + tipDescription;
             }
             return(text);
         }, trad.GetHashCode()));
     }
 }
 public static float DefaultListOrderPriority(Transferable transferable)
 {
     if (!transferable.HasAnyThing)
     {
         return(0f);
     }
     return(TransferableUIUtility.DefaultListOrderPriority(transferable.ThingDef));
 }
Example #7
0
        private int GetValueFor(Transferable t)
        {
            QualityCategory result;

            if (!t.AnyThing.TryGetQuality(out result))
            {
                return(-1);
            }
            return((int)result);
        }
Example #8
0
 private bool AddOneIfMassAllows(Transferable transferable)
 {
     if (transferable.CanAdjustBy(1).Accepted&& MassUsage + transferable.ThingDef.BaseMass < MassCapacity)
     {
         transferable.AdjustBy(1);
         massUsageDirty = true;
         return(true);
     }
     return(false);
 }
Example #9
0
        public static float DefaultListOrderPriority(Transferable transferable)
        {
            float result;

            if (!transferable.HasAnyThing)
            {
                result = 0f;
            }
            else
            {
                result = TransferableUIUtility.DefaultListOrderPriority(transferable.ThingDef);
            }
            return(result);
        }
        private float GetValueFor(Transferable t)
        {
            Thing anyThing = t.AnyThing;
            Pawn  pawn     = anyThing as Pawn;

            if (pawn != null)
            {
                return(pawn.health.summaryHealth.SummaryHealthPercent);
            }
            if (!anyThing.def.useHitPoints)
            {
                return(1f);
            }
            return((float)anyThing.HitPoints / (float)anyThing.MaxHitPoints);
        }
        private int GetValueFor(Transferable t)
        {
            QualityCategory qualityCategory;
            int             result;

            if (!t.AnyThing.TryGetQuality(out qualityCategory))
            {
                result = -1;
            }
            else
            {
                result = (int)qualityCategory;
            }
            return(result);
        }
        public static void DoCountAdjustInterface(Rect rect, Transferable trad, int index, int min, int max, bool flash = false, List <TransferableCountToTransferStoppingPoint> extraStoppingPoints = null)
        {
            TransferableUIUtility.stoppingPoints.Clear();
            if (extraStoppingPoints != null)
            {
                TransferableUIUtility.stoppingPoints.AddRange(extraStoppingPoints);
            }
            for (int i = TransferableUIUtility.stoppingPoints.Count - 1; i >= 0; i--)
            {
                TransferableCountToTransferStoppingPoint transferableCountToTransferStoppingPoint = TransferableUIUtility.stoppingPoints[i];
                if (transferableCountToTransferStoppingPoint.threshold != 0)
                {
                    TransferableCountToTransferStoppingPoint transferableCountToTransferStoppingPoint2 = TransferableUIUtility.stoppingPoints[i];
                    if (transferableCountToTransferStoppingPoint2.threshold > min)
                    {
                        TransferableCountToTransferStoppingPoint transferableCountToTransferStoppingPoint3 = TransferableUIUtility.stoppingPoints[i];
                        if (transferableCountToTransferStoppingPoint3.threshold >= max)
                        {
                            goto IL_007a;
                        }
                        continue;
                    }
                    goto IL_007a;
                }
                continue;
IL_007a:
                TransferableUIUtility.stoppingPoints.RemoveAt(i);
            }
            bool flag = false;

            for (int j = 0; j < TransferableUIUtility.stoppingPoints.Count; j++)
            {
                TransferableCountToTransferStoppingPoint transferableCountToTransferStoppingPoint4 = TransferableUIUtility.stoppingPoints[j];
                if (transferableCountToTransferStoppingPoint4.threshold == 0)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                TransferableUIUtility.stoppingPoints.Add(new TransferableCountToTransferStoppingPoint(0, "0", "0"));
            }
            TransferableUIUtility.DoCountAdjustInterfaceInternal(rect, trad, index, min, max, flash);
        }
        private float GetValueFor(Transferable t)
        {
            Thing anyThing = t.AnyThing;
            Pawn  pawn     = anyThing as Pawn;
            float result;

            if (pawn != null)
            {
                result = pawn.health.summaryHealth.SummaryHealthPercent;
            }
            else if (!anyThing.def.useHitPoints)
            {
                result = 1f;
            }
            else
            {
                result = (float)anyThing.HitPoints / (float)anyThing.MaxHitPoints;
            }
            return(result);
        }
Example #14
0
        private Transferable BestMedicineItemFor(Pawn pawn, IEnumerable <TransferableOneWay> medicine)
        {
            Transferable transferable = null;
            float        num          = 0f;

            foreach (TransferableOneWay item in medicine)
            {
                Thing anyThing = item.AnyThing;
                if (item.CanAdjustBy(1).Accepted&& pawn.playerSettings.medCare.AllowsMedicine(anyThing.def))
                {
                    float statValue = anyThing.GetStatValue(StatDefOf.MedicalPotency);
                    if (transferable == null || statValue > num)
                    {
                        transferable = item;
                        num          = statValue;
                    }
                }
            }
            return(transferable);
        }
Example #15
0
        private Transferable BestFoodItemFor(Pawn pawn, IEnumerable <TransferableOneWay> food, List <Pair <int, int> > ticksToArrive)
        {
            Transferable result = null;
            float        num    = 0f;

            if (!pawn.RaceProps.EatsFood)
            {
                return(result);
            }
            foreach (TransferableOneWay item in food)
            {
                if (item.CanAdjustBy(1).Accepted)
                {
                    float foodScore = GetFoodScore(pawn, item.AnyThing, ticksToArrive);
                    if (foodScore > num)
                    {
                        result = item;
                        num    = foodScore;
                    }
                }
            }
            return(result);
        }
Example #16
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(TransferableComparer_Category.Compare(lhs.ThingDef, rhs.ThingDef));
 }
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(this.GetValueFor(lhs).CompareTo(this.GetValueFor(rhs)));
 }
Example #18
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(Compare(lhs.ThingDef, rhs.ThingDef));
 }
Example #19
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(lhs.AnyThing.MarketValue.CompareTo(rhs.AnyThing.MarketValue));
 }
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(lhs.AnyThing.GetStatValue(StatDefOf.Mass, true).CompareTo(rhs.AnyThing.GetStatValue(StatDefOf.Mass, true)));
 }
        private static void DoCountAdjustInterfaceInternal(Rect rect, Transferable trad, int index, int min, int max, bool flash, bool readOnly)
        {
            rect = rect.Rounded();
            Rect rect2 = new Rect(rect.center.x - 45f, rect.center.y - 12.5f, 90f, 25f).Rounded();

            if (flash)
            {
                GUI.DrawTexture(rect2, TransferableUIUtility.FlashTex);
            }
            TransferableOneWay transferableOneWay = trad as TransferableOneWay;
            bool flag = transferableOneWay != null && transferableOneWay.HasAnyThing && transferableOneWay.AnyThing is Pawn && transferableOneWay.MaxCount == 1;

            if (!trad.Interactive || readOnly)
            {
                if (flag)
                {
                    bool flag2 = trad.CountToTransfer != 0;
                    Widgets.Checkbox(rect2.position, ref flag2, 24f, true, false, null, null);
                }
                else
                {
                    GUI.color   = ((trad.CountToTransfer != 0) ? Color.white : TransferableUIUtility.ZeroCountColor);
                    Text.Anchor = TextAnchor.MiddleCenter;
                    Widgets.Label(rect2, trad.CountToTransfer.ToStringCached());
                }
            }
            else if (flag)
            {
                bool flag3 = trad.CountToTransfer != 0;
                bool flag4 = flag3;
                Widgets.Checkbox(rect2.position, ref flag4, 24f, false, true, null, null);
                if (flag4 != flag3)
                {
                    if (flag4)
                    {
                        trad.AdjustTo(trad.GetMaximumToTransfer());
                    }
                    else
                    {
                        trad.AdjustTo(trad.GetMinimumToTransfer());
                    }
                }
            }
            else
            {
                Rect rect3 = rect2.ContractedBy(2f);
                rect3.xMax -= 15f;
                rect3.xMin += 16f;
                int    countToTransfer = trad.CountToTransfer;
                string editBuffer      = trad.EditBuffer;
                Widgets.TextFieldNumeric <int>(rect3, ref countToTransfer, ref editBuffer, (float)min, (float)max);
                trad.AdjustTo(countToTransfer);
                trad.EditBuffer = editBuffer;
            }
            Text.Anchor = TextAnchor.UpperLeft;
            GUI.color   = Color.white;
            if (trad.Interactive && !flag)
            {
                TransferablePositiveCountDirection positiveCountDirection = trad.PositiveCountDirection;
                int  num   = (positiveCountDirection != TransferablePositiveCountDirection.Source) ? -1 : 1;
                int  num2  = GenUI.CurrentAdjustmentMultiplier();
                bool flag5 = trad.GetRange() == 1;
                if (trad.CanAdjustBy(num * num2).Accepted)
                {
                    Rect rect4 = new Rect(rect2.x - 30f, rect.y, 30f, rect.height);
                    if (flag5)
                    {
                        rect4.x     -= rect4.width;
                        rect4.width += rect4.width;
                    }
                    if (Widgets.ButtonText(rect4, "<", true, false, true))
                    {
                        trad.AdjustBy(num * num2);
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                    }
                    if (!flag5)
                    {
                        string label = "<<";
                        int?   num3  = null;
                        int    num4  = 0;
                        for (int i = 0; i < TransferableUIUtility.stoppingPoints.Count; i++)
                        {
                            TransferableCountToTransferStoppingPoint transferableCountToTransferStoppingPoint = TransferableUIUtility.stoppingPoints[i];
                            if (positiveCountDirection == TransferablePositiveCountDirection.Source)
                            {
                                if (trad.CountToTransfer < transferableCountToTransferStoppingPoint.threshold && (transferableCountToTransferStoppingPoint.threshold < num4 || !num3.HasValue))
                                {
                                    label = transferableCountToTransferStoppingPoint.leftLabel;
                                    num3  = new int?(transferableCountToTransferStoppingPoint.threshold);
                                }
                            }
                            else if (trad.CountToTransfer > transferableCountToTransferStoppingPoint.threshold && (transferableCountToTransferStoppingPoint.threshold > num4 || !num3.HasValue))
                            {
                                label = transferableCountToTransferStoppingPoint.leftLabel;
                                num3  = new int?(transferableCountToTransferStoppingPoint.threshold);
                            }
                        }
                        rect4.x -= rect4.width;
                        if (Widgets.ButtonText(rect4, label, true, false, true))
                        {
                            if (num3.HasValue)
                            {
                                trad.AdjustTo(num3.Value);
                            }
                            else if (num == 1)
                            {
                                trad.AdjustTo(trad.GetMaximumToTransfer());
                            }
                            else
                            {
                                trad.AdjustTo(trad.GetMinimumToTransfer());
                            }
                            SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                        }
                    }
                }
                if (trad.CanAdjustBy(-num * num2).Accepted)
                {
                    Rect rect5 = new Rect(rect2.xMax, rect.y, 30f, rect.height);
                    if (flag5)
                    {
                        rect5.width += rect5.width;
                    }
                    if (Widgets.ButtonText(rect5, ">", true, false, true))
                    {
                        trad.AdjustBy(-num * num2);
                        SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                    }
                    if (!flag5)
                    {
                        string label2 = ">>";
                        int?   num5   = null;
                        int    num6   = 0;
                        for (int j = 0; j < TransferableUIUtility.stoppingPoints.Count; j++)
                        {
                            TransferableCountToTransferStoppingPoint transferableCountToTransferStoppingPoint2 = TransferableUIUtility.stoppingPoints[j];
                            if (positiveCountDirection == TransferablePositiveCountDirection.Destination)
                            {
                                if (trad.CountToTransfer < transferableCountToTransferStoppingPoint2.threshold && (transferableCountToTransferStoppingPoint2.threshold < num6 || !num5.HasValue))
                                {
                                    label2 = transferableCountToTransferStoppingPoint2.rightLabel;
                                    num5   = new int?(transferableCountToTransferStoppingPoint2.threshold);
                                }
                            }
                            else if (trad.CountToTransfer > transferableCountToTransferStoppingPoint2.threshold && (transferableCountToTransferStoppingPoint2.threshold > num6 || !num5.HasValue))
                            {
                                label2 = transferableCountToTransferStoppingPoint2.rightLabel;
                                num5   = new int?(transferableCountToTransferStoppingPoint2.threshold);
                            }
                        }
                        rect5.x += rect5.width;
                        if (Widgets.ButtonText(rect5, label2, true, false, true))
                        {
                            if (num5.HasValue)
                            {
                                trad.AdjustTo(num5.Value);
                            }
                            else if (num == 1)
                            {
                                trad.AdjustTo(trad.GetMinimumToTransfer());
                            }
                            else
                            {
                                trad.AdjustTo(trad.GetMaximumToTransfer());
                            }
                            SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                        }
                    }
                }
            }
            if (trad.CountToTransfer != 0)
            {
                Rect position = new Rect(rect2.x + rect2.width / 2f - (float)(TransferableUIUtility.TradeArrow.width / 2), rect2.y + rect2.height / 2f - (float)(TransferableUIUtility.TradeArrow.height / 2), (float)TransferableUIUtility.TradeArrow.width, (float)TransferableUIUtility.TradeArrow.height);
                TransferablePositiveCountDirection positiveCountDirection2 = trad.PositiveCountDirection;
                if ((positiveCountDirection2 == TransferablePositiveCountDirection.Source && trad.CountToTransfer > 0) || (positiveCountDirection2 == TransferablePositiveCountDirection.Destination && trad.CountToTransfer < 0))
                {
                    position.x     += position.width;
                    position.width *= -1f;
                }
                GUI.DrawTexture(position, TransferableUIUtility.TradeArrow);
            }
        }
Example #22
0
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(0);
 }
Example #23
0
        private void SelectApproximateBestFoodAndMedicine()
        {
            IEnumerable <TransferableOneWay> enumerable  = transferables.Where((TransferableOneWay x) => x.ThingDef.category != ThingCategory.Pawn && !x.ThingDef.thingCategories.NullOrEmpty() && x.ThingDef.thingCategories.Contains(ThingCategoryDefOf.Medicine));
            IEnumerable <TransferableOneWay> enumerable2 = transferables.Where((TransferableOneWay x) => x.ThingDef.IsIngestible && !x.ThingDef.IsDrug && !x.ThingDef.IsCorpse);

            tmpBeds.Clear();
            for (int i = 0; i < transferables.Count; i++)
            {
                for (int j = 0; j < transferables[i].things.Count; j++)
                {
                    Thing thing = transferables[i].things[j];
                    for (int k = 0; k < thing.stackCount; k++)
                    {
                        Building_Bed building_Bed;
                        if ((building_Bed = thing.GetInnerIfMinified() as Building_Bed) != null && building_Bed.def.building.bed_caravansCanUse)
                        {
                            for (int l = 0; l < building_Bed.SleepingSlotsCount; l++)
                            {
                                tmpBeds.Add(transferables[i]);
                            }
                        }
                    }
                }
            }
            tmpBeds.SortByDescending((TransferableOneWay x) => x.AnyThing.GetStatValue(StatDefOf.BedRestEffectiveness));
            foreach (TransferableOneWay item in enumerable)
            {
                item.AdjustTo(0);
            }
            foreach (TransferableOneWay item2 in enumerable2)
            {
                item2.AdjustTo(0);
            }
            foreach (TransferableOneWay tmpBed in tmpBeds)
            {
                tmpBed.AdjustTo(0);
            }
            List <Pawn> pawnsFromTransferables = TransferableUtility.GetPawnsFromTransferables(transferables);

            if (!pawnsFromTransferables.Any())
            {
                return;
            }
            foreach (Pawn item3 in pawnsFromTransferables)
            {
                TransferableOneWay transferableOneWay = BestBedFor(item3);
                if (transferableOneWay != null)
                {
                    tmpBeds.Remove(transferableOneWay);
                    if (transferableOneWay.CanAdjustBy(1).Accepted)
                    {
                        AddOneIfMassAllows(transferableOneWay);
                    }
                }
                if (item3.AnimalOrWildMan() || item3.guest.IsPrisoner)
                {
                    continue;
                }
                for (int m = 0; m < 2; m++)
                {
                    Transferable transferable = BestMedicineItemFor(item3, enumerable);
                    if (transferable != null)
                    {
                        AddOneIfMassAllows(transferable);
                    }
                }
            }
            if (destinationTile == -1 || !DaysWorthOfFoodCalculator.AnyFoodEatingPawn(pawnsFromTransferables) || !enumerable2.Any())
            {
                return;
            }
            try
            {
                using WorldPath path = Find.WorldPathFinder.FindPath(CurrentTile, destinationTile, null);
                int ticksPerMove = CaravanTicksPerMoveUtility.GetTicksPerMove(new CaravanTicksPerMoveUtility.CaravanInfo(this));
                CaravanArrivalTimeEstimator.EstimatedTicksToArriveToEvery(CurrentTile, destinationTile, path, 0f, ticksPerMove, Find.TickManager.TicksAbs, tmpTicksToArrive);
                float num = (float)tmpTicksToArrive.Last().Second / 60000f + 4f;
                float num2;
                bool  flag;
                do
                {
                    num2 = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(transferables, CurrentTile, IgnoreInventoryMode, Faction.OfPlayer, path, 0f, ticksPerMove);
                    if (num2 >= num)
                    {
                        break;
                    }
                    flag = false;
                    foreach (Pawn item4 in pawnsFromTransferables)
                    {
                        Transferable transferable2 = BestFoodItemFor(item4, enumerable2, tmpTicksToArrive);
                        if (transferable2 != null && AddOneIfMassAllows(transferable2))
                        {
                            flag = true;
                        }
                    }
                }while (flag && num2 < num && MassUsage < MassCapacity);
            }
            finally
            {
                tmpTicksToArrive.Clear();
                daysWorthOfFoodDirty = true;
                massUsageDirty       = true;
            }
        }
 public override int Compare(Transferable lhs, Transferable rhs)
 {
     return(lhs.Label.CompareTo(rhs.Label));
 }