public void UpdateRelationPartners() { foreach (RelationData partner in RelationsCache) { float relation = partner.Relation; string partnerName = partner.faction; FactionData TargetedFaction = factionsData[partnerName]; RelationData TheRelation = null; foreach (RelationData TempRelation in TargetedFaction.Relations) { if (TempRelation.faction == FactionName) { TheRelation = TempRelation; } } if (TheRelation != null) { TheRelation.Relation = relation; } else { Logger.Error("A partner did not found the current faction in its relation list."); } } }
public void RemoveRelation(RelationData relation) { relation.Remove(); Relations.Remove(relation); if (Relations.Count <= 0 && Boosters.Count <= 0) { // Only removed if both Relations and Boosters are null (they have the same parent node "relations" in save file). FactionNode.RemoveChild(XMLFunctions.FindChild(FactionNode, "relations")); } }