Exemplo n.º 1
0
static void end_of_month_update(void)
{
    //update queque of polluted tiles
    scan_pollution();
    //fetch remaining textures in order loader thread can exit
    if(getGameView()->textures_ready && getGameView()->remaining_images)
    {
        getGameView()->fetchTextures();
    }
    housed_population = (tpopulation / NUMOF_DAYS_IN_MONTH);
    total_housing = (thousing / NUMOF_DAYS_IN_MONTH);
    if ((housed_population + people_pool) > max_pop_ever)
        max_pop_ever = housed_population + people_pool;

    if (people_pool > 100)
    {
        if (rand() % 1000 < people_pool)
            people_pool -= 10;
    }
    if (people_pool < 0)
    {
        people_pool = 0;
    }

    if (tech_level > TECH_LEVEL_LOSS_START)
    {
        tech_level -= (int)(tech_level * (1. / TECH_LEVEL_LOSS)
                            * (1 + (tpopulation * (1. / NUMOF_DAYS_IN_MONTH / 120 / (TECH_LEVEL_LOSS - 200)))));
    }
    else
    {
        tech_level += TECH_LEVEL_UNAIDED;
    }
    /* we can go over 100, but it's even more difficult */
    if (tech_level > MAX_TECH_LEVEL)
    {   tech_level -= (int)((tech_level - MAX_TECH_LEVEL)
                            * (1. / TECH_LEVEL_LOSS)
                            * (1 + (tpopulation * (1. / NUMOF_DAYS_IN_MONTH / 120 / (TECH_LEVEL_LOSS - 100)))));
    }
    if (highest_tech_level < tech_level)
    {
        highest_tech_level = tech_level;
    }

    deaths_cost += tunnat_deaths * UNNAT_DEATHS_COST;

    for (int i = 0; i < constructionCount.size(); i++)
    {
        if (constructionCount[i])
        {
            constructionCount[i]->report_commodities();
        }
    }
    update_pbars_monthly();
}
void print_stats ()
{
    // this show update the financy window or mps
    if (total_time % NUMOF_DAYS_IN_MONTH == (NUMOF_DAYS_IN_MONTH - 1))
    {
        update_pbars_monthly();
        mps_refresh();
        getEconomyGraph()->updateData();
    }

    if (total_time % (NUMOF_DAYS_IN_MONTH/5) == NUMOF_DAYS_IN_MONTH / 5 - 1)
    {   mps_refresh();}

    //check for new tech
    update_avail_modules (1);

}