00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <OSYS.H>
00020 #include <OSTR.H>
00021 #include <OMISC.H>
00022 #include <OHELP.H>
00023 #include <OGRPHYR.H>
00024 #include <OGRPHMTH.H>
00025 #include <OGAMESET.H>
00026 #include <OWORLDMT.H>
00027 #include <OINVEST.H>
00028 #include <ODEVELOP.H>
00029 #include <OVGA.H>
00030 #include <OIFACE.H>
00031 #include <OINFO.H>
00032 #include <COLOR.H>
00033 #include <OFONT.H>
00034 #include <OGAMESTR.H>
00035 #include <OMOUSE.H>
00036 #include <OBUTTON.H>
00037 #include <OVALSLDR.H>
00038 #include <OSPINNER.H>
00039 #include <OPIECHRT.H>
00040 #include <OFINANCE.H>
00041 #include <OTEXT.H>
00042 #include <ORADIOV.H>
00043 #include <ORADIO.H>
00044 #include <OBOX.H>
00045 #include <STDIO.H>
00046
00047
00048
00049 enum {
00050 MODE_INVESTMENT = 0,
00051 MODE_FINANCIAL = 1,
00052 #if(GAME_VERSION>=200)
00053 MODE_TRANSFER = 2,
00054 #endif
00055 };
00056
00057 enum {
00058 BG_PIC_ID = 2
00059 };
00060
00061 enum {
00062 REPORT_X1 = ZOOM_X1+15,
00063 REPORT_Y1 = ZOOM_Y1+15,
00064 REPORT_X2 = ZOOM_X2-15,
00065 REPORT_Y2 = ZOOM_Y2-55
00066 };
00067
00068 enum {
00069 BOTTOM_BUTTON_X1 = REPORT_X1+200,
00070 BOTTOM_BUTTON_Y1 = REPORT_Y2+15,
00071 BOTTOM_BUTTON_X2 = REPORT_X2-80,
00072 BOTTOM_BUTTON_Y2 = REPORT_Y2+40
00073 };
00074
00075 enum {
00076 BOTTOM_BUTTON_WIDTH = 125,
00077 BOTTOM_BUTTON_HEIGHT = 25,
00078 BOTTOM_BUTTON_DISTANCE
00079 = (BOTTOM_BUTTON_X2-BOTTOM_BUTTON_X1-BOTTOM_BUTTON_WIDTH*2)/3
00080 };
00081
00082
00083 enum {
00084 MODE_INVESTMENT_GRAPH_WIDTH = 150,
00085 MODE_INVESTMENT_GRAPH_HEIGHT = 150,
00086 MODE_INVESTMENT_LEGEND_HEIGHT = 26,
00087 MODE_INVESTMENT_LEGEND_WIDTH = 370,
00088 };
00089
00090
00091
00092 enum {
00093 MODE_FINANCIAL_BOX1_HEIGHT = 100,
00094 MODE_FINANCIAL_BOX2_HEIGHT = 245,
00095 MODE_FINANCIAL_GRAPH_WIDTH = 400,
00096 MODE_FINANCIAL_GRAPH_HEIGHT = 170,
00097 MODE_FINANCIAL_LEGEND_HEIGHT = 26,
00098 MODE_FINANCIAL_LEGEND_WIDTH = 400,
00099
00100 MODE_FINANCIAL_TAB1 = 15,
00101 MODE_FINANCIAL_TAB2 = 280,
00102 MODE_FINANCIAL_TAB3 = 360,
00103 MODE_FINANCIAL_TAB4 = 440,
00104 MODE_FINANCIAL_TAB5 = 520,
00105 MODE_FINANCIAL_TAB6 = 600,
00106 };
00107
00108 enum {
00109 FINANCIAL_BUTTON_X1 = REPORT_X1+MODE_FINANCIAL_TAB4,
00110 FINANCIAL_BUTTON_Y1 = REPORT_Y1+MODE_FINANCIAL_BOX1_HEIGHT+165,
00111 FINANCIAL_BUTTON_X2 = REPORT_X2,
00112 FINANCIAL_BUTTON_Y2 = REPORT_Y2
00113 };
00114
00115 enum {
00116 FINANCIAL_BUTTON_WIDTH = 200,
00117 FINANCIAL_BUTTON_HEIGHT = 22,
00118 FINANCIAL_BUTTON_DISTANCE = 4
00119 };
00120
00121 enum {
00122 MODE_FINANCIAL_IMPLEMENT = 2,
00123 MODE_FINANCIAL_ANNOUNCE = 1,
00124 MODE_FINANCIAL_CONSIDER = 0,
00125 };
00126
00127
00128
00129 static char report_init_flag = 0;
00130 static char mode_init_flag = -1;
00131
00132 #if(GAME_VERSION>=200)
00133 static ButtonGroup bottom_button_group(3);
00134 static short *bottom_button_up_bitmap[3];
00135 static short *bottom_button_down_bitmap[3];
00136 #else
00137 static ButtonGroup bottom_button_group(2);
00138 static short *bottom_button_up_bitmap[2];
00139 static short *bottom_button_down_bitmap[2];
00140 #endif
00141 #if(GAME_VERSION>=200)
00142 static char *bottom_button_label[] = {
00143 "Overview1", "Overview2", "Funds transfer"
00144 };
00145 #else
00146 static char *bottom_button_label[] = {
00147 "Overview1", "Overview2"
00148 };
00149 #endif
00150
00151
00152
00153
00154 #ifdef DEBUG
00155
00156 PieChart mode_investment_piechart;
00157 #else
00158 static PieChart mode_investment_piechart;
00159 #endif
00160
00161
00162 static ValueSlider mode_investment_slider1;
00163 static ValueSlider mode_investment_slider2;
00164 static ValueSlider mode_investment_slider3;
00165 static Text mode_financial_text;
00166 static GraphMonth mode_investment_graph_snp;
00167 static char *mode_investment_legend_label[] = {
00168
00169
00170
00171 "Index of Endowment Market Value",
00172 };
00173
00174
00175
00176 #if(GAME_VERSION>=200)
00177 static char *mode_financial_str[] = {
00178 "Endowment spending",
00179 "Total endowment market value",
00180 "New gifts to endowment",
00181 "",
00182 "Change",
00183 ""
00184 };
00185 #else
00186 static char *mode_financial_str[] = {
00187 "Endowment spending",
00188 "Endowment market value",
00189 "New gifts to endowment",
00190 "",
00191 "Change",
00192 ""
00193 };
00194 #endif
00195
00196
00197 static short *mode_financial_stats_bitmap;
00198 static Spinner financial_spinner_budget;
00199 static ButtonGroup financial_button_group(3);
00200 static short *financial_button_up_bitmap[3];
00201 static short *financial_button_down_bitmap[3];
00202 static char *financial_button_label[] = {
00203 "Consider for next year", "Promise for next year", "Implement now"
00204 };
00205 static RadioButtonVert mode_financial_rbv;
00206 static char financial_current_mode = MODE_FINANCIAL_CONSIDER;
00207 static GraphYear mode_financial_graph_profitloss;
00208 static char *mode_financial_graph_title="";
00209 static char *mode_financial_rbvlabel[] = {
00210 "no smoothing",
00211 "3-year smoothing",
00212 "5-year smoothing",
00213 };
00214 static char *mode_financial_legend_label[] = {
00215 "Endowment spending : projected maximum",
00216 "Projected minimum value",
00217 "Projected average value",
00218 };
00219
00220
00221
00222 #if(GAME_VERSION>=200)
00223
00224 static RadioButtonVert transfer_from;
00225 static RadioButtonVert transfer_to;
00226 static Spinner transfer_per_spinner;
00227 static float spinner_val = 0.0;
00228
00229 static Button implement_button;
00230
00231 static char *transfer_label[]= {
00232 "Operating reserve",
00233 "Facilities reserve",
00234 "Quasi endowment",
00235 };
00236
00237 static int sel_from =0;
00238 static int sel_to = 2;
00239 #endif
00240
00241
00242
00243
00244
00245
00246
00247
00248 static void report_investment(int);
00249 static void report_financial(int);
00250 #if(GAME_VERSION>=200)
00251 static void report_transfer(int);
00252 #endif
00253 static int detect_investment();
00254 static int detect_financial();
00255 #if(GAME_VERSION>=200)
00256 static int detect_transfer();
00257 #endif
00258 static void deinit_investment();
00259 static void deinit_financial();
00260 #if(GAME_VERSION>=200)
00261 static void deinit_transfer();
00262 #endif
00263
00264 typedef void (*ReportFP)(int refreshFlag);
00265 typedef int (*DetectFP)();
00266 typedef void (*DeinitFP)();
00267
00268 #if(GAME_VERSION>=200)
00269 static ReportFP report_func_ptr[] = {
00270 &report_investment,
00271 &report_financial,
00272 &report_transfer
00273 };
00274
00275 static DetectFP detect_func_ptr[] = {
00276 &detect_investment,
00277 &detect_financial,
00278 &detect_transfer
00279 };
00280
00281 static DeinitFP deinit_func_ptr[] = {
00282 &deinit_investment,
00283 &deinit_financial,
00284 &deinit_transfer
00285 };
00286 #else
00287 static ReportFP report_func_ptr[] = {
00288 &report_investment,
00289 &report_financial
00290 };
00291
00292 static DetectFP detect_func_ptr[] = {
00293 &detect_investment,
00294 &detect_financial
00295 };
00296
00297 static DeinitFP deinit_func_ptr[] = {
00298 &deinit_investment,
00299 &deinit_financial,
00300 };
00301 #endif
00302
00303
00305
00306 init();
00307 }
00308
00309
00310
00311
00313
00314 deinit();
00315 }
00316
00317
00318
00319
00321
00322
00323
00324 bottom_button_group.deinit_buttons();
00325
00326 if (*bottom_button_up_bitmap) {
00327 #if(GAME_VERSION>=200)
00328 for (int i = 0; i < 3; i++) {
00329 mem_del(bottom_button_up_bitmap[i]);
00330 mem_del(bottom_button_down_bitmap[i]);
00331 bottom_button_up_bitmap[i] = NULL;
00332 bottom_button_down_bitmap[i] = NULL;
00333 }
00334 #else
00335 for (int i = 0; i < 2; i++) {
00336 mem_del(bottom_button_up_bitmap[i]);
00337 mem_del(bottom_button_down_bitmap[i]);
00338 bottom_button_up_bitmap[i] = NULL;
00339 bottom_button_down_bitmap[i] = NULL;
00340 }
00341 #endif
00342 }
00343
00344 (*deinit_func_ptr[current_mode])();
00345
00346 report_init_flag = 0;
00347 }
00348
00349
00350
00351
00353
00354 memset(this,0,sizeof(Investment));
00355
00356 #if(GAME_VERSION>=200)
00357 for (int i = 0; i < 3; i++) {
00358 bottom_button_up_bitmap[i] = NULL;
00359 bottom_button_down_bitmap[i] = NULL;
00360 }
00361 #else
00362 for (int i = 0; i < 2; i++) {
00363 bottom_button_up_bitmap[i] = NULL;
00364 bottom_button_down_bitmap[i] = NULL;
00365 }
00366 #endif
00367 current_mode = MODE_INVESTMENT;
00368 }
00369
00370
00371
00372
00374
00375 vga.use_back();
00376
00377 #if(GAME_VERSION>=200)
00378
00379 sys.is_institution_report = 1;
00380 #endif
00381
00382 if (refreshFlag == INFO_REPAINT) {
00383 if( report_init_flag )
00384 deinit();
00385
00386
00387 user_interface.bg_img(BG_PIC_ID, &vga_back);
00388
00389
00390 if (!report_init_flag) {
00391 #if(GAME_VERSION>=200)
00392 short x = BOTTOM_BUTTON_X1-120;
00393 for (int i = 0; i < 3; i++, x+=BOTTOM_BUTTON_WIDTH+BOTTOM_BUTTON_DISTANCE) {
00394
00395 user_interface.create_button_bitmap(x, BOTTOM_BUTTON_Y1,
00396 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00397 bottom_button_label[i], &bottom_button_up_bitmap[i],
00398 &bottom_button_down_bitmap[i], &vga_back);
00399
00400 bottom_button_group[i].create_bitmapW(x, BOTTOM_BUTTON_Y1,
00401 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00402 ((i == current_mode) ? bottom_button_down_bitmap[i] : bottom_button_up_bitmap[i])+4);
00403 }
00404 #else
00405 short x = BOTTOM_BUTTON_X1;
00406 for (int i = 0; i < 2; i++, x+=BOTTOM_BUTTON_WIDTH+BOTTOM_BUTTON_DISTANCE) {
00407
00408 user_interface.create_button_bitmap(x, BOTTOM_BUTTON_Y1,
00409 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00410 bottom_button_label[i], &bottom_button_up_bitmap[i],
00411 &bottom_button_down_bitmap[i], &vga_back);
00412
00413 bottom_button_group[i].create_bitmapW(x, BOTTOM_BUTTON_Y1,
00414 x+BOTTOM_BUTTON_WIDTH, BOTTOM_BUTTON_Y1+BOTTOM_BUTTON_HEIGHT,
00415 ((i == current_mode) ? bottom_button_down_bitmap[i] : bottom_button_up_bitmap[i])+4);
00416 }
00417 #endif
00418 report_init_flag = 1;
00419 }
00420
00421
00422 bottom_button_group.paint(current_mode);
00423 }
00424
00425
00426 (*report_func_ptr[current_mode])(refreshFlag);
00427
00428 if (refreshFlag == INFO_REPAINT) {
00429
00430 vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00431 }
00432
00433 vga.use_front();
00434 }
00435
00436
00437
00438
00442
00443 vga.use_back();
00444
00445 int rc = detect2();
00446
00447 vga.use_front();
00448
00449 return rc;
00450 }
00451
00452
00453
00454
00458
00459 if (!report_init_flag)
00460 return 0;
00461
00462 int bottomButtonGroupDetect;
00463 if ((bottomButtonGroupDetect = bottom_button_group.detect()) >= 0) {
00464
00465 (*deinit_func_ptr[current_mode])();
00466
00467
00468 bottom_button_group[current_mode].body_ptr = (void *) (bottom_button_up_bitmap[current_mode] + 4);
00469 current_mode = bottomButtonGroupDetect;
00470 bottom_button_group[current_mode].body_ptr = (void *) (bottom_button_down_bitmap[current_mode] + 4);
00471
00472
00473 sys.redraw_all_flag = 1;
00474
00475 return 1;
00476 }
00477
00478 if ((*detect_func_ptr[current_mode])())
00479 return 1;
00480
00481 return 0;
00482 }
00483
00484
00485
00486
00488
00489
00490
00491 static int numSeriesData=HISTORY_MONTH_COUNT;
00492 static int dataArray[] = {18000, 23000, 65000};
00493 static float dataArray2[2*HISTORY_MONTH_COUNT];
00494 static int dataArray3[] = {19000, 20000, 39000};
00495 static float v1=11,v2=0;
00496 static int sliderVar1=0,sliderVar2=0,sliderVar3=0;
00497 static int xStart = 1991, xEnd = 1998;
00498 static double total;
00499
00500 const static tab1=REPORT_X1+10;
00501 const static tab2=REPORT_X1+360;
00502 const static tab3=REPORT_X1+365;
00503 const static tab4=REPORT_X1+710;
00504 const static vtab1=REPORT_Y1;
00505 const static vtab2=REPORT_Y1+180;
00506 const static vtab3=REPORT_Y1+185;
00507 const static vtab4=REPORT_Y1+345;
00508
00509
00510 #if(GAME_VERSION>=200)
00511 static int initialSliderVar1=0,initialSliderVar2=0,initialSliderVar3=0;
00512
00513
00514
00515 initialSliderVar1=investment_office.initial_asset_array0_allocation_percent;
00516 initialSliderVar2=investment_office.initial_asset_array1_allocation_percent;
00517 initialSliderVar3=investment_office.initial_asset_array2_allocation_percent;
00518 #endif
00519
00520
00521 sliderVar1=investment_office.asset_array[0].allocation_percent;
00522 sliderVar2=investment_office.asset_array[1].allocation_percent;
00523 sliderVar3=investment_office.asset_array[2].allocation_percent;
00524 dataArray[0]=sliderVar1;
00525 dataArray[1]=sliderVar2;
00526 dataArray[2]=sliderVar3;
00527
00528 for(int i=0;i<HISTORY_MONTH_COUNT;i++) {
00529
00530
00531 dataArray2[i]=investment_office.endowment_performance_history[i];
00532 }
00533 if (refreshFlag == INFO_REPAINT) {
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557 user_interface.brighten(tab1,vtab1+15,tab4,vtab4);
00558
00559 #if(GAME_VERSION>=200)
00560 user_interface.rect(tab1,vtab1+15,tab4,vtab2);
00561 #else
00562 user_interface.rect(tab1,vtab1+15,tab3,vtab2);
00563 user_interface.rect(tab3-2,vtab1+15,tab4,vtab2);
00564 #endif
00565
00566 user_interface.rect(tab1,vtab2-2,tab4,vtab4);
00567 user_interface.rect( tab1+5,vtab1+25,
00568 tab1+MODE_INVESTMENT_GRAPH_WIDTH,
00569 vtab1+MODE_INVESTMENT_GRAPH_HEIGHT+5);
00570 user_interface.brighten(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10);
00571 user_interface.rect(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10,1);
00572 font_charts.put(REPORT_X1+315,REPORT_Y1-7,"Asset Allocation");
00573
00574 if (mode_init_flag != MODE_INVESTMENT) {
00575
00576 mode_init_flag= MODE_INVESTMENT;
00577
00578
00579
00580
00581
00582
00583
00584 mode_investment_piechart.init(
00585 tab1+5,vtab1+25,
00586 tab1+MODE_INVESTMENT_GRAPH_WIDTH,
00587 vtab1+MODE_INVESTMENT_GRAPH_HEIGHT+5,
00588 3, dataArray, &xStart, &xEnd,
00589 NULL, NULL, NULL, 1, 1, 0, 23);
00590
00591 mode_investment_slider1.init(
00592 tab1+180,vtab1+45,
00593 MODE_INVESTMENT_GRAPH_WIDTH,
00594 15,
00595 0,100,&sliderVar1,0,
00596 (mode_investment_piechart.series_color)[0],
00597 3);
00598 mode_investment_slider2.init(
00599 tab1+180,vtab1+100,
00600 MODE_INVESTMENT_GRAPH_WIDTH,
00601 15,
00602 0,100,&sliderVar2,0,
00603 (mode_investment_piechart.series_color)[1],
00604 3);
00605 mode_investment_slider3.init(
00606 tab1+180,vtab1+155,
00607 MODE_INVESTMENT_GRAPH_WIDTH,
00608 15,
00609 0,100,&sliderVar3,0,
00610 (mode_investment_piechart.series_color)[2],
00611 3);
00612
00613 mode_investment_graph_snp.init(
00614 tab1,vtab2-2,tab4,vtab4,
00615 1, &numSeriesData, dataArray2, 2,
00616
00617 NULL, NULL, mode_investment_legend_label, 1, 1, 1, 23
00618 );
00619
00620 mode_investment_piechart.paint();
00621
00622
00623
00624 }
00625 else {
00626
00627 user_interface.brighten(tab1,vtab1+15,tab4,vtab4);
00628 user_interface.rect(tab1,vtab1+15,tab3,vtab2);
00629 user_interface.rect(tab3-2,vtab1+15,tab4,vtab2);
00630 user_interface.rect(tab1,vtab2-2,tab4,vtab4);
00631
00632
00633
00634
00635
00636 mode_investment_piechart.paint();
00637 mode_investment_slider1.paint();
00638 mode_investment_slider2.paint();
00639 mode_investment_slider3.paint();
00640 }
00641 mode_investment_graph_snp.paint();
00642
00643
00644
00645 font_chartsm.put(
00646 tab1+190,vtab1+25,
00647 "Large company stock");
00648 font_chartsm.put(
00649 tab1+190,vtab1+80,
00650 "Small company stock");
00651 font_chartsm.put(
00652 tab1+190,vtab1+135,
00653 "Bonds");
00654 user_interface.bar(
00655 tab1+160,vtab1+25,tab1+172,vtab1+37,
00656 ((mode_investment_piechart.series_color)[0]));
00657 user_interface.bar(
00658 tab1+160,vtab1+80,tab1+172,vtab1+92,
00659 ((mode_investment_piechart.series_color)[1]));
00660 user_interface.bar(
00661 tab1+160,vtab1+135,tab1+172,vtab1+147,
00662 ((mode_investment_piechart.series_color)[2]));
00663
00664
00665 #if(GAME_VERSION>=200)
00666 font_chart_purple_sm.put(tab3,
00667 vtab1+45,
00668 "Initial : ");
00669 font_chart_purple_sm.put(tab3 + 45,
00670 vtab1+45,
00671 m.format(initialSliderVar1, 3));
00672
00673 font_chart_purple_sm.put(tab3,
00674 vtab1+100,
00675 "Initial : ");
00676 font_chart_purple_sm.put(tab3 + 45,
00677 vtab1+100,
00678 m.format(initialSliderVar2, 3));
00679 font_chart_purple_sm.put(tab3,
00680 vtab1+155,
00681 "Initial : ");
00682 font_chart_purple_sm.put(tab3 + 45,
00683 vtab1+155,
00684 m.format(initialSliderVar3, 3));
00685 #endif
00686
00687 }
00688 else {
00689
00690
00691
00692
00693
00694 mode_investment_piechart.refresh();
00695
00696 vga.blt_buf(
00697 tab1+5,vtab1+25,
00698 tab1+MODE_INVESTMENT_GRAPH_WIDTH,
00699 vtab1+MODE_INVESTMENT_GRAPH_HEIGHT+5
00700 );
00701
00702 mode_investment_slider1.refresh();
00703 mode_investment_slider2.refresh();
00704 mode_investment_slider3.refresh();
00705
00706
00707
00708
00709 mode_investment_graph_snp.refresh();
00710 vga.blt_buf(
00711 tab1,vtab2-2,tab4,vtab4
00712 );
00713
00714
00715
00716
00717
00718
00719 }
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733 }
00734
00735
00737
00738
00739
00740
00741 static int v11=1000,v12=1999,v13=8888;
00742 static double v21=663.23,v22=123.23,v23=17.23,v24=723.23,v25=13.23;
00743 static double v31=813.83,v32=888.23,v33=13.83,v34=188.23,v35=183.23;
00744 static double v41=88.28,v42=777.23,v43=166.27,v44=777.23,v45=173.23;
00745 static int sliderVar1=0;
00746 static float v1;
00747 static int v2;
00748 static float spinnerVar1=0.0;
00749 static int numSeriesData = P_HISTORY_YEAR_COUNT;
00750 static int dataArray[3*P_HISTORY_YEAR_COUNT];
00751 static int xStart = 1991, xEnd = 1998;
00752 const static tab1=REPORT_X1+10;
00753 const static tab2=REPORT_X1+360;
00754 const static tab3=REPORT_X1+365;
00755 const static tab4=REPORT_X1+710;
00756 const static vtab1=REPORT_Y1;
00757 const static vtab2=REPORT_Y1+165;
00758 const static vtab3=REPORT_Y1+170;
00759 const static vtab4=REPORT_Y1+330;
00760
00761
00762 #if(GAME_VERSION>=200)
00763 static double initialv21=663.23;
00764 static double initialv31=813.83;
00765 static double initialv41=88.28;
00766 #endif
00767
00768
00769
00770
00771
00772
00773 for(int i=0;i<numSeriesData;i++) {
00774 dataArray[i]=investment_office.endowment_spending_history[2][i];
00775 dataArray[i+numSeriesData]=investment_office.endowment_spending_history[1][i];
00776 dataArray[i+2*numSeriesData]=investment_office.endowment_spending_history[0][i];
00777 }
00778
00779 xStart = info.game_year-numSeriesData+1;
00780 xEnd = info.game_year;
00781
00782 v12=info.financial_year();
00783 v11=v12-1;
00784 v13=v12+1;
00785
00786
00787 int x = AC_ENDOWMENT_SPENDING;
00788 v21=finance.revenue_array[x].total;
00789 v23=finance.projected_revenue_array[x].this_year.total;
00790 v22 = finance.calc_change(v23,v21);
00791
00792 v24=finance.projected_revenue_array[x].change_next_year.total;
00793 v25=finance.projected_revenue_array[x].next_year.total;
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805 {
00806 #if(GAME_VERSION>=200)
00807 double l = finance.last_year.asset_array[AC_ENDOWMENT]+finance.last_year.asset_array[AC_QUASI];
00808 double t = finance.this_year.asset_array[AC_ENDOWMENT]+finance.this_year.asset_array[AC_QUASI];
00809 double n = finance.next_year.asset_array[AC_ENDOWMENT]+finance.this_year.asset_array[AC_QUASI];
00810 #else
00811 double l = finance.last_year.asset_array[AC_ENDOWMENT];
00812 double t = finance.this_year.asset_array[AC_ENDOWMENT];
00813 double n = finance.next_year.asset_array[AC_ENDOWMENT];
00814 #endif
00815
00816 v31 = l;
00817 v32 = finance.calc_change(t,l);
00818 v33 = t;
00819 v34 = finance.calc_change(n,t);
00820 v35 = n;
00821
00822
00823
00824 l=development_office.last_year.endowment;
00825 t=development_office.this_year.endowment;
00826 n=development_office.this_year.endowment;
00827
00828 v41 = l;
00829 v42 = finance.calc_change(t,l);
00830 v43 = t;
00831 v44 = finance.calc_change(n,t);
00832 v45 = n;
00833 }
00834
00835
00836
00837
00838 #if(GAME_VERSION>=200)
00839 initialv21 = finance.initial_revenue_array[AC_ENDOWMENT_SPENDING].total;
00840 initialv31 = finance.initial_last_year.asset_array[AC_ENDOWMENT];
00841
00842 initialv41 = development_office.initial_last_year_endowment;
00843 #endif
00844
00845
00847
00848
00849 v1 = (float)finance.revenue_policy_array[PL_ENDOWMENT_SPENDING_RATE].result_value;
00850
00851 v2=investment_office.degree_smoothing_for_endowment_payout;
00852 int field_space=5*font_chartsm.max_font_width;
00853
00854 if (refreshFlag == INFO_REPAINT) {
00855 user_interface.brighten(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+8);
00856 user_interface.rect(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+8,1);
00857 font_charts.put(REPORT_X1+310,REPORT_Y1-8,"The Endowment");
00858
00859 if (mode_init_flag != MODE_FINANCIAL) {
00860
00861
00862
00863 mode_init_flag = MODE_FINANCIAL;
00864
00865
00866 user_interface.brighten(REPORT_X1, REPORT_Y1+10, REPORT_X2, REPORT_Y2);
00867 user_interface.rect(REPORT_X1, REPORT_Y1+10, REPORT_X2, REPORT_Y1+MODE_FINANCIAL_BOX1_HEIGHT+2);
00868 user_interface.rect(REPORT_X1, REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT-2, REPORT_X1+MODE_FINANCIAL_TAB4-82, REPORT_Y2);
00869 user_interface.rect(REPORT_X1+MODE_FINANCIAL_TAB4-85, REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT-2, REPORT_X2, REPORT_Y2);
00870
00871 for (int i = 0; i < 3; i++) {
00872 financial_button_up_bitmap[i] = NULL;
00873 financial_button_down_bitmap[i] = NULL;
00874 }
00875
00876 short y = FINANCIAL_BUTTON_Y1;
00877 for (i = 0; i < 3; i++, y+=FINANCIAL_BUTTON_HEIGHT+FINANCIAL_BUTTON_DISTANCE) {
00878 user_interface.create_button_bitmap(FINANCIAL_BUTTON_X1,y,
00879 FINANCIAL_BUTTON_X1+FINANCIAL_BUTTON_WIDTH,y+FINANCIAL_BUTTON_HEIGHT,
00880 financial_button_label[i], &financial_button_up_bitmap[i],
00881 &financial_button_down_bitmap[i], &vga_back);
00882
00883 financial_button_group[i].create_bitmapW(FINANCIAL_BUTTON_X1,y,
00884 FINANCIAL_BUTTON_X1+FINANCIAL_BUTTON_WIDTH,y+FINANCIAL_BUTTON_HEIGHT,
00885 (financial_button_up_bitmap[i])+4,0);
00886 }
00887
00888 financial_spinner_budget.init(
00889 REPORT_X1+MODE_FINANCIAL_TAB5-40,
00890 REPORT_Y1+MODE_FINANCIAL_BOX1_HEIGHT+125,
00891 REPORT_X1+MODE_FINANCIAL_TAB5+80,
00892 REPORT_Y1+MODE_FINANCIAL_BOX1_HEIGHT+155,
00893
00894 &investment_office.spinner_var1,
00895
00896
00897
00898 -10.0f,10.0f,0.1f,0,NULL,25);
00899
00900 mode_financial_graph_profitloss.init(
00901 REPORT_X1, REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT-2, REPORT_X1+MODE_FINANCIAL_TAB4-82, REPORT_Y2,
00902 3, &numSeriesData, dataArray, 1,
00903 NULL, NULL, mode_financial_legend_label, 1, 1, 1, 2);
00904
00905
00906
00907
00908 mode_financial_text.put(tab3+280,vtab3+16,&v1,24);
00909
00910 mode_financial_rbv.init(
00911 REPORT_X1+MODE_FINANCIAL_TAB4+10,
00912 REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT+23,
00913 REPORT_X2,
00914 REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT+73,
00915 3,
00916 &v2,
00917 mode_financial_rbvlabel,
00918 NULL
00919 );
00920 }
00921 else {
00922
00923 user_interface.brighten(REPORT_X1, REPORT_Y1+10, REPORT_X2, REPORT_Y2);
00924 user_interface.rect(REPORT_X1, REPORT_Y1+10, REPORT_X2, REPORT_Y1+MODE_FINANCIAL_BOX1_HEIGHT+2);
00925 user_interface.rect(REPORT_X1, REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT-2, REPORT_X1+MODE_FINANCIAL_TAB4-82, REPORT_Y2);
00926 user_interface.rect(REPORT_X1+MODE_FINANCIAL_TAB4-85, REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT-2, REPORT_X2, REPORT_Y2);
00927
00928 financial_spinner_budget.paint();
00929 for(int i=0;i<3;i++)
00930 financial_button_group[i].paint();
00931 }
00932
00933 mode_financial_graph_profitloss.paint();
00934
00935
00936 font_chartsm.put(REPORT_X1+MODE_FINANCIAL_TAB1, REPORT_Y1+40, mode_financial_str[0]);
00937 font_chartsm.put(REPORT_X1+MODE_FINANCIAL_TAB1, REPORT_Y1+60, mode_financial_str[1]);
00938 font_chartsm.put(REPORT_X1+MODE_FINANCIAL_TAB1, REPORT_Y1+80, mode_financial_str[2]);
00939 font_chartsm.put(
00940 REPORT_X1+MODE_FINANCIAL_TAB3+25,REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT+5,
00941 "Degree of smoothing for endowment spending");
00942
00943 font_chartsm.put(
00944 REPORT_X1+MODE_FINANCIAL_TAB3+25,vtab3+15,
00945 "Current endowment spending rate");
00946
00947 font_chartsm.put(
00948 REPORT_X1+MODE_FINANCIAL_TAB3+25,vtab3+35,
00949 "Change in endowment spending rate");
00950
00951 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB3+field_space,
00952 REPORT_Y1+15,
00953 mode_financial_str[4]);
00954
00955 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB5+field_space,
00956 REPORT_Y1+15,
00957 mode_financial_str[4]);
00958
00959 font_chartsm.put_paragraph(
00960 REPORT_X1+MODE_FINANCIAL_TAB4+30,
00961 REPORT_Y1+30+MODE_FINANCIAL_BOX1_HEIGHT,
00962 REPORT_X2,
00963 REPORT_Y1+60+MODE_FINANCIAL_BOX1_HEIGHT,
00964 mode_financial_str[5]);
00965 mode_financial_stats_bitmap=NULL;
00966 mode_financial_stats_bitmap=vga_back.save_area(
00967 REPORT_X1+MODE_FINANCIAL_TAB2, REPORT_Y1,
00968 REPORT_X2, REPORT_Y1+MODE_FINANCIAL_BOX1_HEIGHT,
00969 mode_financial_stats_bitmap);
00970
00971 }
00972 else {
00973
00974
00975
00976
00977
00978 mode_financial_graph_profitloss.refresh();
00979 vga.blt_buf(
00980 REPORT_X1, REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT,
00981 REPORT_X1+MODE_FINANCIAL_TAB4-90, REPORT_Y2
00982 );
00983
00984 mode_financial_text.refresh();
00985 mode_financial_rbv.refresh();
00986
00987 }
00988
00989 financial_spinner_budget.refresh();
00990 int pressed=finance.get_policy_var(true, AC_ENDOWMENT_SPENDING)->applied_flag;
00991 if(pressed==P_NONE)
00992 for(int i=0;i<3;i++)
00993 financial_button_group[i].paint();
00994 else
00995 financial_button_group.paint(pressed-1);
00996 short y = FINANCIAL_BUTTON_Y1;
00997 for (i = 0; i < 3; i++, y+=FINANCIAL_BUTTON_HEIGHT+FINANCIAL_BUTTON_DISTANCE) {
00998 vga.blt_buf(FINANCIAL_BUTTON_X1,y,
00999 FINANCIAL_BUTTON_X1+FINANCIAL_BUTTON_WIDTH,y+FINANCIAL_BUTTON_HEIGHT);
01000 }
01001
01002 vga_back.rest_area(mode_financial_stats_bitmap,0,0);
01003 String *s1,*s2;
01004
01005
01006
01007 s1=new String(m.format(v11,16));
01008 s2=new String(m.format(v11+1,16));
01009
01010 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2+field_space,
01011 REPORT_Y1+15,
01012 s1->str_buf);
01013
01014 (*s1)=m.format(v12,16);
01015 (*s2)=m.format(v12+1,16);
01016
01017 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB4+field_space,
01018 REPORT_Y1+15,
01019 s1->str_buf);
01020
01021 (*s1)=m.format(v13,16);
01022 (*s2)=m.format(v13+1,16);
01023 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB6+field_space,
01024 REPORT_Y1+15,
01025 s1->str_buf);
01026
01027 delete s1,s2;
01028
01029
01030
01031 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2+field_space,
01032 REPORT_Y1+40,
01033 m.format(v21, 2));
01034 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2+field_space,
01035 REPORT_Y1+60,
01036 m.format(v31, 2));
01037
01038 if((v41)>=0) {
01039 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2+field_space,
01040 REPORT_Y1+80,
01041 m.format(v41, 2));
01042 }
01043 else {
01044 font_chart_red_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2+field_space,
01045 REPORT_Y1+80,
01046 m.format(v41, 2));
01047 }
01048
01049
01050
01051 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB3+field_space,
01052 REPORT_Y1+40,
01053 m.format(v22, 24));
01054
01055 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB3+field_space,
01056 REPORT_Y1+60,
01057 m.format(v32, 24));
01058
01059 if((v42)>=0) {
01060 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB3+field_space,
01061 REPORT_Y1+80,
01062 m.format(v42, 24));
01063 }
01064 else {
01065 font_chart_red_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB3+field_space,
01066 REPORT_Y1+80,
01067 m.format(v42, 24));
01068 }
01069
01070
01071
01072 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB4+field_space,
01073 REPORT_Y1+40,
01074 m.format(v23, 2));
01075
01076 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB4+field_space,
01077 REPORT_Y1+60,
01078 m.format(v33, 2));
01079
01080 if((v43)>=0)
01081 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB4+field_space,
01082 REPORT_Y1+80,
01083 m.format(v43, 2));
01084 else
01085 font_chart_red_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB4+field_space,
01086 REPORT_Y1+80,
01087 m.format(v43, 2));
01088
01089
01090
01091 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB5+field_space,
01092 REPORT_Y1+40,
01093 m.format(v24, 24));
01094
01095 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB5+field_space,
01096 REPORT_Y1+60,
01097 m.format(v34, 24));
01098
01099 if((v44)>=0)
01100 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB5+field_space,
01101 REPORT_Y1+80,
01102 m.format(v44, 24));
01103 else
01104 font_chart_red_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB5+field_space,
01105 REPORT_Y1+80,
01106 m.format(v44, 24));
01107
01108
01109
01110 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB6+field_space,
01111 REPORT_Y1+40,
01112
01113
01114 m.format(v25, 2));
01115 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB6+field_space,
01116 REPORT_Y1+60,
01117
01118
01119 m.format(v35, 2));
01120
01121 if((v45)>=0)
01122 font_chartsm.right_put( REPORT_X1+MODE_FINANCIAL_TAB6+field_space,
01123 REPORT_Y1+80,
01124
01125
01126 m.format(v45, 2));
01127 else
01128 font_chart_red_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB6+field_space,
01129 REPORT_Y1+80,
01130
01131
01132 m.format(v45, 2));
01133
01134
01135 #if(GAME_VERSION>=200)
01136 if (info.financial_year() > 1) {
01137 font_chart_purple_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2,
01138 REPORT_Y1+15,
01139 "Yr. 0 (Initial)");
01140 font_chart_purple_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2,
01141 REPORT_Y1+40,
01142 m.format(initialv21, 2));
01143 font_chart_purple_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2,
01144 REPORT_Y1+60,
01145 m.format(initialv31, 2));
01146 font_chart_purple_sm.right_put( REPORT_X1+MODE_FINANCIAL_TAB2,
01147 REPORT_Y1+80,
01148 m.format(initialv41, 2));
01149 }
01150 #endif
01151
01152
01153 vga.blt_buf(REPORT_X1+MODE_FINANCIAL_TAB2, REPORT_Y1,
01154 REPORT_X2, REPORT_Y1+MODE_FINANCIAL_BOX1_HEIGHT);
01155
01156 for(i=0;i<3;i++) {
01157 financial_button_group[i].pop();
01158 financial_button_group[i].body_ptr=
01159 (void*)(financial_button_up_bitmap[i]+4);
01160 }
01161 }
01162
01163
01164
01165 #if(GAME_VERSION>=200)
01166
01167 static void report_transfer(int refreshFlag) {
01168 const static tab1=REPORT_X1+10;
01169 const static tab2=REPORT_X1+360;
01170 const static tab3=REPORT_X1+365;
01171 const static tab4=REPORT_X1+710;
01172 const static vtab1=REPORT_Y1;
01173 const static vtab2=REPORT_Y1+180;
01174 const static vtab3=REPORT_Y1+185;
01175 const static vtab4=REPORT_Y1+345;
01176
01177 if (refreshFlag == INFO_REPAINT) {
01178
01179 if ( mode_init_flag != MODE_TRANSFER ) {
01180 mode_init_flag = MODE_TRANSFER;
01181
01182 user_interface.brighten(tab1,vtab1+15,tab4,vtab4);
01183
01184 #if(GAME_VERSION>=200)
01185
01186 user_interface.rect(tab1,vtab1+15,tab4,vtab2);
01187 #else
01188 user_interface.rect(tab1,vtab1+15,tab3,vtab2);
01189 user_interface.rect(tab3-2,vtab1+15,tab4,vtab2);
01190 #endif
01191
01192 user_interface.rect(tab1,vtab2-2,tab4,vtab4);
01193 user_interface.brighten(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10);
01194 user_interface.rect(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10,1);
01195 font_charts.put(REPORT_X1+195,REPORT_Y1-7,"Transfer of funds from the operating reserve");
01196
01197 font_chartsm.put( 100, vtab1+20+25, "Transfer from:" );
01198 font_chartsm.put( 380, vtab1+20+25, "Transfer to:" );
01199
01200 transfer_from.init(200,vtab1+20+25,320,218,3,&sel_from,transfer_label,NULL);
01201 transfer_to.init(460,vtab1+20+25,580,218,3,&sel_to,transfer_label,NULL);
01202
01203 font_chartsm.put( 140, 280, "Amount to transfer( percentage of the current source account balance):" );
01204
01205 transfer_per_spinner.init(
01206 140,
01207 305,
01208 260,
01209 335,
01210
01211 &spinner_val,
01212
01213
01214 0.0f,95.0f,5.0f,0,NULL,25);
01215
01216 transfer_per_spinner.paint();
01217
01218 implement_button.create_text( 140,
01219 350,
01220 260,
01221 380,
01222 "Implement now" );
01223
01224 implement_button.paint();
01225 }
01226 }
01227 else {
01228 transfer_from.refresh();
01229 transfer_to.refresh();
01230 }
01231
01232 transfer_per_spinner.refresh();
01233 }
01234
01235
01236 #endif
01237
01238
01240
01241 if (mode_init_flag != MODE_INVESTMENT)
01242 return 0;
01243 double sliderVar1,sliderVar2,sliderVar3,total;
01244
01245 vga.use_back();
01246 if(mode_investment_slider1.detect()) {
01247 sliderVar1=*(mode_investment_slider1.var_ptr);
01248 sliderVar2=*(mode_investment_slider2.var_ptr);
01249 sliderVar3=*(mode_investment_slider3.var_ptr);
01250 total=sliderVar2+sliderVar3;
01251 if(total>1E-9) {
01252 *(mode_investment_slider2.var_ptr)=
01253 (int)((100.0-sliderVar1)*(sliderVar2/total));
01254 }
01255 else {
01256 *(mode_investment_slider2.var_ptr)=
01257 (int)(50-sliderVar1/2);
01258 }
01259 *(mode_investment_slider3.var_ptr)=
01260 100-*(mode_investment_slider1.var_ptr)-
01261 *(mode_investment_slider2.var_ptr);
01262 investment_office.asset_array[0].allocation_percent=*(mode_investment_slider1.var_ptr);
01263 investment_office.asset_array[1].allocation_percent=*(mode_investment_slider2.var_ptr);
01264 investment_office.asset_array[2].allocation_percent=*(mode_investment_slider3.var_ptr);
01265 return 1;
01266 }
01267 if(mode_investment_slider2.detect()) {
01268 sliderVar1=*(mode_investment_slider1.var_ptr);
01269 sliderVar2=*(mode_investment_slider2.var_ptr);
01270 sliderVar3=*(mode_investment_slider3.var_ptr);
01271 total=sliderVar1+sliderVar3;
01272 if(total>1E-9) {
01273 *(mode_investment_slider1.var_ptr)=
01274 (int)((100.0-sliderVar2)*(sliderVar1/total));
01275 }
01276 else {
01277 *(mode_investment_slider1.var_ptr)=
01278 (int)(50-sliderVar2/2);
01279 }
01280 *(mode_investment_slider3.var_ptr)=
01281 100-*(mode_investment_slider1.var_ptr)-
01282 *(mode_investment_slider2.var_ptr);
01283 investment_office.asset_array[0].allocation_percent=*(mode_investment_slider1.var_ptr);
01284 investment_office.asset_array[1].allocation_percent=*(mode_investment_slider2.var_ptr);
01285 investment_office.asset_array[2].allocation_percent=*(mode_investment_slider3.var_ptr);
01286 return 1;
01287 }
01288 if(mode_investment_slider3.detect()) {
01289 sliderVar1=*(mode_investment_slider1.var_ptr);
01290 sliderVar2=*(mode_investment_slider2.var_ptr);
01291 sliderVar3=*(mode_investment_slider3.var_ptr);
01292 total=sliderVar1+sliderVar2;
01293 if(total>1E-9) {
01294 *(mode_investment_slider1.var_ptr)=
01295 (int)((100.0-sliderVar3)*(sliderVar1/total));
01296 }
01297 else {
01298 *(mode_investment_slider1.var_ptr)=
01299 (int)(50-sliderVar3/2);
01300 }
01301 *(mode_investment_slider2.var_ptr)=
01302 100-*(mode_investment_slider1.var_ptr)-
01303 *(mode_investment_slider3.var_ptr);
01304 investment_office.asset_array[0].allocation_percent=*(mode_investment_slider1.var_ptr);
01305 investment_office.asset_array[1].allocation_percent=*(mode_investment_slider2.var_ptr);
01306 investment_office.asset_array[2].allocation_percent=*(mode_investment_slider3.var_ptr);
01307 return 1;
01308 }
01309
01310 return 0;
01311 }
01312
01313
01314
01315
01317
01318 if (mode_init_flag != MODE_FINANCIAL)
01319 return 0;
01320 const static vtab3=REPORT_Y1+170;
01321
01322 vga.use_front();
01323
01324 help.set_help(
01325 REPORT_X1+MODE_FINANCIAL_TAB3+25,REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT+5,
01326 REPORT_X1+MODE_FINANCIAL_TAB3+305,REPORT_Y2-MODE_FINANCIAL_BOX2_HEIGHT+85,"A.1.1.1.");
01327 help.set_help(
01328 REPORT_X1+MODE_FINANCIAL_TAB3+25,vtab3+35,
01329 REPORT_X1+MODE_FINANCIAL_TAB3+305,vtab3+55,"A.1.1.2.");
01330
01331 if(mode_financial_rbv.detect()) {
01332 investment_office.degree_smoothing_for_endowment_payout=*(mode_financial_rbv.sel_num);
01333 return 1;
01334 }
01335
01336 if (financial_spinner_budget.detect())
01337 return 1;
01338
01339 for(int i=0;i<3;i++)
01340 if(financial_button_group[i].detect()) {
01341 financial_button_group[i].body_ptr =
01342 (void *) (financial_button_down_bitmap[i] + 4);
01343
01344
01345 finance.change_budget(i,true, AC_ENDOWMENT_SPENDING,(*financial_spinner_budget.var_ptr));
01346
01347 *financial_spinner_budget.var_ptr=0;
01348
01349 }
01350
01351 return 0;
01352 }
01353
01354
01355
01356 #if(GAME_VERSION>=200)
01357
01359
01360 if (transfer_from.detect()) {
01361 sel_from
01362 =*(transfer_from.sel_num);
01363 return 1;
01364 }
01365
01366 if (transfer_to.detect()) {
01367 sel_to
01368 = *(transfer_to.sel_num);
01369 return 1;
01370 }
01371
01372 if ( transfer_per_spinner.detect() )
01373 return 1;
01374
01375 if ( implement_button.detect() ) {
01376
01377 if ( transfer_to.sel_num == transfer_from.sel_num )
01378 return 1;
01379
01380 char selFrom[123];
01381 char selTo[123];
01382
01383 switch( *transfer_from.sel_num ) {
01384 case 0: strcpy( selFrom, "Operating reserve" ); break;
01385 case 1: strcpy( selFrom, "Facilities reserve" ); break;
01386 case 2: strcpy( selFrom, "Quasi endowment" ); break;
01387 }
01388
01389 switch( *transfer_to.sel_num ) {
01390 case 0: strcpy( selTo, "Operating reserve" ); break;
01391 case 1: strcpy( selTo, "Facilities reserve" ); break;
01392 case 2: strcpy( selTo, "Quasi endowment" ); break;
01393 }
01394
01395 int selFromA, selToA;
01396 int transferMoney;
01397
01398 switch (*transfer_from.sel_num) {
01399 case 0: transferMoney = finance.this_year.asset_array[AC_OPERATING_RESERVE]*(*(transfer_per_spinner.var_ptr))/100;
01400 selFromA = finance.this_year.asset_array[AC_OPERATING_RESERVE]-transferMoney;
01401 break;
01402 case 1: transferMoney = finance.this_year.asset_array[AC_CAPITAL_RESERVE]*(*(transfer_per_spinner.var_ptr))/100;
01403 selFromA = finance.this_year.asset_array[AC_CAPITAL_RESERVE]-transferMoney;
01404 break;
01405 case 2: transferMoney = finance.this_year.asset_array[AC_QUASI]*(*(transfer_per_spinner.var_ptr))/100;
01406 selFromA = finance.this_year.asset_array[AC_QUASI]-transferMoney;
01407 break;
01408 }
01409
01410 switch (*transfer_to.sel_num) {
01411 case 0: selToA = finance.this_year.asset_array[AC_OPERATING_RESERVE] + transferMoney;
01412 break;
01413 case 1: selToA = finance.this_year.asset_array[AC_CAPITAL_RESERVE] + transferMoney;
01414 break;
01415 case 2: selToA = finance.this_year.asset_array[AC_QUASI] + transferMoney;
01416 break;
01417 }
01418
01419 char askStr[128];
01420 sprintf( askStr, "Do you want to transfer $%d? After the transfer, the %s will contain $%d and the %s will contain $%d.", transferMoney, selFrom, selFromA, selTo, selToA );
01421
01422 if ( !box.ask( askStr ) )
01423 <