public void AddAlert(string name, FindDescription desc) { desc.name = name; //Remember for current copy Map map = desc.allMaps ? null : Find.CurrentMap; //Save two FindDescriptions: One to be scribed with ref string, other put in alert with real refs //This was a good idea at one point but now I don't care to consolidate them into one ist FindDescription refDesc = desc.Clone(null); //This one has ref string refDesc.name = name; FindDescription alertDesc = refDesc.Clone(map); //This one re-resolves reference for this map. AlertByFind.AddAlert(new FindAlertData(map, alertDesc), okAction: () => savedAlerts[name] = new FindAlertData(map, refDesc)); }
public override void ExposeData() { Scribe_Collections.Look(ref savedAlerts, "alertsByFind"); if (Scribe.mode == LoadSaveMode.PostLoadInit) { if (savedAlerts == null) { savedAlerts = new Dictionary <string, FindAlertData>(); } foreach (var kvp in savedAlerts) { AlertByFind.AddAlert(new FindAlertData(kvp.Value.map, kvp.Value.desc.Clone(kvp.Value.map)), overwrite: true); //Shouldn't need to overwrite, shouldn't popup window during ExposeData anyway } } }