/// <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 void initialize(PopUnit origin, int size) { this.origin = origin; this.size = size; morale.Set(0f); consumption.setZero(); }
//public Corps(Corps corps):this(corps.getPopUnit(), corps.getSize()) //{ //} internal void deleteData() { size = 0; origin = null; morale.Set(0); consumption.setZero(); //here - delete all links on that object }
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); }
internal void CalcMarketPrice() { var isOnsale = IsOnSale(); if (isOnsale || parent.IsClosed) { // reduce price marketPriceModifier.Subtract(0.001f, false); if (marketPriceModifier.isZero()) { marketPriceModifier.Set(0.001f); } } if (!isOnsale && parent.IsOpen) //rise price { marketPriceModifier.Add(0.01f); } }