Ejemplo n.º 1
0
        private void CheckAdvancedResearch()
        {
            //Log.Message( "Checking - " + researchComplete.Count + " - defs" );
            // Quick scan to see if anything changed and early out if nothing is complete
            if (Game.GodMode == false)
            {
                // Reset everything
                if (wasGodMode)
                {
                    LockEverything();
                }

                // Not anymore
                wasGodMode = false;

                // God mode is off, do a real check
                bool noChange = true;
                for (int rcIndex = 0, rcCountTo = researchComplete.Count; rcIndex < rcCountTo; rcIndex++)
                {
                    ResearchCompletePair rcPair = researchComplete[rcIndex];
                    //Log.Message( "Checking - " + rcPair.researchProject.LabelCap );
                    if ((rcPair.researchProject.IsFinished) && (rcPair.wasComplete == false))
                    {
                        rcPair.wasComplete = true;
                        noChange           = false;
                        //Log.Message( rcPair.researchProject.LabelCap + " - Is now done" );
                    }
                }

                // GTFO!
                if (noChange)
                {
                    return;
                }
            }
            //Log.Message( "updating" );

            // Prepare for some work
            PrepareCache();

            // Start determining work
            for (int aIndex = 0, aCountTo = advancedResearch.Count; aIndex < aCountTo; aIndex++)
            {
                AdvancedResearchDef Advanced = advancedResearch[aIndex];
                // Is it done?
                if ((Advanced.isEnabled == false) &&
                    (Advanced.ResearchGroupComplete()))
                {
                    // If all the research is done, process the def
                    ProcessResearch(Advanced);
                }
            }

            ProcessCache();
        }