Пример #1
0
    /// <summary>
    /// Not finished, dont use it
    /// </summary>
    /// <param name="reform"></param>
    internal Procent getYesVotes2(AbstractReformValue reform, ref Procent procentPopulationSayedYes)
    {
        uint    totalPopulation       = this.getMenPopulation();
        uint    votingPopulation      = 0;
        uint    populationSayedYes    = 0;
        uint    votersSayedYes        = 0;
        Procent procentVotersSayedYes = new Procent(0f);
        Dictionary <PopType, uint> divisionPopulationResult = new Dictionary <PopType, uint>();
        Dictionary <PopType, uint> divisionVotersResult     = Game.player.getYesVotesByType(reform, ref divisionPopulationResult);

        foreach (KeyValuePair <PopType, uint> 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);
    }
Пример #2
0
        //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
        }
Пример #3
0
    internal Procent getYesVotes(AbstractReformValue reform, ref Procent procentPopulationSayedYes)
    {
        // calc how much of population wants selected reform
        uint    totalPopulation       = this.getMenPopulation();
        uint    votingPopulation      = 0;
        uint    populationSayedYes    = 0;
        uint    votersSayedYes        = 0;
        Procent procentVotersSayedYes = new Procent(0);

        //Procent procentPopulationSayedYes = new Procent(0f);
        foreach (Province pro in ownedProvinces)
        {
            foreach (PopUnit pop in pro.allPopUnits)
            {
                if (pop.canVote())
                {
                    if (pop.getSayingYes(reform))
                    {
                        votersSayedYes     += pop.population;
                        populationSayedYes += pop.population;
                    }
                    votingPopulation += pop.population;
                }
                else
                {
                    if (pop.getSayingYes(reform))
                    {
                        populationSayedYes += pop.population;
                    }
                }
            }
        }
        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);
    }
Пример #4
0
    /// <summary>
    /// per level
    /// </summary>
    internal Procent getEfficiency(bool useBonuses)
    {
        //limit production by smalest factor
        float efficencyFactor  = 0;
        float workforceProcent = getWorkForceFullFilling();
        float inputFactor      = getInputFactor();

        if (inputFactor < workforceProcent)
        {
            efficencyFactor = inputFactor;
        }
        else
        {
            efficencyFactor = workforceProcent;
        }
        //float basicEff = efficencyFactor * getLevel();
        //Procent result = new Procent(basicEff);
        Procent result = new Procent(efficencyFactor);

        if (useBonuses)
        {
            result.set(result.get() * (1f + modifierEfficiency.getModifier(province.owner) / 100f));
        }
        return(result);
    }
Пример #5
0
        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);
            }
        }