private Empire CreateEmpireFromEmpireSaveData(SavedGame.EmpireSaveData data) { Empire e = new Empire(); //TempEmpireData Tdata = new TempEmpireData(); if (data.IsFaction) { e.isFaction = true; } if (data.isMinorRace) { e.MinorRace = true; } if (data.empireData == null) { e.data.Traits = data.Traits; e.EmpireColor = new Color((byte)data.Traits.R, (byte)data.Traits.G, (byte)data.Traits.B); } else { e.data = new EmpireData(); //Tdata = data.empireData as TempEmpireData; foreach (string key in e.data.WeaponTags.Keys) { if(data.empireData.WeaponTags.ContainsKey(key)) continue; data.empireData.WeaponTags.Add(key,new WeaponTagModifier()); } e.data = data.empireData; // e.data. e.data.ResearchQueue = data.empireData.ResearchQueue; e.ResearchTopic = data.ResearchTopic; if (e.ResearchTopic == null) { e.ResearchTopic = ""; } e.dd = Ship_Game.ResourceManager.DDDict[e.data.DiplomacyDialogPath]; e.PortraitName = e.data.PortraitName; e.EmpireColor = new Color((byte)e.data.Traits.R, (byte)e.data.Traits.G, (byte)e.data.Traits.B); if (data.CurrentAutoScout != null) e.data.CurrentAutoScout = data.CurrentAutoScout; else e.data.CurrentAutoScout = e.data.StartingScout; if (data.CurrentAutoFreighter != null) e.data.CurrentAutoFreighter = data.CurrentAutoFreighter; else e.data.CurrentAutoFreighter = e.data.DefaultSmallTransport; if (data.CurrentAutoColony != null) e.data.CurrentAutoColony = data.CurrentAutoColony; else e.data.CurrentAutoColony = e.data.DefaultColonyShip; if (data.CurrentConstructor != null) e.data.CurrentConstructor = data.CurrentConstructor; else e.data.CurrentConstructor = e.data.DefaultConstructor; } e.Initialize(); e.Money = data.Money; e.Research = data.Research; e.GetGSAI().AreasOfOperations = data.AOs; foreach (TechEntry tech in data.TechTree) { if (!e.GetTDict().ContainsKey(tech.UID)) { continue; } if (tech.AcquiredFrom != null) e.GetTDict()[tech.UID].AcquiredFrom = tech.AcquiredFrom; if (tech.Unlocked) { e.UnlockTechFromSave(tech.UID); } e.GetTDict()[tech.UID].Progress = tech.Progress; e.GetTDict()[tech.UID].Discovered = tech.Discovered; e.GetTDict()[tech.UID].level = tech.level; } return e; }