Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

Oinfo.cpp Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Oinfo.cpp

Go to the documentation of this file.
00001 //Filename: OINFO.CPP
00002 //Description : Info class
00003 
00004 #include <time.h>
00005 #include <ALL.H>
00006 #include <ODATE.H>
00007 #include <OINFO.H>
00008 #include <OIMGRES.H>
00009 #include <OMISC.H>
00010 #include <OMUSIC.H>
00011 #include <OMOUSE.H>
00012 #include <OMOUSECR.H>
00013 #include <OFIRMRES.H>
00014 #include <OSTR.H>
00015 #include <OSYS.H>
00016 #include <OVGA.H>
00017 #include <OFONT.H>
00018 #include <ODEPT.H>
00019 #include <OFIRM.H>
00020 #include <OWORLD.H>
00021 #include <OSTUDENT.H>
00022 #include <OFACULTY.H>
00023 #include <OCOURSE.H>
00024 #include <OSCHOOL.H>
00025 #include <OPSCHOOL.H>
00026 #include <OSCHLRES.H>
00027 #include <OCOLTBL.H>
00028 #include <OFINANCE.H>
00029 #include <OAthleti.h>
00030 #include <ODEVELOP.H>
00031 #include <OFACILIT.H>
00032 #include <OLIBTECH.H>
00033 #include <OINVEST.H>                              //##### fred 981016 #####//
00034 #include <ODEPTRES.H>
00035 #include <OENROLL.H>                              //##### fred 980908 #####//
00036 #include <OSTUOFF.H>                              //##### fred 980908 #####//
00037 #include <OTEXT.H>                                //##### chw 981014 #####//
00038 #include <OTASK.H>                                //##### fred 981015 #####//
00039 #include <OCHANCE.H>                              //##### fred 981015 #####//
00040 #include <OCONFIG.H>                              //##### chea 140799 #####//
00041 #include <OBOX.H>
00042 #include <OLETTER.H>                              //##### chea 140799 #####//
00043 #include <OMATH.H>                                //##### chea 240100 #####//
00044 
00045 //---------- define constant ------------//
00046 
00047 #define DATE_BMP_RES_FILE_NAME    DIR_RES"I_DATE.RES"
00048 
00049 //---------- define static variables ------------//
00050 
00051 static int last_month = 0, last_year = 0, last_day = 0;
00052 static short digit_y1, year_x1_1, year_x1_2, day_x1_0, day_x1_1, day_x1_2;
00053 
00054 //--------- define marco function ----------//
00055 
00056 #define YIELD { if ( info.game_day == 1 ) sys.yield(); }
00057 
00058 //------- declare static function ----------//
00059 
00060 static void update_faculty_count();
00061 
00062 //-------- Begin of function Info::Info --------//
00064 Info::Info() {
00065     disp_6_graphs_flag=true;
00066 }
00067 
00068 //--------- End of function Info::Info ---------//
00069 
00070 //-------- Begin of function Info::~Info --------//
00072 Info::~Info() {
00073     deinit();
00074 }
00075 
00076 //--------- End of function Info::~Info ---------//
00077 
00078 //-------- Begin of function Info::init --------//
00080 void Info::init() {
00081     deinit();
00082 #define GAME_START_YEAR 1
00083     game_day   = 1;
00084     game_month = 9;
00085     game_year  = GAME_START_YEAR;                   // may have bug if 99!!!
00086 
00087     game_start_date = date.julian( game_year, game_month, game_day );
00088 
00089     game_date  = game_start_date;
00090     year_day   = date.day_year( game_year, game_month, game_day );
00091 
00092     year_passed= 1;                                 // no. of years has been passed since the game begins
00093 
00094     //#### begin fred 0911 ####//
00095     graph_year_passed = 1;
00096     graph_month_passed = 1;                         // see next_day() also
00097     graph_trimester_passed = 1;
00098 
00099     graph_year = 3;                                 // previous, this and next year on graph
00100     graph_month = 3;
00101     graph_trimester = 3;
00102     //#### end fred 0911 ####//
00103 
00104     //----------------------------------//
00105 
00106     start_play_time = m.get_time();                 // the time player start playing the game
00107     total_play_time = 0;                            // total time the player has played in all saved games
00108 
00109     //############### begin Norris 0706 ##############//
00110 
00111     date_res_bitmap.init(DATE_BMP_RES_FILE_NAME, 1, 0);
00112 
00113     short *shortPtr = (short *) date_res_bitmap.get_ptr("0");
00114     short digitWidth = *shortPtr++;
00115     short digitHeight = *shortPtr;
00116 
00117     digit_y1 = (DIGIT_Y1 + DIGIT_Y2 - digitHeight) / 2;
00118     day_x1_2 = (DAY_X1 + DAY_X2) / 2;
00119     day_x1_1 = day_x1_2 - digitWidth;
00120     day_x1_0 = day_x1_2 - digitWidth / 2;
00121     year_x1_2 = (YEAR_X1 + YEAR_X2) / 2;
00122     year_x1_1 = year_x1_2 - digitWidth;
00123 
00124     //################# end Norris 0706 ##############//
00125 
00126     disp_panel_init();
00127     image_interface.put_large( &vga_back, 0, 0, "MAINSCR" );
00128 }
00129 
00130 //--------- End of function Info::init ---------//
00131 
00132 //-------- Begin of function Info::deinit --------//
00134 void Info::deinit() {
00135     //############### begin Norris 0706 ##############//
00136 
00137     if( top_info_bitmap ) {
00138         mem_del( top_info_bitmap );
00139         top_info_bitmap = NULL;
00140 
00141         mem_del( bottom_info_bitmap );
00142         bottom_info_bitmap = NULL;
00143 
00144         mem_del( surplus_info_bitmap );
00145         surplus_info_bitmap = NULL;
00146 
00147         mem_del( score_info_bitmap );
00148         score_info_bitmap = NULL;
00149 
00150         mem_del( uscore_info_bitmap );
00151         uscore_info_bitmap = NULL;
00152 
00153         mem_del( date_info_bitmap );
00154         mem_del( year_info_bitmap );
00155 
00156         mem_del( top_left_column_bitmap );
00157         mem_del( top_right_column_bitmap );
00158 
00159         mem_del( bottom_left_column_bitmap );
00160         mem_del( bottom_right_column_bitmap );
00161 
00162         mem_del( menu_up_bitmap );
00163         mem_del( menu_down_bitmap );
00164 
00165         mem_del( more_report_bitmap );
00166         more_report_bitmap = NULL;
00167 
00168         mem_del( help_quest_bitmap );
00169         help_quest_bitmap = NULL;
00170 
00171         mem_del( list_button_bitmap );
00172         list_button_bitmap = NULL;
00173 
00174         for (int i = 0; i < REPORT_ITEMS + 1; i++)
00175             mem_del( report_bitmap[i] );
00176     }
00177 
00178     //################# end Norris 0706 ##############//
00179 }
00180 
00181 //--------- End of function Info::deinit ---------//
00182 
00183 //------- Begin of function Info::init_random_seed ------//
00190 void Info::init_random_seed(int randomSeed) {
00191     if( randomSeed )
00192         random_seed = randomSeed;
00193     else {
00194         randomSeed = time(NULL);
00195         randomSeed = (int) _rotr( randomSeed, 4 );
00196         if( randomSeed < 0 )
00197             randomSeed = ~randomSeed;
00198         if( randomSeed == 0 )
00199             randomSeed = 1;
00200         random_seed = randomSeed;
00201     }
00202 
00203     m.set_random_seed(random_seed);
00204 }
00205 
00206 //------- End of function Info::init_random_seed ------//
00207 
00208 //-------- Begin of function Info::next_day ---------//
00209 
00210 void Info::next_day() {
00211     inc_game_day();
00212 
00213     //-------- show waiting mouse cursor it is the beginning of a month -----------//
00214 
00215     int oldCursor;
00216 
00217     if ( game_day == 1 ) {
00218         oldCursor = mouse_cursor.get_icon();
00219         mouse_cursor.set_icon(CURSOR_WAITING);
00220         sys.redraw_all_flag=1;                        // ## chwong0625
00221     }
00222 
00223     //-------- yield player_school ---------//
00224 
00225     player_school.next_day();                       // it must be called first as it set trimester;
00226     // included enrollment's run_student_dropout_graduate()
00227     // next_trimester() will be called and hence dropout, graduate, faculty departure, etc
00228     YIELD;
00229 
00230     //------- call core models' next_day() ------//
00231 
00232     enroll_res.next_day();                          // will recalc student_count
00233 
00234     development_office.next_day();
00235 
00236 #if(GAME_VERSION>=200)
00237 #else
00238     finance.next_day();
00239 #endif
00240 
00241     YIELD;
00242 
00243     //---------------------// course enrollment, after enrollment model
00244 
00245     if ( is_begin_trimester() )
00246         new_trimester_course_enrollment();
00247 
00248 #if(GAME_VERSION>=200)
00249     finance.next_day();                             // should after new_trimester_course_enrollment, to initial variables to calculate net distance learning expenditures
00250 #endif
00251 
00252     YIELD;
00253 
00254     //---- call offices' next_day() functions -----//
00255     // offices which must called after finance.next_day
00256 
00257     facility_office.next_day();                     // should before(!?) course enrollment, after development office, before deparment_array's course_array.next_day()
00258     library_tech_office.next_day();
00259 
00260     athletics_office.next_day();                    // after enrollment
00261     student_office.next_day();
00262     investment_office.next_day();                   // after development_office
00263 
00264     YIELD;
00265 
00266     //---- call data array next_day() functions -----//
00267     // should(?) after all offices for calc pi
00268 
00269     department_array.next_day();                    // after course selection
00270 
00271     department_res.general_dept.next_day();
00272 
00273     school_res.next_day();
00274 
00275     YIELD;
00276 
00277     //------- start of a new trimster: calc pi of player_school ---------//
00278 
00279     if ( is_begin_trimester() ) {
00280         player_school.update_history(UPDATE_TRIMESTER);
00281     }
00282 
00283     //--------- start of a new month -------------//
00284 
00285     if ( info.game_day == 1 ) {                     //## chea 300899 change to call after UPDATE_TRIMESTER
00286         player_school.update_history(UPDATE_MONTH);
00287 
00288         // ---- start of a new year ------//
00289 
00290         if ( info.game_month == finance.fiscal_year_start_month ) {
00291             player_school.update_history(UPDATE_YEAR);
00292 
00293             //--- re-calculate percentages and totals in financial reports to make sure all are correct. Although the calculation is done once already, to be safe, do it once again here after all new year processes are done. ----//
00294 
00295             finance.calc_total_last_year();             // last year
00296             finance.calc_projected_total_n_percent(1);  // next year. 1-re-calculation, not first time calculation
00297         }
00298     }
00299 
00300     //------- scenario check targets -------//
00301 
00302     if (info.prerun_year==0)
00303         player_school.scenario_check_target();
00304 
00305     //---- the custom game is approaching its time limit of 99 years, display warning message ----//
00306 
00307     if (info.prerun_year==0) {
00308         int lastYear = 90;
00309 
00310 #ifndef ADMIN                                 // standard and demo versions have 3 year time limit only
00311         lastYear = 3;
00312 #endif
00313 
00314         if( info.game_year == lastYear-1 && info.game_month == 9 && info.game_day==1 ) {
00315             news_array.open_game_near_end();            // the game will soon end
00316         }
00317         else if( info.game_year == lastYear && info.game_month == 9 && info.game_day==1 ) {
00318             news_array.open_game_end();                 // the game ends
00319         }
00320         // retire on the next day
00321         else if( info.game_year == lastYear && info.game_month == 9 && info.game_day>1 ) {
00322             sys.set_staying_view_mode(MODE_RETIREMENT);
00323 
00324             if ( config.cd_music_volume <=0 )
00325                 music.stop();
00326         }
00327     }
00328 
00329     //---- process chances and objectives ----//
00330 
00331     if (info.prerun_year==0) {
00332         chance_event.next_day();
00333         task_array.next_day();                        // order: after all departments and offices
00334 
00335 #if(GAME_VERSION>=200)
00336         player_school.think_protagonist();
00337 #endif
00338 
00339     }
00340 
00341     //------- update initializzation progress bar -------------//
00342 
00343     if( info.prerun_year==1 && info.game_day==1 ) {
00344         // increment 2% per month
00345         box.progress_update( 28 + int( float(info.game_date - info.game_start_date)/5.7f ) );
00346     }
00347 
00348     //------- end of prerun year -----------//
00349 
00350     //## chea 190799 scenario not run prerun year
00351     if (info.game_year==2 && info.game_month==9 && info.game_day==1 && info.prerun_year==1) {
00352         end_prerun_year();
00353         oldCursor=CURSOR_NORMAL;
00354     }
00355 
00356     //---------------------------------------//
00357 
00358     if ( game_day == 1 )
00359         mouse_cursor.restore_icon(oldCursor);
00360 }
00361 
00362 //---------- End of function Info::next_day --------//
00363 
00364 //-------- Begin of function Info::inc_game_day ---------//
00365 
00366 void Info::inc_game_day() {
00367     //--- process game day --------//
00368 
00369     if( ++game_day > 30 )
00370         game_day = 30;                                // game_day is limited to 1-30 for
00371     // calculation of e.g. revenue_30days()
00372     game_date++;
00373 
00374     week_day=game_date%7;
00375 
00376     if( date.month(game_date) != game_month ) {
00377         game_day   = 1;
00378         game_month = date.month(game_date);
00379 
00380         graph_month_passed = min(graph_month_passed+1, HISTORY_MONTH_COUNT);
00381         graph_month = min(graph_month+1, HISTORY_MONTH_COUNT);
00382 
00383         if ( game_month == finance.fiscal_year_start_month ) {
00384             year_passed++;
00385 
00386             graph_year_passed = min(graph_year_passed+1, HISTORY_YEAR_COUNT);
00387             graph_year = min(graph_year+1, HISTORY_YEAR_COUNT);
00388         }
00389     }
00390 
00391     if( date.year(game_date) != game_year ) {
00392         game_month = 1;
00393         game_year = date.year(game_date);
00394     }
00395 
00396     // set year_day
00397     year_day = date.day_year( game_year, game_month, game_day );
00398 }
00399 
00400 //---------- End of function Info::inc_game_day --------//
00401 
00402 //-------- Begin of function Info::new_trimester_course_enrollment --------//
00404 void Info::new_trimester_course_enrollment() {
00405     for( int i=department_array.size() ; i>0 ; i--) {
00406         if( department_array.is_deleted(i) )
00407             continue;
00408 
00409         // clear course data in last trimester
00410         department_array[i]->course_array.next_trimester();
00411         //sys.yield();
00412     }
00413 
00414     int count_course = 0;
00415 
00416     for( i=department_array.size(); i>0; i--) {
00417         if( department_array.is_deleted(i) )
00418             continue;
00419 
00420         Department* deptPtr = department_array[i];
00421 
00422         deptPtr->student_array.select_course();
00423     }
00424 
00425     department_res.general_dept.student_array.select_course();
00426 
00427 #if(GAME_VERSION>=200)                          // Item 8d v)
00428     update_distance_learning_variables();
00429 #endif
00430 
00431     int w;
00432     int gd;
00433     avg_tal_acd = 0.0;
00434     avg_tal_ext = 0.0;
00435     avg_tal_ath = 0.0;
00436     int total_stu_no = 0;
00437     StudentArray* stuArray_cal_tal;
00438     Student *studentPtr_cal_tal;
00439 
00440     err_when( department_array.size() == 0 );
00441 
00442     for ( w=department_array.size(); w>=0; w-- ) {
00443         if (w) {
00444             if ( department_array.is_deleted(w) )
00445                 continue;
00446             stuArray_cal_tal = &(department_array[w]->student_array);
00447 
00448         }
00449         else {
00450             stuArray_cal_tal = &(department_res.general_dept.student_array);
00451         }
00452 
00453         // loop student
00454 
00455         for (gd=stuArray_cal_tal->size(); gd>0; gd--) {
00456             if ( stuArray_cal_tal->is_deleted(gd) )
00457                 continue;
00458             studentPtr_cal_tal = stuArray_cal_tal->operator[](gd);
00459             if ( studentPtr_cal_tal->talent_academic == 0)
00460                 continue;
00461             avg_tal_acd += studentPtr_cal_tal->talent_academic;
00462             avg_tal_ext += studentPtr_cal_tal->talent_extracurricular;
00463             avg_tal_ath += studentPtr_cal_tal->talent_athletics;
00464             total_stu_no ++;
00465         }
00466     }
00467 
00468     avg_tal_acd /= total_stu_no;
00469     avg_tal_ext /= total_stu_no;
00470     avg_tal_ath /= total_stu_no;
00471 
00472     //##200100 chea END loop all student to cal avg. talent
00473 
00474     //##200100 chea BEGIN loop all student to make sure they all have talent
00475 
00476     int s;
00477     int g;
00478     StudentArray* stuArray;
00479     Student *studentPtr;
00480     //          float talentArr[TALENT_VAR_COUNT];
00481     err_when( department_array.size() == 0 );
00482     for ( s=department_array.size(); s>=0; s-- ) {
00483         if (s) {
00484             if ( department_array.is_deleted(s) )
00485                 continue;
00486             stuArray = &(department_array[s]->student_array);
00487 
00488         }
00489         else {
00490             stuArray = &(department_res.general_dept.student_array);
00491         }
00492 
00493         // loop student
00494 
00495         for (g=stuArray->size(); g>0; g--) {
00496             if ( stuArray->is_deleted(g) )
00497                 continue;
00498             studentPtr = stuArray->operator[](g);
00499 
00500             if (studentPtr->talent_academic == 0) {
00501 
00502                 //try cal individual talent  BUGHERE
00503                 char studentLevel = studentPtr->student_level;
00504                 char stuSeg = studentPtr->student_segment;
00505                 char genderEthnicGroup = studentPtr->gender_ethnic_group;
00506 
00507                 if ( studentLevel == UG_TRADITION ) {
00508                     //-------- assume: enroll_res.init() (dbf init) called --------//
00509                     studentPtr->talent_academic = (char)(math.get_random_snd(avg_tal_acd, float(1.5),true));
00510                     studentPtr->talent_extracurricular = (char)math.get_random_snd(avg_tal_ext, float(1.5), true );
00511                     studentPtr->talent_athletics = (char)math.get_random_snd(avg_tal_ath, float(1.5), true );
00512                 }
00513                 else {
00514                     //-------- assume: value will be assigned after enroll_res.init_data() called
00515                     if ( studentLevel == DOCTOR )
00516                         studentPtr->talent_academic = (char)(m.fmin(100.0f, math.get_random_snd(math.single_response_func(0.7f, 1.3f, 100, 50,avg_tal_acd ), float(1.5), true )));
00517                     else
00518                         studentPtr->talent_academic = (char)(math.get_random_snd(avg_tal_acd, float(1.5),true));
00519                     studentPtr->talent_extracurricular = 0;
00520                     studentPtr->talent_athletics       = 0;
00521 
00522                 }
00523             }
00524 
00525         }
00526     }
00527 }
00528 
00529 //-------- End of function Info::new_trimester_course_enrollment --------//
00530 
00531 //-------- Begin of function Info::end_prerun_year --------//
00537 void Info::end_prerun_year() {
00538     game_day   = 1;
00539     game_month = 9;
00540     game_year  = GAME_START_YEAR;                   // may have bug if 99!!!
00541 
00542     game_start_date = date.julian( game_year, game_month, game_day );
00543 
00544     game_date  = game_start_date;
00545     year_day   = date.day_year( game_year, game_month, game_day );
00546     year_passed= 1;                                 // no. of years has been passed since the game begins
00547 
00548     graph_year_passed = 1;
00549     graph_month_passed = 1;                         // see next_day() also
00550     graph_trimester_passed = 1;
00551     graph_year = 3;                                 // previous, this and next year on graph
00552     graph_month = 3;
00553     graph_trimester = 3;
00554     chance_event.profit_competition_act = 0;        //## chea 091199 4 chance only
00555 
00556     start_play_time = m.get_time();                 // the time player start playing the game
00557     total_play_time = 0;                            // total time the player has played in all saved games
00558 
00559     config.disp_year_end_report=1;                  //enable end of year report
00560 
00561     //----- update faculty count ---------//
00562 
00563     update_faculty_count();
00564 
00565     //---- set player_school.sub_score_start[SCORE_VAR_COUNT], set the inputs to the trustee evaluation score at the beginning of the game ---//
00566 
00567     player_school.init_score();
00568 
00569     //---- call scenario initialization ----//
00570 
00571     player_school.init_scenario();
00572 
00573     task_array.rand_init = 1.0f - m.random(15)/10;  // for init only - do this to init the prestige
00574 
00575     box.progress_update(89);
00576     box.progress_val=0;
00577 
00578     letter.init_welcome_letter();                   // addif
00579 
00580     // ##### begin Marco ##### //
00581 #if(GAME_VERSION>=200)
00582     finance.save_initial_value();
00583     for (int i = department_array.size() ; i > 0; i--)
00584         department_array[i]->save_initial_data();
00585 
00586     department_array.save_initial_data();
00587     player_school.save_initial_data();
00588 
00589     // not update_appropiation here, moved to new Finance::new_fiscal_year
00590     //if ( player_school.is_public() )
00591     //{
00592     //  finance.update_appropiation();
00593     //  double temp = finance.revenue_array[AC_STATE_APPROPRIATION].total;
00594     //  RevenueItemChange* projRev;
00595     //  projRev = &finance.projected_revenue_array[AC_STATE_APPROPRIATION];
00596     //  projRev->change_budget_year.total
00597     //          = finance.calc_change( finance.budget_revenue_array[AC_STATE_APPROPRIATION].total, temp );
00598     //  projRev->change_last_year.total = finance.calc_change( projRev->this_year.total, temp );
00599     //}
00600 
00601     enroll_res.save_initial_data();
00602     development_office.save_initial_data();
00603     facility_office.save_initial_data();
00604     library_tech_office.save_initial_data();
00605     investment_office.save_initial_data();
00606     department_res.general_dept.save_initial_data();
00607     athletics_office.save_initial_data();
00608 #endif
00609     // ##### End Marco ##### //
00610 
00611     //--- reset info.prerun_year to 0 -----//
00612 
00613     info.prerun_year=0;
00614 
00615 }
00616 
00617 //-------- End of function Info::end_prerun_year --------//
00618 
00619 //-------- Begin of function update_faculty_count --------//
00623 static void update_faculty_count() {
00624     //------ for init letter loop faculty ------//
00625 
00626     department_array.faculty_count_tenured = 0;
00627     department_array.faculty_count_on_tenure_line = 0;
00628     Department* departPtr;
00629 
00630     for (int cond=department_array.size(); cond>=0; cond-- ) {
00631         if ( department_array.is_deleted(cond) )
00632             continue;
00633 
00634         departPtr = department_array[cond];
00635 
00636         for (int con = departPtr->faculty_array.size(); con>0; con--) {
00637             if (departPtr->faculty_array.is_deleted(con))
00638                 continue;
00639 
00640             switch(departPtr->faculty_array[con]->rank_level) {
00641             case ASSOC_PROF:
00642             case FULL_PROF:
00643                 department_array.faculty_count_tenured++;
00644             case ASST_PROF:
00645                 department_array.faculty_count_on_tenure_line++;
00646                 break;
00647             }
00648 
00649             //----- try to end the prerun year research project -----//
00650 
00651             int testU =0;
00652             int testU1 =0;
00653             Faculty* facultyPtr;                        // for test only
00654 
00655             for (int e = 0; e < MAX_RESEARCH_PROPOSAL ; e++) {
00656                 testU = departPtr->faculty_array[con]->research_proposal_array[e].date_to_next_status;
00657 
00658                 if(departPtr->faculty_array[con]->research_proposal_array[e].date_to_next_status!=0)
00659                     departPtr->faculty_array[con]->research_proposal_array[e].date_to_next_status -= 365;
00660 
00661                 facultyPtr = departPtr->faculty_array[con];
00662                 testU1 = departPtr->faculty_array[con]->research_proposal_array[e].date_to_next_status;
00663             }
00664         }
00665     }
00666 }
00667 
00668 //-------- End of function update_faculty_count --------//
00669 
00670 //-------- Begin of function Info::disp_panel_init --------//
00672 bool Info::is_begin_trimester() {
00673     return ( game_day == player_school.trimester_array[player_school.cur_trimester].start_day
00674              && game_month == player_school.trimester_array[player_school.cur_trimester].start_month );
00675 }
00676 
00677 //-------- Begin of function Info::disp_panel_init --------//
00678 
00679 //-------- Begin of function Info::disp_panel_init --------//
00681 void Info::disp_panel_init() {
00682     image_interface.put_large( &vga_back, 0, 0, "MAINSCR2" );
00683 
00684     //------ keep a copy of bitmap of the panel texture -----//
00685 
00686     top_info_bitmap = vga_back.save_area( TOP_INFO_X1, TOP_INFO_Y1+4, TOP_INFO_X2, TOP_INFO_Y2);
00687     bottom_info_bitmap = vga_back.save_area( BOTTOM_INFO_X1, BOTTOM_INFO_Y1, BOTTOM_INFO_X2, BOTTOM_INFO_Y2);
00688     surplus_info_bitmap = vga_back.save_area( SURPLUS_INFO_X1, SURPLUS_INFO_Y1, SURPLUS_INFO_X2, SURPLUS_INFO_Y2);
00689     score_info_bitmap = vga_back.save_area( SCORE_INFO_X1, SCORE_INFO_Y1, SCORE_INFO_X2, SCORE_INFO_Y2);
00690 
00691     // ## begin zb 02/21/99
00692     uscore_info_bitmap = vga_back.save_area( U_SCORE_INFO_X1, U_SCORE_INFO_Y1, U_SCORE_INFO_X2+10, U_SCORE_INFO_Y2);
00693     // ## end zb 02/21/99
00694 
00695     more_report_bitmap = vga_back.save_area( MORE_REPORT_X1, MORE_REPORT_Y1+2, MORE_REPORT_X2, MORE_REPORT_Y2);
00696     help_quest_bitmap = vga_back.save_area( HELP_QUEST_X1, HELP_QUEST_Y1+2, HELP_QUEST_X2, HELP_QUEST_Y2);
00697     list_button_bitmap = vga_back.save_area( LIST_BUTTON_X1, LIST_BUTTON_Y1, LIST_BUTTON_X2, LIST_BUTTON_Y2);
00698     date_info_bitmap = vga_back.save_area( DATE_INFO_X1, DATE_INFO_Y1, DATE_INFO_X2, DATE_INFO_Y2);
00699     year_info_bitmap = vga_back.save_area( YEAR_INFO_X1, YEAR_INFO_Y1, YEAR_INFO_X2, YEAR_INFO_Y2);
00700 
00701     //--- save areas of the column bitmap that touch the zoom viewing area ---//
00702 
00703     top_left_column_bitmap = vga_back.save_area( ZOOM_X1, ZOOM_Y1, ZOOM_X1+COLUMN_WIDTH-1, ZOOM_Y1+COLUMN_HEIGHT-1);
00704     top_right_column_bitmap = vga_back.save_area( ZOOM_X2-COLUMN_WIDTH+1, ZOOM_Y1, ZOOM_X2, ZOOM_Y1+COLUMN_HEIGHT-1);
00705 
00706     bottom_left_column_bitmap = vga_back.save_area( ZOOM_X1, ZOOM_Y2-COLUMN_HEIGHT+1, ZOOM_X1+COLUMN_WIDTH-1, ZOOM_Y2);
00707     bottom_right_column_bitmap = vga_back.save_area( ZOOM_X2-COLUMN_WIDTH+1, ZOOM_Y2-COLUMN_HEIGHT+1, ZOOM_X2, ZOOM_Y2);
00708 
00709     //------ store frequent used bitmaps into memory -----//
00710 
00711     menu_up_bitmap = vga_back.save_area(MENU_BUTTON_X1, MENU_BUTTON_Y1, MENU_BUTTON_X2, MENU_BUTTON_Y2);
00712     vga_back.put_bitmap(MENU_BUTTON_X1, MENU_BUTTON_Y1, image_interface.get_ptr("MENUDOWN"));
00713     menu_down_bitmap = vga_back.save_area(MENU_BUTTON_X1, MENU_BUTTON_Y1, MENU_BUTTON_X2, MENU_BUTTON_Y2);
00714 
00715     short *bitmapPtr = (short *)image_interface.get_ptr("REPORT-0");
00716 
00717     for (int i = 0; i < REPORT_ITEMS+1; i++)
00718         report_bitmap[i] = mem_add(*(bitmapPtr) * *(bitmapPtr+1) + 2*sizeof(short));
00719 
00720     //  char *strBuf = "REPORT-?";
00721     char strBuf[100];
00722     strcpy(strBuf,"REPORT-?");
00723 
00724     for (i = 0; i < REPORT_ITEMS+1; i++) {          // 0 is the bitmap without all pressed buttons
00725         strBuf[7] = i + '0';
00726         bitmapPtr = (short *)image_interface.get_ptr(strBuf);
00727         memcpy(report_bitmap[i], bitmapPtr, *(bitmapPtr) * *(bitmapPtr+1) + 2);
00728     }
00729 }
00730 
00731 //--------- End of function Info::disp_panel_init ---------//
00732 
00733 //-------- Begin of function Info::disp --------//
00735 void Info::disp() {
00736     if( sys.signal_exit_flag )
00737         return;
00738 
00739     //-- Display the name of the selected department or the current report. --//
00740 
00741     disp_selected_name();
00742 
00743     //-------- display surplus ---------------//
00744 
00745     vga.use_back();
00746     vga_back.rest_area( surplus_info_bitmap, 0 );
00747     font_fdiamond.center_put(SURPLUS_INFO_X1, SURPLUS_INFO_Y1, SURPLUS_INFO_X2, SURPLUS_INFO_Y2, m.format((float)((int)finance.this_year.surplus_deficit),7));
00748     vga.use_front();
00749 
00750     vga.blt_buf(SURPLUS_INFO_X1, SURPLUS_INFO_Y1, SURPLUS_INFO_X2, SURPLUS_INFO_Y2);
00751 
00752     //-------- display calendar ----------//
00753 
00754     disp_calendar();
00755 
00756     //-------- display game score ------------//
00757 
00758     int    scoreChange = (int)player_school.cur_game_score - (int)player_school.game_score_history[THIS_MONTH-1];
00759     String str;
00760 
00761     image_interface.put_back( 578, 0, "CUP" );
00762     vga.blt_buf(578,0,623,31);
00763 
00764     // format type 4 - no thousand separators
00765     str = m.format( (int) player_school.cur_game_score, 4 );
00766 
00767     if( scoreChange >= 0 ) {
00768         image_interface.put_back(514, 0, "REPU-UP" );
00769         vga.blt_buf(514,0,544,29);
00770     }
00771     else {
00772         image_interface.put_back( 508, 0, "REPU-DWN" );
00773         vga.blt_buf(514,0,544,29);
00774     }
00775 
00776     /*  if( scoreChange )
00777         {
00778         str += " (";
00779 
00780         if( scoreChange > 0 )
00781         str += "+";
00782         else
00783         str += "-";
00784 
00785         str += abs(scoreChange);
00786         str += ")";
00787         }
00788     */
00789     vga.use_back();
00790     vga_back.rest_area(score_info_bitmap,0,0);
00791     //  mouse.hide_area(SCORE_INFO_X1, SCORE_INFO_Y1, SCORE_INFO_X2, SCORE_INFO_Y2);
00792     font_numbers.put( SCORE_INFO_X1, SCORE_INFO_Y1, str, 1, SCORE_INFO_X2 );
00793     //  mouse.show_area();
00794     vga.blt_buf(SCORE_INFO_X1, SCORE_INFO_Y1, SCORE_INFO_X2, SCORE_INFO_Y2);
00795 
00796     // format type 4 - no thousand separators
00797     str = m.format( (int)player_school.ultimate_game_score, 4 );
00798     vga_back.rest_area(uscore_info_bitmap,0,0);
00799 
00800     //---- display ultimate score -----//
00801 
00802     if( player_school.ultimate_game_score > 0 )
00803         font_numbers.put( U_SCORE_INFO_X1, U_SCORE_INFO_Y1, str, 1, U_SCORE_INFO_X2+10 );
00804     else                                            // font_numbers does not have "(" & ")" characters, we have to use a different font
00805         font_redcharts.put( U_SCORE_INFO_X1, U_SCORE_INFO_Y1-5, str, 1, U_SCORE_INFO_X2+10 );
00806 
00807     vga.blt_buf(U_SCORE_INFO_X1, U_SCORE_INFO_Y1, U_SCORE_INFO_X2+10, U_SCORE_INFO_Y2);
00808 
00809     //-------- display more report button ---------------//
00810     vga_back.rest_area(more_report_bitmap,0,0);
00811     //  mouse.hide_area(MORE_REPORT_X1, MORE_REPORT_Y1, MORE_REPORT_X2, MORE_REPORT_Y2);
00812     if(sys.view_mode==MODE_MORE_REPORT)
00813         font_hstone.put( MORE_REPORT_X1, MORE_REPORT_Y1-1, "more reports", 1, MORE_REPORT_X2 );
00814     else
00815         font_stone.put( MORE_REPORT_X1, MORE_REPORT_Y1-1, "more reports", 1, MORE_REPORT_X2 );
00816     //  mouse.show_area();
00817     vga.blt_buf(MORE_REPORT_X1, MORE_REPORT_Y1-1, MORE_REPORT_X2, MORE_REPORT_Y2);
00818 
00819     //-------- display help quest button ---------------//
00820     vga_back.rest_area(help_quest_bitmap,0,0);
00821     //  mouse.hide_area(MORE_REPORT_X1, MORE_REPORT_Y1, MORE_REPORT_X2, MORE_REPORT_Y2);
00822     if(sys.view_mode==MODE_HELP_TOPIC)
00823         font_hstone.put( HELP_QUEST_X1, HELP_QUEST_Y1-1, "?", 1, HELP_QUEST_X2 );
00824     else
00825         font_stone.put( HELP_QUEST_X1, HELP_QUEST_Y1-1, "?", 1, HELP_QUEST_X2 );
00826     //  mouse.show_area();
00827     vga.blt_buf(HELP_QUEST_X1, HELP_QUEST_Y1-1, HELP_QUEST_X2, HELP_QUEST_Y2);
00828 
00829 }
00830 
00831 //-------- End of function Info::disp --------//
00832 
00833 //-------- Begin of function Info::disp_column_bitmap --------//
00837 void Info::disp_column_bitmap(VgaBuf* vgaBuf) {
00838     vgaBuf->rest_area( top_left_column_bitmap, 0, 1 );
00839     vgaBuf->rest_area( top_right_column_bitmap, 0, 1 );
00840 
00841     vgaBuf->rest_area( bottom_left_column_bitmap, 0, 1 );
00842     vgaBuf->rest_area( bottom_right_column_bitmap, 0, 1 );
00843 }
00844 
00845 //-------- End of function Info::disp_column_bitmap --------//
00846 
00847 //-------- Begin of function Info::disp_selected_name --------//
00851 void Info::disp_selected_name() {
00852     //------ display the selected department name ------//
00853 
00854     vga_back.rest_area( top_info_bitmap, 0 );
00855 
00856     String deptStr;
00857 
00858     //-- if the report of a non-department building is being displayed currently --//
00859 
00860     if( sys.is_institution_report ) {               // if the report currently displayed is institution-wide
00861 #if(GAME_VERSION>=200)
00862         if( sys.view_mode >= MODE_FIRST_NONDEPARTMENTAL_FIRM && sys.view_mode <= MODE_LAST_NONDEPARTMENTAL_FIRM )
00863             deptStr = firm_res[sys.view_mode - MODE_FIRST_NONDEPARTMENTAL_FIRM + FIRST_NONDEPARTMENTAL_FIRM_ID]->name;
00864         else
00865 #endif
00866             deptStr = player_school.school_name;
00867     }
00868 #if(GAME_VERSION>=200)
00869 #else
00870     else if( sys.view_mode >= MODE_FIRST_NONDEPARTMENTAL_FIRM &&
00871              sys.view_mode <= MODE_LAST_NONDEPARTMENTAL_FIRM ) {
00872         deptStr = firm_res[sys.view_mode - MODE_FIRST_NONDEPARTMENTAL_FIRM + 1]->name;
00873     }
00874 #endif
00875     else if( department_array.selected_recno ) {
00876         //              deptStr  = department_array.selected_recno;
00877         //              deptStr += ". ";
00878         //              deptStr = department_array[department_array.selected_recno]->name();
00879         deptStr = department_res[department_array[department_array.selected_recno]->department_id]->name;
00880         deptStr += " Department";
00881     }
00882 
00883     if( deptStr.len() > 0 ) {
00884         //------- De-Capitalize the string --------//
00885 
00886         for( char *strPtr = deptStr.str_buf; *strPtr != NULL; strPtr++ ) {
00887             if (*strPtr >= 'A' && *strPtr <= 'Z')
00888                 *strPtr += 32;
00889             if (*strPtr ==':')
00890                 *strPtr = ':'+2;
00891         }
00892 
00893         vga.use_back();
00894         font_stone.center_put(TOP_INFO_X1, TOP_INFO_Y1, TOP_INFO_X2, TOP_INFO_Y2, deptStr);
00895         vga.use_front();
00896     }
00897 
00898     vga.blt_buf( TOP_INFO_X1, TOP_INFO_Y1+4, TOP_INFO_X2, TOP_INFO_Y2 );
00899 
00900     //------ display the touched firm name ------//
00901 
00902     vga_back.rest_area( bottom_info_bitmap, 0 );
00903 
00904     if( sys.view_mode == MODE_NORMAL &&             // only display it in the campus view, as it displays the building the mouse is current over
00905         firm_array.touched_recno &&
00906         // it was just touched
00907         sys.frame_count - firm_array.touched_frame_count <= 1 ) {
00908         String deptStr(firm_array[firm_array.touched_recno]->name());
00909 
00910         //              for (char *strPtr = deptStr.str_buf; *strPtr != NULL; strPtr++)
00911         //              {
00912         //              if (*strPtr >= 'a' && *strPtr <= 'z')
00913         //                      *strPtr -= 32;                                                  // Capitalize the string
00914         //              }
00915         for( char *strPtr = deptStr.str_buf; *strPtr != NULL; strPtr++ ) {
00916             if (*strPtr >= 'A' && *strPtr <= 'Z')
00917                 *strPtr += 32;
00918             if (*strPtr ==':')
00919                 *strPtr = ':'+2;
00920         }
00921 
00922         vga.use_back();
00923         font_stone.center_put(BOTTOM_INFO_X1, BOTTOM_INFO_Y1, BOTTOM_INFO_X2, BOTTOM_INFO_Y2, deptStr);
00924         vga.use_front();
00925     }
00926 
00927     vga.blt_buf( BOTTOM_INFO_X1, BOTTOM_INFO_Y1, BOTTOM_INFO_X2, BOTTOM_INFO_Y2 );
00928 }
00929 
00930 //-------- End of function Info::disp_selected_name --------//
00931 
00932 //-------- Begin of function Info::disp_calendar --------//
00933 
00934 void Info::disp_calendar() {
00935     //-------- display day ---------------//
00936 
00937     int newDay;
00938 
00939     if (last_day != (newDay = date.day(info.game_date))||sys.redraw_all_flag==1) {
00940         mouse.hide_area(DATE_INFO_X1,DATE_INFO_Y1,DATE_INFO_X2,DATE_INFO_Y2);
00941         vga_front.rest_area( date_info_bitmap, 0 );
00942         char digitStr[2];
00943         digitStr[1] = '\0';
00944         digitStr[0] = char(newDay % 10) + '0';
00945         if (newDay > 9) {
00946             vga_front.put_bitmap_trans(day_x1_2, digit_y1, date_res_bitmap.get_ptr(digitStr));
00947             digitStr[0] = char(newDay / 10) + '0';
00948             vga_front.put_bitmap_trans(day_x1_1, digit_y1, date_res_bitmap.get_ptr(digitStr));
00949         }
00950         else {
00951             vga_front.put_bitmap_trans(day_x1_0, digit_y1, date_res_bitmap.get_ptr(digitStr));
00952         }
00953         mouse.show_area();
00954         last_day = newDay;
00955     }
00956 
00957     //-------- display year ---------------//
00958 
00959     int newYear;
00960 #if(GAME_VERSION>=200)
00961     if( last_year != (newYear=info.financial_year()) || sys.redraw_all_flag==1 )
00962 #else
00963         if( last_year != (newYear=info.game_year) || sys.redraw_all_flag==1 )
00964 #endif
00965         {
00966             mouse.hide_area(YEAR_INFO_X1,YEAR_INFO_Y1,YEAR_INFO_X2,YEAR_INFO_Y2);
00967             vga_front.rest_area( year_info_bitmap, 0 );
00968             char digitStr[2];
00969             digitStr[1] = '\0';
00970             digitStr[0] = char((newYear % 100) / 10) + '0';
00971             vga_front.put_bitmap_trans(year_x1_1, digit_y1, date_res_bitmap.get_ptr(digitStr));
00972             digitStr[0] = char(newYear % 10) + '0';
00973             vga_front.put_bitmap_trans(year_x1_2, digit_y1, date_res_bitmap.get_ptr(digitStr));
00974             mouse.show_area();
00975             last_year = newYear;
00976         }
00977 
00978     //--------- display trimester --------//
00979 
00980     char* bitmapNameArray[] = { "FALL", "WINTER", "SUMMER" };
00981 
00982     mouse.hide_area(YEAR_INFO_X1,YEAR_INFO_Y1,YEAR_INFO_X2,YEAR_INFO_Y2);
00983     if( player_school.is_trimester_off )            // Trimester break;
00984         vga_front.put_bitmap(SEASON_X1, SEASON_Y1, date_res_bitmap.get_ptr("BREAK") );
00985     else
00986         vga_front.put_bitmap(SEASON_X1, SEASON_Y1, date_res_bitmap.get_ptr(bitmapNameArray[player_school.cur_trimester]) );
00987     mouse.show_area();
00988 
00989     //-------- display month --------------//
00990 
00991     int newMonth;
00992 
00993     if (last_month != (newMonth = date.month(info.game_date))||sys.redraw_all_flag==1) {
00994         char *monthPtr;
00995 
00996         switch (last_month = newMonth) {
00997         case 1:
00998             monthPtr = date_res_bitmap.get_ptr("JAN"); break;
00999         case 2:
01000             monthPtr = date_res_bitmap.get_ptr("FEB"); break;
01001         case 3:
01002             monthPtr = date_res_bitmap.get_ptr("MAR"); break;
01003         case 4:
01004             monthPtr = date_res_bitmap.get_ptr("APR"); break;
01005         case 5:
01006             monthPtr = date_res_bitmap.get_ptr("MAY"); break;
01007         case 6:
01008             monthPtr = date_res_bitmap.get_ptr("JUN"); break;
01009         case 7:
01010             monthPtr = date_res_bitmap.get_ptr("JUL"); break;
01011         case 8:
01012             monthPtr = date_res_bitmap.get_ptr("AUG"); break;
01013         case 9:
01014             monthPtr = date_res_bitmap.get_ptr("SEP"); break;
01015         case 10:
01016             monthPtr = date_res_bitmap.get_ptr("OCT"); break;
01017         case 11:
01018             monthPtr = date_res_bitmap.get_ptr("NOV"); break;
01019         case 12:
01020             monthPtr = date_res_bitmap.get_ptr("DEC"); break;
01021         }
01022 
01023         mouse.hide_area(DATE_INFO_X1,DATE_INFO_Y1,DATE_INFO_X2,DATE_INFO_Y2);
01024         vga_front.put_bitmap(MONTH_X1, MONTH_Y1, monthPtr);
01025         mouse.show_area();
01026     }
01027 }
01028 
01029 //-------- End of function Info::disp_calendar --------//
01030 
01031 //------ Start of function Info::financial_year -------//
01032 
01033 int Info::financial_year() {
01034     if( game_month<finance.fiscal_year_start_month )
01035         return game_year-1;
01036     else
01037         return game_year;
01038 }
01039 
01040 //------ End of function Info::financial_year -------//
01041 
01042 //------ Start of function Info::date_str_ymd -------//
01043 //
01044 char* Info::date_str_ymd( int year, int month, int day, int formatFlag) {
01045     static String str;
01046 
01047     str = "";
01048 
01049     int seperatorFlag = 0;
01050 
01051     // add month
01052     if( month && !(formatFlag & INFO_DATE_NO_MONTH) ) {
01053         if( seperatorFlag )
01054             str += " ";
01055 
01056         if( formatFlag & INFO_DATE_SHORT_MONTH ) {
01057             char shortMonthStr[3+1];
01058             m.str_shorten(shortMonthStr, date.month_str(month), 3 );
01059             str += shortMonthStr;
01060         }
01061         else
01062             str += date.month_str(month);
01063 
01064         seperatorFlag = 1;
01065     }
01066 
01067     // add day
01068     if( day && !(formatFlag & INFO_DATE_NO_DAY) ) {
01069         if( seperatorFlag )
01070             str += " ";
01071 
01072         str += day;
01073 
01074         seperatorFlag = 1;
01075     }
01076 
01077     // add year
01078 
01079     if( year && !(formatFlag & INFO_DATE_NO_YEAR) ) {
01080         // modify year
01081         if( (formatFlag & INFO_DATE_F_YEAR) && month && month < finance.fiscal_year_start_month )
01082             year--;
01083 
01084         if( formatFlag & INFO_DATE_ADD_YR ) {
01085             if( seperatorFlag )
01086                 str += " ";
01087             str += m.format( year, 16 );
01088         }
01089         else {
01090             if( seperatorFlag )
01091                 str += ", ";
01092             str += m.format(year, 4);                   // no thousand separator
01093         }
01094 
01095         seperatorFlag = 1;
01096     }
01097 
01098     return str;
01099 }
01100 
01101 //------ End of function Info::date_str_ymd -------//
01102 
01103 //------ Start of function Info::date_str_ymd -------//
01104 //
01105 char* Info::date_str_julian( long julianDate, int formatFlag) {
01106     // false field : INFO_DATE_NO_MONTH, INFO_DATE_NO_YEAR, INFO_DATE_F_YEAR
01107     // true field : INFO_DATE_ADD_YR
01108     // true/false acceptable : INFO_DATE_NO_DAY, INFO_DATE_SHORT_MONTH
01109     // except don't care fields here
01110     if( formatFlag & (INFO_DATE_NO_MONTH|INFO_DATE_NO_YEAR|INFO_DATE_F_YEAR|INFO_DATE_ADD_YR)
01111         == INFO_DATE_ADD_YR )                         // true fields here
01112         return date.date_str( julianDate, formatFlag & INFO_DATE_SHORT_MONTH, !(formatFlag & INFO_DATE_NO_DAY) );
01113     return date_str_ymd( date.year(julianDate), date.month(julianDate), date.day(julianDate), formatFlag );
01114 }
01115 
01116 //------ End of function Info::date_str_ymd -------//
01117 
01118 #if(GAME_VERSION>=200)
01119 // --- Begin of function Info::update_distance_learning_variables --- //
01120 //
01121 //      Implementation of Version 2.0 Item 8d v)
01122 void  Info::update_distance_learning_variables(char initValue) {
01123     // calculate distance_learning_place in each course in course array in each department
01124     int deptSize = department_array.size();
01125     for( int i=deptSize ; i>0 ; i--) {              //  Loop for all departments
01126         if ( department_array.is_deleted(i) )
01127             continue;
01128 
01129         Department*   deptPtr = department_array[i];
01130         deptPtr->total_distance_learning_place = 0;
01131         CourseArray*  courseArrayPtr = &department_array[i]->course_array;
01132         int courseSize = courseArrayPtr->size();
01133         for (int j=courseSize; j>0; j--) {            // Loop for courses
01134             if ( courseArrayPtr->is_deleted(j) )
01135                 continue;
01136 
01137             Course* coursePtr = courseArrayPtr->operator [](j);
01138             // check this course is optimized
01139             int randomNo = m.random(100);
01140             if ( randomNo < deptPtr->p_tech_utilization ) {
01141                 // ************** calculate distance_learning_place here **************** //
01142                 // courseEnr[course] : coursePtr->convention_student_count
01143                 // nSections[course] : coursePtr->class_section_count
01144                 // Normal_class_size : coursePtr->normal_class_size()
01145                 // 1.5               : allowance for the 33% overload of the class
01146                 if ( initValue )
01147                     coursePtr->distance_learning_place = (coursePtr->normal_class_size()*1.25*coursePtr->class_section_count-
01148                                                           coursePtr->convention_student_count)*coursePtr->class_section_count*
01149                         deptPtr->distance_learning_credits/100;
01150                 else
01151                     coursePtr->distance_learning_place = (coursePtr->normal_class_size()*1.5*coursePtr->class_section_count-
01152                                                           coursePtr->convention_student_count)*coursePtr->class_section_count*
01153                         deptPtr->distance_learning_credits/100;
01154             }
01155             else
01156                 coursePtr->distance_learning_place = 0;
01157 
01158             // calculate the total_distance_learning_place
01159             deptPtr->total_distance_learning_place += coursePtr->distance_learning_place;
01160         }
01161     }
01162 
01163     // calculate actual_distance_learning_enrollment & course_enrollment & distance_learning_enrollment
01164     int totalDLProvided = 0;
01165     for ( i=deptSize; i>0; i-- ) {                  // Loop again for departments
01166         if ( department_array.is_deleted(i) )
01167             continue;
01168 
01169         Department* deptPtr = department_array[i];
01170         CourseArray*  courseArrayPtr = &department_array[i]->course_array;
01171         int courseSize = courseArrayPtr->size();
01172 
01173         // reset the distance learning enrollment
01174         deptPtr->distance_learning_enrollment = 0;
01175 
01176         for ( int j=courseSize; j>0; j-- ) {          // Loop again for courses
01177             if ( courseArrayPtr->is_deleted(j) )
01178                 continue;
01179 
01180             Course* coursePtr = courseArrayPtr->operator [](j);
01181 
01182             // calculate actual distance learning enrollment
01183             // DL_demand : enroll_res.total_matrics[4]
01184             if ( deptPtr->total_distance_learning_place == 0 )
01185                 coursePtr->actual_distance_learning_enrollment = 0;
01186             else
01187                 coursePtr->actual_distance_learning_enrollment = enroll_res.total_matrics[4]*coursePtr->distance_learning_place/
01188                     deptPtr->total_distance_learning_place;
01189 
01190             // calculate course enrollment
01191             coursePtr->convention_student_count += coursePtr->actual_distance_learning_enrollment;
01192 
01193             // calculate distance learning enrollment
01194             deptPtr->distance_learning_enrollment += coursePtr->actual_distance_learning_enrollment;
01195         }
01196 
01197         // calculate distance credits provided in this department
01198         deptPtr->distance_credits_provided = deptPtr->distance_learning_enrollment;
01199         totalDLProvided += deptPtr->distance_credits_provided;
01200     }
01201 
01202     finance.calc_distance_learning_expenditure();
01203 
01204     // Need to update the value of enroll_res.matric_history[sl][ER_CREDITS_PROVIDED]
01205     int h = THIS_YEAR;
01206     shift_history( enroll_res.distance_credits_provided_history, HISTORY_TRIMESTER_COUNT );
01207     enroll_res.distance_credits_provided_history[THIS_TRIMESTER] = (int)totalDLProvided;
01208 
01209 }
01210 
01211 //
01212 // --- End of function Info::update_distance_learning_variables --- //
01213 #endif

Generated on Fri Aug 23 01:37:59 2002 for VirtualU by doxygen1.2.17