/// <summary> /// Not finished, don't use it /// </summary> /// <param name="reform"></param> public Procent getYesVotes2(IReformValue reform, ref Procent procentPopulationSayedYes) { int totalPopulation = AllPops.Sum(x => x.population.Get()); int votingPopulation = 0; int populationSayedYes = 0; int votersSayedYes = 0; Procent procentVotersSayedYes = new Procent(0f); Dictionary <PopType, int> divisionPopulationResult = new Dictionary <PopType, int>(); Dictionary <PopType, int> divisionVotersResult = getYesVotesByType(reform, ref divisionPopulationResult); foreach (KeyValuePair <PopType, int> next in divisionVotersResult) { votersSayedYes += next.Value; } if (totalPopulation != 0) { procentPopulationSayedYes.Set((float)populationSayedYes / totalPopulation); } else { procentPopulationSayedYes.Set(0); } if (votingPopulation == 0) { procentVotersSayedYes.Set(0); } else { procentVotersSayedYes.Set((float)votersSayedYes / votingPopulation); } return(procentVotersSayedYes); }
public Procent getYesVotes(IReformValue reform, ref Procent procentPopulationSayedYes) { // calculate how much of population wants selected reform int totalPopulation = AllPops.Sum(x => x.population.Get()); int votingPopulation = 0; int populationSayedYes = 0; int votersSayedYes = 0; Procent procentVotersSayedYes = new Procent(0); //Procent procentPopulationSayedYes = new Procent(0f); foreach (Province province in ownedProvinces) { foreach (PopUnit pop in province.AllPops) { if (pop.CanVoteInOwnCountry()) { if (pop.getSayingYes(reform)) { votersSayedYes += pop.population.Get(); // * pop.getVotingPower(); populationSayedYes += pop.population.Get(); // * pop.getVotingPower(); } votingPopulation += pop.population.Get(); // * pop.getVotingPower(); } else { if (pop.getSayingYes(reform)) { populationSayedYes += pop.population.Get();// * pop.getVotingPower(); } } } } if (totalPopulation != 0) { procentPopulationSayedYes.Set((float)populationSayedYes / totalPopulation); } else { procentPopulationSayedYes.Set(0); } if (votingPopulation == 0) { procentVotersSayedYes.Set(0); } else { procentVotersSayedYes.Set((float)votersSayedYes / votingPopulation); } return(procentVotersSayedYes); }
public int getFamilyPopulation() { //return getMenPopulation() * Options.familySize; return(AllPops.Sum(x => x.population.Get()) * Options.familySize); }