public void readFamilyTrees(FamilyTrees trees) { foreach (FactionInfo faction in factionPreProcessMappings) { CK2Character character = new CK2Character(); FamilyTree tree = trees.getTree(faction.getID()); if (tree != null) { character = tree.getOwner(); } CK2Dynasty dynasty = new CK2Dynasty(); if (faction.getDynasty() != null) { dynasty = faction.getDynasty(); if (tree != null) { tree.updateDynasty(dynasty, character, true); } } else { if (tree != null) { dynasty = tree.getDynasty(); } faction.setDynasty(dynasty); } //character.setDynasty(dynasty); faction.setOwner(character); } }
private void updateSpouses() { foreach (var pair in trees) { FamilyTree tree = pair.Value; HashSet <int> processed = new HashSet <int>(); tree.updateSpouses(tree.getOwner(), processed, esfFamilyTreeStructure); } }
private void createTrees(CharInfoCreator charInfoCreator, Dictionary <String, List <CK2Character> > charInfo) { Dictionary <int, CK2Character> fam2Char = new Dictionary <int, CK2Character>(); foreach (CK2Character character in allCharacters) { fam2Char.Add(character.getFamilyTreeID(), character); } foreach (var pair in charInfo) { FamilyTree tree = new FamilyTree(charInfoCreator, pair.Value, fam2Char, esfFamilyTreeStructure); trees.Add(pair.Key, tree); } }
public List <CK2Dynasty> getDynasties() { List <CK2Dynasty> dynasties = new List <CK2Dynasty>(); foreach (var pair in trees) { FamilyTree tree = pair.Value; HashSet <CK2Dynasty> treeDynasties = tree.getAssociatedDynasties(); foreach (CK2Dynasty assocDynasty in treeDynasties) { dynasties.Add(assocDynasty); } } return(dynasties); }