Beispiel #1
0
        private void Load(IReader reader)
        {
            _header    = LoadHeader(reader, out uint mask);
            _tags      = LoadTagTable(reader, mask);
            _fileNames = LoadFileNames(reader);

            _stringIDs = LoadStringIDs(reader);

            //header doesn't contain a scenario path, but later engines do so might as well grab it
            ITag scenario = _tags.GetGlobalTag(CharConstant.FromString("scnr"));

            _header.ScenarioName = _fileNames.GetTagName(scenario.Index);

            LoadScriptFiles();
        }
        private void LoadScriptFiles(IReader reader)
        {
            if (_tags != null && _buildInfo.Layouts.HasLayout("hsdt"))
            {
                int tagCount = 0;

                IEnumerable <ITag> scripttags = _tags.FindTagsByClass("hsdt");

                ITag scnr = _tags.FindTagByClass("scnr");
                if (scnr == null)
                {
                    ScriptFiles = new IScriptFile[0];
                    return;
                }


                foreach (ITag aHS in scripttags)
                {
                    tagCount++;
                }

                ScriptFiles = new IScriptFile[tagCount];

                int i = 0;
                foreach (ITag aHS in scripttags)
                {
                    string tagname = _fileNames.GetTagName(aHS.Index);
                    ScriptFiles[i] = new ThirdGenScenarioScriptFile(scnr, aHS, tagname, MetaArea, StringIDs, _buildInfo, _expander);
                    i++;
                }

                return;
            }
            else if (_tags != null && _buildInfo.Layouts.HasLayout("scnr"))
            {
                ITag scnr = _tags.FindTagByClass("scnr");
                if (scnr != null)
                {
                    ScriptFiles    = new IScriptFile[1];
                    ScriptFiles[0] = new ThirdGenScenarioScriptFile(scnr, ScenarioName, MetaArea, StringIDs, _buildInfo, _expander);
                    return;
                }
            }
            ScriptFiles = new IScriptFile[0];
        }
Beispiel #3
0
        private void Load(IReader reader, EngineDescription buildInfo, string buildString)
        {
            _header    = LoadHeader(reader, buildInfo, buildString);
            _tags      = LoadTagTable(reader, buildInfo);
            _fileNames = LoadFileNames(reader, buildInfo);

            // firstgen has no StringIDs
            _stringIDs = LoadStringIDs(reader, buildInfo);

            // hack to get scenario name
            reader.SeekTo(MetaArea.Offset);
            StructureValueCollection values = StructureReader.ReadStructure(reader, buildInfo.Layouts.GetLayout("meta header"));

            // TODO (Dragon): idk if we should mask this like this
            var scenarioIndex = (int)values.GetInteger("scenario datum index") & 0xFFFF;

            _header.ScenarioName = _fileNames.GetTagName(scenarioIndex);
        }
Beispiel #4
0
        private void LoadScriptFiles()
        {
            if (_tags != null)
            {
                ScriptFiles = new IScriptFile[0];

                if (_buildInfo.Layouts.HasLayout("scnr"))
                {
                    //caches are intended for 1 scenario, so only load the *real* one
                    ITag hs = _tags.GetGlobalTag(CharConstant.FromString("scnr"));
                    if (hs != null)
                    {
                        ScriptFiles    = new IScriptFile[1];
                        ScriptFiles[0] = new ScnrScriptFile(hs, _fileNames.GetTagName(hs.Index), MetaArea, _buildInfo, StringIDs, _expander, Allocator);
                    }
                }
            }
        }
Beispiel #5
0
        private void Load(IReader reader)
        {
            _header    = LoadHeader(reader, out uint primaryMask);
            _tags      = LoadTagTable(reader, primaryMask);
            _fileNames = LoadFileNames(reader);
            _stringIDs = LoadStringIDs(reader);

            LoadLanguageGlobals(reader);
            LoadScriptFiles();
            LoadSimulationDefinitions(reader);

            if (string.IsNullOrEmpty(_header.ScenarioName))
            {
                //header didn't contain a scenario path yet, but later engines do so might as well grab it
                ITag scenario = _tags.GetGlobalTag(CharConstant.FromString("scnr"));
                _header.ScenarioName = _fileNames.GetTagName(scenario.Index);
            }
        }
Beispiel #6
0
        private void LoadScriptFiles()
        {
            ScriptFiles = new IScriptFile[0];

            if (_tags != null)
            {
                List <IScriptFile> l_scriptfiles = new List <IScriptFile>();

                if (_buildInfo.Layouts.HasLayout("scnr"))
                {
                    foreach (ITag hs in _tags.FindTagsByGroup("scnr"))
                    {
                        l_scriptfiles.Add(new ScnrScriptFile(hs, _fileNames.GetTagName(hs.Index), MetaArea, _buildInfo, StringIDs, _expander, Allocator));
                    }
                }
                else
                {
                    return;
                }

                ScriptFiles = l_scriptfiles.ToArray();
            }
        }
Beispiel #7
0
        private void LoadScriptFiles(IReader reader)
        {
            ScriptFiles = new IScriptFile[0];

            if (_tags != null)
            {
                List <ThirdGenScenarioScriptFile> l_scriptfiles = new List <ThirdGenScenarioScriptFile>();

                if (_buildInfo.Layouts.HasLayout("hsdt"))
                {
                    ITag mainScenario = _tags.GetGlobalTag(CharConstant.FromString("scnr"));
                    if (mainScenario == null)
                    {
                        return;
                    }

                    foreach (ITag hs in _tags.FindTagsByGroup("hsdt"))
                    {
                        l_scriptfiles.Add(new ThirdGenScenarioScriptFile(mainScenario, hs, _fileNames.GetTagName(hs.Index), MetaArea, StringIDs, _buildInfo, _expander));
                    }
                }
                else if (_buildInfo.Layouts.HasLayout("scnr"))
                {
                    foreach (ITag hs in _tags.FindTagsByGroup("scnr"))
                    {
                        l_scriptfiles.Add(new ThirdGenScenarioScriptFile(hs, _fileNames.GetTagName(hs.Index), MetaArea, StringIDs, _buildInfo, _expander));
                    }
                }
                else
                {
                    return;
                }

                ScriptFiles = l_scriptfiles.ToArray();
            }
        }
Beispiel #8
0
 private void LoadScriptFiles()
 {
     if (_tags != null)
     {
         if (_buildInfo.Layouts.HasLayout("hsdt"))
         {
             ScriptFiles = _tags.FindTagsByGroup("hsdt").Select(t => new HsdtScriptFile(t, _fileNames.GetTagName(t.Index), MetaArea, _buildInfo, StringIDs, _expander)).ToArray();
         }
         else if (_buildInfo.Layouts.HasLayout("scnr"))
         {
             ScriptFiles = _tags.FindTagsByGroup("scnr").Select(t => new ScnrScriptFile(t, _fileNames.GetTagName(t.Index), MetaArea, _buildInfo, StringIDs, _expander, Allocator)).ToArray();
         }
         else
         {
             ScriptFiles = new IScriptFile[0];
         }
     }
 }