public static float ApproxDaysWorthOfFoodLeftAfterTradeableTransfer(List <Thing> allCurrentThings, List <Tradeable> tradeables, bool assumeCanEatLocalPlants, IgnorePawnsInventoryMode ignoreInventory)
        {
            TransferableUtility.SimulateTradeableTransfer(allCurrentThings, tradeables, DaysWorthOfFoodCalculator.tmpThingStackParts);
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            for (int num = DaysWorthOfFoodCalculator.tmpThingStackParts.Count - 1; num >= 0; num--)
            {
                Pawn pawn = DaysWorthOfFoodCalculator.tmpThingStackParts[num].Thing as Pawn;
                if (pawn != null)
                {
                    if (pawn.RaceProps.EatsFood && (!assumeCanEatLocalPlants || !VirtualPlantsUtility.CanEverEatVirtualPlants(pawn)))
                    {
                        DaysWorthOfFoodCalculator.tmpPawns.Add(pawn);
                    }
                }
                else
                {
                    DaysWorthOfFoodCalculator.tmpThingCounts.Add(new ThingCount(DaysWorthOfFoodCalculator.tmpThingStackParts[num].Thing.def, DaysWorthOfFoodCalculator.tmpThingStackParts[num].Count));
                }
            }
            DaysWorthOfFoodCalculator.tmpThingStackParts.Clear();
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(DaysWorthOfFoodCalculator.tmpPawns, DaysWorthOfFoodCalculator.tmpThingCounts, assumeCanEatLocalPlants, ignoreInventory);

            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            return(result);
        }
        public static float ApproxDaysWorthOfFoodLeftAfterTradeableTransfer(List <Thing> allCurrentThings, List <Tradeable> tradeables, int tile, IgnorePawnsInventoryMode ignoreInventory, Faction faction)
        {
            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            TransferableUtility.SimulateTradeableTransfer(allCurrentThings, tradeables, DaysWorthOfFoodCalculator.tmpThingCounts);
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            for (int i = DaysWorthOfFoodCalculator.tmpThingCounts.Count - 1; i >= 0; i--)
            {
                if (DaysWorthOfFoodCalculator.tmpThingCounts[i].Count > 0)
                {
                    Pawn pawn = DaysWorthOfFoodCalculator.tmpThingCounts[i].Thing as Pawn;
                    if (pawn != null)
                    {
                        if (pawn.RaceProps.EatsFood)
                        {
                            DaysWorthOfFoodCalculator.tmpPawns.Add(pawn);
                        }
                    }
                    else
                    {
                        DaysWorthOfFoodCalculator.tmpThingDefCounts.Add(new ThingDefCount(DaysWorthOfFoodCalculator.tmpThingCounts[i].Thing.def, DaysWorthOfFoodCalculator.tmpThingCounts[i].Count));
                    }
                }
            }
            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(DaysWorthOfFoodCalculator.tmpPawns, DaysWorthOfFoodCalculator.tmpThingDefCounts, tile, ignoreInventory, faction, null, 0f, 3300, true);

            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            return(result);
        }
        public static float ApproxDaysWorthOfFoodLeftAfterTransfer(List <TransferableOneWay> transferables, bool assumeCanEatLocalPlants, IgnorePawnsInventoryMode ignoreInventory)
        {
            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            for (int i = 0; i < transferables.Count; i++)
            {
                TransferableOneWay transferableOneWay = transferables[i];
                if (transferableOneWay.HasAnyThing)
                {
                    if (transferableOneWay.AnyThing is Pawn)
                    {
                        for (int num = transferableOneWay.things.Count - 1; num >= transferableOneWay.CountToTransfer; num--)
                        {
                            Pawn pawn = (Pawn)transferableOneWay.things[num];
                            if (pawn.RaceProps.EatsFood && (!assumeCanEatLocalPlants || !VirtualPlantsUtility.CanEverEatVirtualPlants(pawn)))
                            {
                                DaysWorthOfFoodCalculator.tmpPawns.Add(pawn);
                            }
                        }
                    }
                    else
                    {
                        DaysWorthOfFoodCalculator.tmpThingCounts.Add(new ThingCount(transferableOneWay.ThingDef, transferableOneWay.MaxCount - transferableOneWay.CountToTransfer));
                    }
                }
            }
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(DaysWorthOfFoodCalculator.tmpPawns, DaysWorthOfFoodCalculator.tmpThingCounts, assumeCanEatLocalPlants, ignoreInventory);

            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            return(result);
        }
        public static float ApproxDaysWorthOfFoodLeftAfterTransfer(List <TransferableOneWay> transferables, int tile, IgnorePawnsInventoryMode ignoreInventory, Faction faction, WorldPath path = null, float nextTileCostLeft = 0f, int caravanTicksPerMove = 3300)
        {
            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            for (int i = 0; i < transferables.Count; i++)
            {
                TransferableOneWay transferableOneWay = transferables[i];
                if (transferableOneWay.HasAnyThing)
                {
                    if (transferableOneWay.AnyThing is Pawn)
                    {
                        for (int j = transferableOneWay.things.Count - 1; j >= transferableOneWay.CountToTransfer; j--)
                        {
                            Pawn pawn = (Pawn)transferableOneWay.things[j];
                            if (pawn.RaceProps.EatsFood)
                            {
                                DaysWorthOfFoodCalculator.tmpPawns.Add(pawn);
                            }
                        }
                    }
                    else
                    {
                        DaysWorthOfFoodCalculator.tmpThingDefCounts.Add(new ThingDefCount(transferableOneWay.ThingDef, transferableOneWay.MaxCount - transferableOneWay.CountToTransfer));
                    }
                }
            }
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(DaysWorthOfFoodCalculator.tmpPawns, DaysWorthOfFoodCalculator.tmpThingDefCounts, tile, ignoreInventory, faction, path, nextTileCostLeft, caravanTicksPerMove, true);

            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            return(result);
        }
        public static float ApproxDaysWorthOfFood(List <Pawn> pawns, List <ThingStackPart> potentiallyFood, bool assumeCanEatLocalPlants, IgnorePawnsInventoryMode ignoreInventory)
        {
            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            for (int i = 0; i < potentiallyFood.Count; i++)
            {
                DaysWorthOfFoodCalculator.tmpThingCounts.Add(new ThingCount(potentiallyFood[i].Thing.def, potentiallyFood[i].Count));
            }
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(pawns, DaysWorthOfFoodCalculator.tmpThingCounts, assumeCanEatLocalPlants, ignoreInventory);

            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            return(result);
        }
        public static float ApproxDaysWorthOfFood(List <Pawn> pawns, List <ThingCount> potentiallyFood, int tile, IgnorePawnsInventoryMode ignoreInventory, Faction faction)
        {
            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            for (int i = 0; i < potentiallyFood.Count; i++)
            {
                if (potentiallyFood[i].Count > 0)
                {
                    DaysWorthOfFoodCalculator.tmpThingDefCounts.Add(new ThingDefCount(potentiallyFood[i].Thing.def, potentiallyFood[i].Count));
                }
            }
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(pawns, DaysWorthOfFoodCalculator.tmpThingDefCounts, tile, ignoreInventory, faction, null, 0f, 3300, true);

            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            return(result);
        }
        public static float ApproxDaysWorthOfFood(List <Pawn> pawns, List <Thing> potentiallyFood, bool assumeCanEatLocalPlants, IgnorePawnsInventoryMode ignoreInventory)
        {
            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            for (int i = 0; i < pawns.Count; i++)
            {
                Pawn pawn = pawns[i];
                if (pawn.RaceProps.EatsFood && (!assumeCanEatLocalPlants || !VirtualPlantsUtility.CanEverEatVirtualPlants(pawn)))
                {
                    DaysWorthOfFoodCalculator.tmpPawns.Add(pawn);
                }
            }
            for (int j = 0; j < potentiallyFood.Count; j++)
            {
                DaysWorthOfFoodCalculator.tmpThingCounts.Add(new ThingCount(potentiallyFood[j].def, potentiallyFood[j].stackCount));
            }
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(DaysWorthOfFoodCalculator.tmpPawns, DaysWorthOfFoodCalculator.tmpThingCounts, assumeCanEatLocalPlants, ignoreInventory);

            DaysWorthOfFoodCalculator.tmpThingCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            return(result);
        }
        public static float ApproxDaysWorthOfFood(List <Pawn> pawns, List <Thing> potentiallyFood, int tile, IgnorePawnsInventoryMode ignoreInventory, Faction faction)
        {
            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            for (int i = 0; i < pawns.Count; i++)
            {
                Pawn pawn = pawns[i];
                if (pawn.RaceProps.EatsFood)
                {
                    DaysWorthOfFoodCalculator.tmpPawns.Add(pawn);
                }
            }
            for (int j = 0; j < potentiallyFood.Count; j++)
            {
                DaysWorthOfFoodCalculator.tmpThingDefCounts.Add(new ThingDefCount(potentiallyFood[j].def, potentiallyFood[j].stackCount));
            }
            float result = DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(DaysWorthOfFoodCalculator.tmpPawns, DaysWorthOfFoodCalculator.tmpThingDefCounts, tile, ignoreInventory, faction, null, 0f, 3300, true);

            DaysWorthOfFoodCalculator.tmpThingDefCounts.Clear();
            DaysWorthOfFoodCalculator.tmpPawns.Clear();
            return(result);
        }
 public static float ApproxDaysWorthOfFood(Caravan caravan)
 {
     return(DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(caravan.PawnsListForReading, (List <ThingCount>)null, VirtualPlantsUtility.EnvironmentAllowsEatingVirtualPlantsNowAt(caravan.Tile), IgnorePawnsInventoryMode.DontIgnore));
 }
 public static float ApproxDaysWorthOfFood(Caravan caravan)
 {
     return(DaysWorthOfFoodCalculator.ApproxDaysWorthOfFood(caravan.PawnsListForReading, null, caravan.Tile, IgnorePawnsInventoryMode.DontIgnore, caravan.Faction, caravan.pather.curPath, caravan.pather.nextTileCostLeft, caravan.TicksPerMove, caravan.pather.Moving && !caravan.pather.Paused));
 }