예제 #1
0
void mps_global_finance(void) {
    int i = 0;
    char s[12];

    int cashflow = 0;

    mps_store_title(i++,_("Tax Income"));

    cashflow += ly_income_tax;
    num_to_ansi (s, 12, ly_income_tax);
    mps_store_ss(i++,_("Income"), s);

    cashflow += ly_coal_tax;
    num_to_ansi(s, 12, ly_coal_tax);
    mps_store_ss(i++,_("Coal"), s);

    cashflow += ly_goods_tax;
    num_to_ansi(s, 12, ly_goods_tax);
    mps_store_ss(i++,_("Goods"), s);

    cashflow += ly_export_tax;
    num_to_ansi(s, 12, ly_export_tax);
    mps_store_ss(i++,_("Export"), s);

    i++;

    mps_store_title(i++,_("Expenses"));

    cashflow -= ly_unemployment_cost;
    num_to_ansi(s, 12, ly_unemployment_cost);
    mps_store_ss(i++,_("Unemp."), s);

    cashflow -= ly_transport_cost;
    num_to_ansi(s, 12, ly_transport_cost);
    mps_store_ss(i++,_("Transport"), s);

    cashflow -= ly_import_cost;
    num_to_ansi(s, 12, ly_import_cost);
    mps_store_ss(i++,_("Imports"), s);

    cashflow -= ly_other_cost;
    num_to_ansi(s, 12, ly_other_cost);
    mps_store_ss(i++,_("Others"), s);

    i++;

    num_to_ansi(s, 12, cashflow);
    mps_store_ss(i++,_("Net"), s);
}
예제 #2
0
void
mps_global_other_costs (void)
{
    int i = 0;
    int year;
    char s[12];

    mps_store_title(i++,_("Other Costs"));

    /* Don't write year if it's negative. */
    year = (total_time / NUMOF_DAYS_IN_YEAR) - 1;
    if (year >= 0) {
        mps_store_sd(i++, _("For year"), year);
    }
    i++;
    num_to_ansi(s,sizeof(s),ly_interest);
    mps_store_ss(i++,_("Interest"),s);
    num_to_ansi(s,sizeof(s),ly_school_cost);
    mps_store_ss(i++,_("Schools"),s);
    num_to_ansi(s,sizeof(s),ly_university_cost);
    mps_store_ss(i++,_("Univers."),s);
    num_to_ansi(s,sizeof(s),ly_deaths_cost);
    mps_store_ss(i++,_("Deaths"),s);
    num_to_ansi(s,sizeof(s),ly_windmill_cost);
    mps_store_ss(i++,_("Windmill"),s);
    num_to_ansi(s,sizeof(s),ly_health_cost);
    mps_store_ss(i++,_("Hospital"),s);
    num_to_ansi(s,sizeof(s),ly_rocket_pad_cost);
    mps_store_ss(i++,_("Rockets"),s);
    num_to_ansi(s,sizeof(s),ly_fire_cost);
    mps_store_ss(i++,_("Fire Stn"),s);
    num_to_ansi(s,sizeof(s),ly_cricket_cost);
    mps_store_ss(i++,_("Sport"),s);
    num_to_ansi(s,sizeof(s),ly_recycle_cost);
    mps_store_ss(i++,_("Recycle"),s);
}
예제 #3
0
파일: lclib.c 프로젝트: usrshare/lincity
void 
format_pos_number4 (char* str, int num)
{
  num_to_ansi(str, 4, num);
}
예제 #4
0
void
mps_port (int x, int y)
{
    int i = 0;
    char buy[12], sell[12];

    mps_store_title(i++,_("Port"));
    i++;

    num_to_ansi(buy, sizeof(buy), MP_INFO(x,y+1).int_3 / 100);
    num_to_ansi(sell, sizeof(sell), MP_INFO(x,y+2).int_3 / 100);
    mps_store_sss(i++,_("Food"),buy,sell);

    num_to_ansi(buy, sizeof(buy), MP_INFO(x,y+1).int_4 / 100);
    num_to_ansi(sell, sizeof(sell), MP_INFO(x,y+2).int_4 / 100);
    mps_store_sss(i++,_("Coal"),buy,sell);

    num_to_ansi(buy, sizeof(buy), MP_INFO(x,y+1).int_5 / 100);
    num_to_ansi(sell, sizeof(sell), MP_INFO(x,y+2).int_5 / 100);
    mps_store_sss(i++,_("Ore"),buy,sell);

    num_to_ansi(buy, sizeof(buy), MP_INFO(x,y+1).int_6 / 100);
    num_to_ansi(sell, sizeof(sell), MP_INFO(x,y+2).int_6 / 100);
    mps_store_sss(i++,_("Goods"),buy,sell);

    num_to_ansi(buy, sizeof(buy), MP_INFO(x,y+1).int_7 / 100);
    num_to_ansi(sell, sizeof(sell), MP_INFO(x,y+2).int_7 / 100);
    mps_store_sss(i++,_("Steel"),buy,sell);

    num_to_ansi(buy, sizeof(buy), MP_INFO(x,y).int_5 / 100);
    num_to_ansi(sell, sizeof(sell), MP_INFO(x,y).int_2 / 100);
    mps_store_sss(i++,_("Total"),buy,sell);

}
예제 #5
0
파일: PBar.cpp 프로젝트: okosan/lincity-xg
/*
static int Pbarorder[] = {
    Construction::STUFF_FOOD,
    Construction::STUFF_JOBS,
    Construction::STUFF_GOODS,
    Construction::STUFF_COAL,
    Construction::STUFF_ORE,
    Construction::STUFF_STEEL,
    Construction::STUFF_WASTE,
    Construction::STUFF_KWH,
    Construction::STUFF_MWH,
    Construction::STUFF_WATER,
    };
*/
void
LCPBar::setValue(int num, int value, int diff)
{
    if ((num > 8) && (pbarGlobalStyle == 0))
    {   return;}
    if ((pbarGlobalStyle == 1) && (num > 2) && (num < 9))
    {   return;}

    std::ostringstream os;
    int line_number = num+1;
    if ( (pbarGlobalStyle == 1) && (num>8))
    {   line_number -= PBAR_PAGE_SHIFT;}

    os << "pbar_text" << line_number;
    Paragraph* p = getParagraph(*this, os.str());
    os.str("");
    //compname << "pbar_title" << line_number;
    //Paragraph* pt = getParagraph(*this, compname.str());

    if(num==PTECH)
    {
        os<<std::fixed;
        os<<std::setprecision(1);
        os<<value/10000.0;
    }
    else if(num==PMONEY || num==PPOP || num==PPOL)
    {
        char s[12];
        num_to_ansi (s, sizeof(s), value);
        os<<s;
    }
    else if ((num >= PFOOD) && (num <= PHOUSE)) //percentages
    {
         os<<value<<"%";
    }
    else
    {
        os<<"default";
    }
    if (p)
    {   p->setText(os.str());}

    float sv=0;
    switch(num)
    {
      case PPOP:
        sv = pbar_adjust_pop(diff);
        break;
      case PTECH:
        sv = pbar_adjust_tech(diff);
        break;
    case PPOL:
        sv = value<5000?100*diff/(1+value):value<25000?500*diff/value:5000*diff/value;
        break;
    case PMONEY:
        sv = pbar_adjust_money(diff);
        break;
    default:
        sv = diff;
        break;
      };

    sv/=10.0;


     if(sv>1.0)
      sv=1.0;
     if(sv<-1.0)
      sv=-1.0;

    os.str("");
    os<<"pbar_barview"<< line_number;
    Component *c=findComponent(os.str()+"a");
    if(c)
    {
      BarView *bv=dynamic_cast<BarView*>(c);
      if(bv)
      {
        bv->setValue(sv);
      }
    }
    c=findComponent(os.str()+"b");
    if(c)
    {
      BarView *bv=dynamic_cast<BarView*>(c);
      if(bv)
      {
        bv->setValue(sv);
      }
    }

}