public void SerializeTo(GlobalSaveGameFormat global) { var afflictionDict = new Dictionary <AfflictionType, List <Affliction> >(); foreach (var affliction in Negative.Concat(Positive)) { if (!afflictionDict.ContainsKey(affliction.AfflictionType)) { afflictionDict.Add(affliction.AfflictionType, new List <Affliction>()); } afflictionDict[affliction.AfflictionType].Add(affliction); } global.Hypothermia = ConvertBackHypothermia(global.Hypothermia, afflictionDict); global.FrostBite = ConvertBackFrostBite(global.FrostBite, afflictionDict); global.FoodPoisoning = ConvertBackFoodPoisoning(global.FoodPoisoning, afflictionDict); global.Dysentery = ConvertBackDysentery(global.Dysentery, afflictionDict); global.SprainedAnkle = ConvertBackSprainedAnkle(global.SprainedAnkle, afflictionDict); global.SprainedWrist = ConvertBackSprainedWrist(global.SprainedWrist, afflictionDict); global.Burns = ConvertBackBurns(global.Burns, afflictionDict); global.BurnsElectric = ConvertBackBurnsElectric(global.BurnsElectric, afflictionDict); global.BloodLoss = ConvertBackBloodLoss(global.BloodLoss, afflictionDict); global.Infection = ConvertBackInfection(global.Infection, afflictionDict); global.InfectionRisk = ConvertBackInfectionRisk(global.InfectionRisk, afflictionDict); global.CabinFever = ConvertBackCabinFever(global.CabinFever, afflictionDict); global.IntestinalParasites = ConvertBackIntestinalParasites(global.IntestinalParasites, afflictionDict); global.BrokenRibs = ConvertBackBrokenRib(global.BrokenRibs, afflictionDict); global.WellFed = ConvertBackWellFed(global.WellFed, afflictionDict); }