Changeset - 339712c9aa0a
[Not reviewed]
default
0 1 0
Jason Maltzen (jmaltzen) - 9 years ago 2015-12-26 04:08:57
jason.maltzen@unsanctioned.net
Fix up a crash that can happen one resume if ingredients are disabled between recipe generation runs.
1 file changed with 8 insertions and 5 deletions:
0 comments (0 inline, 0 general)
RecipeGenerator.cs
Show inline comments
...
 
@@ -247,5 +247,5 @@ namespace DesertPaintLab
 
                {
 
                    bool inUse = reagentInUse[idx];
 
                    if (inUse == false)
 
                    if ((inUse == false) && (costSortedReagents[(int)idx].Enabled))
 
                    {
 
                        //Console.WriteLine("Found free reagent idx {0}", idx);
...
 
@@ -385,6 +385,9 @@ namespace DesertPaintLab
 
                                        if (isInUse != 0)
 
                                        {
 
                                            if (reagentId != INVALID_REAGENT)
 
                                            {
 
                                            reagentInUse[reagentId] = true;
 
                                        }
 
                                        }
 
                                        ++nextReagentPos;
 
                                    }
...
 
@@ -541,9 +544,6 @@ namespace DesertPaintLab
 
            {
 
                Reagent reagent = ReagentManager.GetReagent(name);
 
                if (reagent.Enabled)
 
                {
 
                    costSortedReagents.Add(reagent);
 
                }
 
            }
 
            costSortedReagents.Sort(new ReagentCostSort());
 
        }
...
 
@@ -575,5 +575,5 @@ namespace DesertPaintLab
 
            foreach (Reagent reagent in costSortedReagents)
 
            {
 
                if (!reagent.IsCatalyst && reagent.RecipeMax >= 10)
 
                if (!reagent.IsCatalyst && reagent.RecipeMax >= 10 && reagent.Enabled)
 
                {
 
                    recipe.Clear();
...
 
@@ -590,4 +590,6 @@ namespace DesertPaintLab
 
            for (uint reagentIdx = 0; reagentIdx < costSortedReagents.Count; ++reagentIdx)
 
            {
 
                if (costSortedReagents[(int)reagentIdx].Enabled)
 
                {
 
                SearchNode initialNode = new SearchNode(costSortedReagents, reagentIdx);
 
                initialNode.MaxQuantity = maxQuantity;
...
 
@@ -595,4 +597,5 @@ namespace DesertPaintLab
 
                searchQueue.Enqueue(initialNode);
 
            }
 
            }
 
            
 
            // start worker threads to do the actual work
0 comments (0 inline, 0 general)