public void AddVillage(int villageId, int[] connectedToVillages) { Village village = GetOrCreateVillage(villageId); foreach (Village connectToVillage in connectedToVillages.Select(GetOrCreateVillage)) { village.AddPipeConnection(connectToVillage); } }
public void AddPipeConnection(Village toVillage) { if (!ContainsConnectedVillage(toVillage)) { ConnectedToVillages.Add(toVillage.Id, toVillage); } if (!toVillage.ContainsConnectedVillage(this)) { toVillage.AddPipeConnection(this); } }