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

Password:

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

Ofac_rep.cpp

Go to the documentation of this file.
00001 //Filename    : OFAC_REP.CPP
00002 //Description : Faculty Report
00003 
00004 #include <KEY.H>
00005 #include <OVGA.H>
00006 #include <OFONT.H>
00007 #include <OWORLD.H>
00008 #include <OSYS.H>
00009 #include <OINFO.H>
00010 #include <OMOUSE.H>
00011 #include <OIFACE.H>
00012 #include <OBUTTON.H>
00013 #include <ODEPT.H>
00014 #include <OVBROW98.H>
00015 #include <OSPINNER.H>
00016 #include <OGAMESTR.H>
00017 #include <OFACULTY.H>
00018 #include <OFPHOTO.H>
00019 #include <OFACURES.H>
00020 #include <OBOX.H>
00021 #include <OTEXT.H>
00022 #include <OAUDIO.H>
00023 #include <OCONFIG.H>
00024 #include <STDIO.H>
00025 #include <ALL.H>
00026 #include <OPSCHOOL.H>
00027 
00028 //---------- Define constant ------------//
00029 
00030 enum {
00031     REPORT_X1 = ZOOM_X1+15,
00032     REPORT_Y1 = ZOOM_Y1+15,
00033     REPORT_X2 = ZOOM_X2-15,
00034     REPORT_Y2 = ZOOM_Y2-40,
00035 };
00036 
00037 enum { FACULTY_REC_HEIGHT = 84, RESEARCH_REC_HEIGHT = 16 };
00038 
00039 //--------- Define report modes ----------//
00040 
00041 enum {                                            // the bg image id
00042     BG_PIC_ID = 4
00043 };
00044 
00045 enum { REPORT_TYPE_COUNT = 2 };
00046 enum { REPORT_TYPE_LIST, REPORT_TYPE_DETAIL, REPORT_RETIRE };
00047 
00048 enum { REPORT_MODE1_COUNT = 3 };
00049 enum {                                            //### fred 1023
00050     REPORT_MODE1_BASIC, REPORT_MODE1_ACTIVITY, REPORT_MODE1_ASSEST
00051 };
00052 
00053 enum { REPORT_MODE2_COUNT = 2 };
00054 enum { REPORT_MODE2_STD, REPORT_MODE2_RESEARCH };
00055 
00056 enum { BUTTON_Y1=REPORT_Y2+10 };
00057 enum { BUTTON_WIDTH=90, BUTTON_HEIGHT=20 };
00058 
00059 //-------- define static vars -----------//
00060 
00061 static int        last_faculty_count=0;
00062 static int        last_research_count=0;
00063 static VBrowse98    browse_faculty, browse_research;
00064 static Department*  cur_dept_ptr;                 // the department whose faculty we are looking at
00065 
00066 static ButtonGroup  button_type(REPORT_TYPE_COUNT);
00067 static ButtonGroup  button_mode1_array(REPORT_MODE1_COUNT);
00068 static ButtonGroup  button_mode2_array(REPORT_MODE2_COUNT);
00069 static Button     button_prev, button_next, mode_fac_sum_button;
00070 static Button     button_retire, button_retire_cancel, button_retire_offer;
00071 #if(GAME_VERSION>=200)
00072 static Button     button_dismiss;
00073 #endif
00074 static Spinner      retire_spinner;
00075 
00076 static char* reportMode1StrArray[] = {            //### fred 1023
00077     "Basic", "Activity", "Assets"
00078 };
00079 static char* reportMode2StrArray[] = { "Standard", "Extended" };
00080 #if(GAME_VERSION>=200)
00081 static Button     button_back;
00082 float spinner1=25.0;
00083 #else
00084 static float spinner1=25.0;
00085 #endif
00086 static Text  retire_result_txt;
00087 static int offerDollar;
00088 //------ declare static functions -------//
00089 
00090 static void   disp_faculty_rec(int,int,int,int);
00091 #if(GAME_VERSION>=200)
00092 static void   disp_display_faculty_rec(int,int,int,int);
00093 #endif
00094 static void   disp_research_rec(int,int,int,int);
00095 
00096 //----- Begin of function FacultyRes::report ------//
00102 void FacultyRes::report(int refreshFlag) {
00103     //---- determine the department for display the faculty records ----//
00104     int deptRecno=1;
00105 
00106     if( department_array.selected_recno )
00107         deptRecno = department_array.selected_recno;
00108     cur_dept_ptr = department_array[deptRecno];
00109 
00110     // fix in version 2, infinite loop if report_faculty_recno is 0
00111     if( report_faculty_recno <= 0)
00112         report_faculty_recno = 1;
00113 
00114     // begin chwg080999 avoiding (facultyPtr->faculty_recno==0)
00115     Faculty* facultyPtr = cur_dept_ptr->faculty_array.get_unpacked_faculty(report_faculty_recno);
00116     while((facultyPtr->faculty_recno==0)&&(report_faculty_recno!=1))
00117         facultyPtr = cur_dept_ptr->faculty_array.get_unpacked_faculty(--report_faculty_recno);
00118     // end chwg080999
00119 
00120     //------ paint the background -------//
00121     vga.use_back();
00122 
00123     if( refreshFlag == INFO_REPAINT ) {
00124         user_interface.bg_img(BG_PIC_ID, &vga_back);
00125 
00126         if( report_type==REPORT_TYPE_LIST ) {
00127             user_interface.brighten(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10);
00128             user_interface.rect(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10,1);
00129             font_charts.put(REPORT_X1+300,REPORT_Y1-8,"Faculty Directory");
00130         }
00131 
00132         report_paint_button(refreshFlag);
00133     }
00134     else {
00135         //              report_paint_button(refreshFlag);
00136     }
00137 
00138     //----------- If it's in the list mode -------------//
00139     if( report_type==REPORT_TYPE_LIST ) {
00140         if( refreshFlag == INFO_REPAINT ) {
00141             browse_faculty.init( REPORT_X1, REPORT_Y1+10, REPORT_X2, REPORT_Y2+10,
00142                                  0, FACULTY_REC_HEIGHT,
00143                                  cur_dept_ptr->faculty_array.faculty_count,
00144                                  disp_faculty_rec, NULL ,1 );
00145             browse_faculty.open(report_faculty_recno,cur_dept_ptr->faculty_array.faculty_count);
00146         }
00147         else {                                        // refreshFlag == INFO_UPDATE
00148             //                  browse_faculty.refresh(-1, cur_dept_ptr->faculty_array.faculty_count);
00149         }
00150         report_faculty_recno = browse_faculty.recno();
00151     }
00152     else if( report_type==REPORT_TYPE_DETAIL) {
00153         //------- if it's in detailed mode --------//
00154         if( cur_dept_ptr->faculty_array.faculty_count > 0 ) {
00155             switch( faculty_res.report_det_mode ) {
00156             case REPORT_MODE2_STD:
00157                 facultyPtr->disp_detail_std(refreshFlag);
00158                 break;
00159             }
00160         }
00161     }
00162     last_faculty_count = cur_dept_ptr->faculty_array.faculty_count;
00163 
00164     if( report_type==REPORT_RETIRE ) {
00165         if( refreshFlag == INFO_REPAINT ) {
00166             switch( faculty_res.report_det_mode ) {
00167             case REPORT_MODE2_STD:
00168                 facultyPtr->disp_detail_std(refreshFlag);
00169                 break;
00170             }
00171 
00172             //                  user_interface.darken(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00173             user_interface.darken(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00174             info.disp_column_bitmap(&vga_back);
00175             user_interface.bar(200,200,600,400,V_WHITE);
00176             user_interface.brighten(200,200,600,400);
00177             user_interface.rect(200,200,600,400);
00178 
00179             button_retire_offer.create_text(250,370,400,390,"Make offer",1);
00180             button_retire_offer.paint();
00181             button_retire_cancel.create_text(450,370,550,390,"Cancel",1);
00182             button_retire_cancel.paint();
00183 
00184             font_chartsm.put(260,220,"How much would you offer to ");
00185             font_chart_blue_sm.put(430,220,facultyPtr->name());
00186             font_chartsm.put(260,240,"for retirement?");
00187 
00188             //                  retire_spinner.init(260, 275, 360, 305, &spinner1, 25.0, 300.0, 5.0,0,NULL,23);
00189 #if(GAME_VERSION>=200)
00190             if ( facultyPtr->rank_level == LONG_TERM_ADJUNCT ) {
00191                 int yearCount  = (info.game_date-facultyPtr->start_teaching_date) / 365;
00192                 int monthCount = ((info.game_date-facultyPtr->start_teaching_date) % 365) / 30;
00193                 int remainYear;
00194 
00195                 if ( monthCount )
00196                     remainYear = 5-yearCount%5-1;
00197                 else
00198                     remainYear = 5-yearCount%5;
00199 
00200                 int x = remainYear;
00201 
00202                 if ( spinner1 != (float)x*10 )
00203                     spinner1 = (float)x*10;
00204             }
00205             else {
00206                 spinner1 = 100.0;
00207             }
00208 #endif
00209 
00210 #if(GAME_VERSION>=200)
00211             //## chea 230999
00212             retire_spinner.init(260, 275, 360, 305, &spinner1, 10.0, 300.0, 5.0,0,NULL,25);
00213 #else
00214             //## chea 230999
00215             retire_spinner.init(260, 275, 360, 305, &spinner1, 25.0, 300.0, 5.0,0,NULL,25);
00216 #endif
00217             retire_spinner.paint();
00218             font_chartsm.put(380,285,"of annual salary");
00219             font_chart_blue_sm.put(480,285,m.format(facultyPtr->salary,2));
00220 
00221             font_chartsm.put(260,315,"=");
00222             offerDollar=(int)(facultyPtr->salary*(*(retire_spinner.var_ptr))/100);
00223             //                  font_chart_blue_sm.put(270,315,m.format(offerDollar,1));  //## chea 230999  don't why this is here
00224             //                  font_chart_blue_sm.put(270,315,m.format(offerDollar,2));  //## chea 230999  don't why this is here
00225             //                  retire_result_txt.put(280,315,&offerDollar,1);
00226             //## chea 230999
00227             retire_result_txt.put(280,315,&offerDollar,2);
00228         }
00229         else {
00230             offerDollar=(int)(facultyPtr->salary*(*(retire_spinner.var_ptr))/100);
00231             retire_spinner.refresh();
00232             retire_result_txt.refresh();
00233         }
00234     }
00235     vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00236 }
00237 
00238 //------- End of function FacultyRes::report ------//
00239 
00240 #if(GAME_VERSION>=200)
00241 // --- Begin of function FacultyRes::report_faculty_hired --- //
00242 //
00243 void  FacultyRes::report_faculty_hired(int refreshFlag) {
00244     //---- determine the department for display the faculty records ----//
00245     int deptRecno=1;
00246 
00247     if( department_array.selected_recno )
00248         deptRecno = department_array.selected_recno;
00249     cur_dept_ptr = department_array[deptRecno];
00250 
00251     //------ paint the background -------//
00252     vga.use_back();
00253 
00254     if( refreshFlag == INFO_REPAINT ) {
00255         user_interface.bg_img(BG_PIC_ID, &vga_back);
00256 
00257         if( report_type==REPORT_TYPE_LIST ) {
00258             user_interface.brighten(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10);
00259             user_interface.rect(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10,1);
00260             if ( is_year_end_report )
00261                 font_charts.center_put(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10,"Faculty Changes & Adjustments Report");
00262             else
00263                 font_charts.center_put(REPORT_X1+100,REPORT_Y1-13,REPORT_X1+630,REPORT_Y1+10,"Faculty Hires, Promotions, and Departures");
00264         }
00265     }
00266     else {
00267         //              report_paint_button(refreshFlag);
00268     }
00269 
00270     // paint the Back button
00271     int x=REPORT_X1+350, y=BUTTON_Y1;
00272     button_back.create_text( x-30, y, x+BUTTON_WIDTH, y+BUTTON_HEIGHT, "Back");
00273     button_back.paint();
00274 
00275     // if no details to show
00276     if ( cur_dept_ptr->display_faculty_array.size() == 0 ) {
00277         vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00278         return;
00279     }
00280 
00281     // begin chwg080999 avoiding (facultyPtr->faculty_recno==0)
00282     Faculty* facultyPtr = (Faculty*) cur_dept_ptr->display_faculty_array.get(report_faculty_recno);
00283     // end chwg080999
00284 
00285     if( refreshFlag == INFO_REPAINT ) {
00286         if ( is_year_end_report ) {
00287             browse_faculty.init( REPORT_X1, REPORT_Y1+10, REPORT_X2, REPORT_Y2+10,
00288                                  0, FACULTY_REC_HEIGHT,
00289                                  cur_dept_ptr->cur_faculty_array.size(),
00290                                  disp_display_faculty_rec, NULL ,1 );
00291             browse_faculty.open(report_faculty_recno,cur_dept_ptr->cur_faculty_array.size());
00292         }
00293         else {
00294             browse_faculty.init( REPORT_X1, REPORT_Y1+10, REPORT_X2, REPORT_Y2+10,
00295                                  0, FACULTY_REC_HEIGHT,
00296                                  cur_dept_ptr->display_faculty_array.size(),
00297                                  disp_display_faculty_rec, NULL ,1 );
00298             browse_faculty.open(report_faculty_recno,cur_dept_ptr->display_faculty_array.size());
00299         }
00300     }
00301     else {                                          // refreshFlag == INFO_UPDATE
00302         //                      browse_faculty.refresh(-1, cur_dept_ptr->faculty_array.faculty_count);
00303     }
00304     report_faculty_recno = browse_faculty.recno();
00305 
00306     last_faculty_count = cur_dept_ptr->faculty_array.faculty_count;
00307     vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
00308 }
00309 
00310 //
00311 // --- End of function FacultyRes::report_faculty_hired --- //
00312 #endif
00313 
00314 //------- Begin of function FacultyRes::report_paint_button ------//
00315 
00316 void FacultyRes::report_paint_button(int refreshFlag) {
00317     //-------- paint type buttons ------------//
00318     int x=REPORT_X1+50, y=BUTTON_Y1;
00319     button_type[0].create_text( x, y, x+BUTTON_WIDTH, y+BUTTON_HEIGHT, "List" );
00320     //  button_type[0].set_key( 'L' );
00321 
00322     x+=BUTTON_WIDTH+10;
00323     button_type[1].create_text( x, y, x+BUTTON_WIDTH, y+BUTTON_HEIGHT, "Detail" );
00324     //  button_type[1].set_key( 'D' );
00325     button_type.paint(report_type);
00326 
00327     mode_fac_sum_button.create_text(  REPORT_X1+BUTTON_WIDTH*2+80, BUTTON_Y1,
00328                                       REPORT_X1+BUTTON_WIDTH*3+80, BUTTON_Y1+BUTTON_HEIGHT,"Back",1);
00329     mode_fac_sum_button.paint();
00330 
00331     //---------- list mode -----------//
00332 
00333     if( report_type==REPORT_TYPE_LIST ) {
00334         x=REPORT_X1+BUTTON_WIDTH*3+110;
00335         for( int i=0 ; i<REPORT_MODE1_COUNT ; i++, x+=BUTTON_WIDTH+10 ) {
00336             button_mode1_array[i].create_text( x, y, x+BUTTON_WIDTH, y+BUTTON_HEIGHT, reportMode1StrArray[i], 0 );
00337             //                  button_mode1_array[i].set_key( '1' + i );
00338         }
00339 
00340         button_mode1_array.paint(report_list_mode);
00341     }
00342     else {                                          //------- detail mode ---------//
00343         Faculty* facultyPtr;
00344         facultyPtr = cur_dept_ptr->faculty_array.get_unpacked_faculty(report_faculty_recno);
00345         if( facultyPtr->age()>=55) {
00346 #if(GAME_VERSION>=200)
00347             x=REPORT_X1+BUTTON_WIDTH*3+90;
00348 #else
00349             x=REPORT_X1+BUTTON_WIDTH*3+135;
00350 #endif
00351             button_retire.create_text(x, y, x+BUTTON_WIDTH+30, y+BUTTON_HEIGHT,"Retirement",1);
00352             button_retire.paint();
00353         }
00354 
00355 #if(GAME_VERSION>=200)
00356         if ( facultyPtr->rank_level != ASSOC_PROF && facultyPtr->rank_level != FULL_PROF ) {
00357             button_dismiss.create_text( REPORT_X1+BUTTON_WIDTH*3+230, BUTTON_Y1,
00358                                         REPORT_X1+BUTTON_WIDTH*4+230, BUTTON_Y1+BUTTON_HEIGHT,"Dismiss",1);
00359             if ( facultyPtr->is_dismissed )
00360                 button_dismiss.disable();
00361             button_dismiss.paint();
00362         }
00363 #endif
00364 
00365         if( report_faculty_recno > 1 )
00366             image_interface.put_back(REPORT_X2-90,BUTTON_Y1,"L-ARW-UP");
00367         else
00368             image_interface.put_back(REPORT_X2-90,BUTTON_Y1,"L-ARW-DB");
00369 
00370         if( report_faculty_recno < cur_dept_ptr->faculty_array.faculty_count )
00371             image_interface.put_back(REPORT_X2-40,BUTTON_Y1,"R-ARW-UP");
00372         else
00373             image_interface.put_back(REPORT_X2-40,BUTTON_Y1,"R-ARW-DB");
00374     }
00375 }
00376 
00377 //------- End of function FacultyRes::report_paint_button ------//
00378 
00379 //----- Begin of function FacultyRes::report_detect ------//
00381 void FacultyRes::report_detect() {
00382     //------- detect type buttons --------//
00383 
00384     if( report_type==REPORT_TYPE_LIST ||
00385         report_type==REPORT_TYPE_DETAIL ) {
00386         vga.use_front();
00387         if( button_type.detect() >= 0 ) {
00388             report_type = button_type.button_pressed;
00389             sys.redraw_all_flag = 1;
00390         }
00391     }
00392 
00393     //------- list mode ----------//
00394     if( report_type==REPORT_TYPE_LIST ) {
00395         browse_faculty.detect();
00396 
00397         if( button_mode1_array.detect() >= 0 ) {
00398             report_list_mode = button_mode1_array.button_pressed;
00399             sys.redraw_all_flag = 1;
00400         }
00401     }
00402     else if( report_type==REPORT_TYPE_DETAIL ) {
00403         //------- detail mode ----------//
00404         vga.use_back();
00405         browse_research.detect();
00406 
00407         vga.use_front();
00408         Faculty* facultyPtr;
00409         facultyPtr = cur_dept_ptr->faculty_array.get_unpacked_faculty(report_faculty_recno);
00410         if( facultyPtr->age()>=55) {
00411             if( button_retire.detect() ) {
00412                 report_type=REPORT_RETIRE;
00413                 sys.redraw_all_flag = 1;
00414             }
00415         }
00416 
00417 #if(GAME_VERSION>=200)
00418         if ( facultyPtr->rank_level != ASSOC_PROF && facultyPtr->rank_level != FULL_PROF ) {
00419             // need to ask player to confirm
00420             if ( button_dismiss.detect() ) {
00421                 char displayText[128];
00422                 short okCancel=0;
00423 
00424                 // Normal
00425                 if ( player_school.behavioral_response_speed == INPUT_LOW ) {
00426                     if ( facultyPtr->rank_level == SHORT_TERM_ADJUNCT ) {
00427                         sprintf( displayText, "The contract for %s will be terminated at the end of this year.", facultyPtr->name() );
00428                         facultyPtr->dismiss_trimester = TRIMESTER_PER_YEAR - player_school.cur_trimester;
00429                     }
00430                     else
00431                         if ( facultyPtr->rank_level == LONG_TERM_ADJUNCT ) {
00432                             int yearCount  = (info.game_date-facultyPtr->start_teaching_date) / 365;
00433                             int monthCount = ((info.game_date-facultyPtr->start_teaching_date) % 365) / 30;
00434                             int remainYear;
00435 
00436                             if ( monthCount )
00437                                 remainYear = 5-yearCount%5-1;
00438                             else
00439                                 remainYear = 5-yearCount%5;
00440 
00441                             sprintf( displayText, "The contract for %s will be terminated at the end of year %d.", facultyPtr->name(), remainYear+info.financial_year() );
00442                             facultyPtr->dismiss_trimester = (remainYear+1)*TRIMESTER_PER_YEAR-player_school.cur_trimester;
00443                         }
00444                         else
00445                             if ( facultyPtr->rank_level == ASST_PROF ) {
00446                                 int yearCount  = (info.game_date-facultyPtr->start_teaching_date) / 365;
00447                                 int monthCount = ((info.game_date-facultyPtr->start_teaching_date) % 365) / 30;
00448                                 int remainYear;
00449 
00450                                 if ( monthCount )
00451                                     remainYear = 3-yearCount%3-1;
00452                                 else
00453                                     remainYear = 3-yearCount%3;
00454 
00455                                 sprintf( displayText, "The contract for %s will be terminated at the end of year %d.", facultyPtr->name(), remainYear+info.financial_year() );
00456                                 facultyPtr->dismiss_trimester = (remainYear+1)*TRIMESTER_PER_YEAR-player_school.cur_trimester;
00457                             }
00458                 }
00459                 else
00460                     // Faster speed
00461                     if ( player_school.behavioral_response_speed == INPUT_MEDIUM ) {
00462                         sprintf( displayText, "The contract for %s will be terminated at the end of this year.", facultyPtr->name() );
00463                         facultyPtr->dismiss_trimester = TRIMESTER_PER_YEAR-player_school.cur_trimester;
00464                     }
00465                     else
00466                         // Lightspeed
00467                         if ( player_school.behavioral_response_speed == INPUT_HIGH ) {
00468                             sprintf( displayText, "The contract for %s will be terminated at the end of this trimester.", facultyPtr->name() );
00469                             facultyPtr->dismiss_trimester = 1;
00470                         }
00471 
00472                 if ( box.ask( displayText ) ) {
00473                     facultyPtr->satisfaction_index *= 0.1;
00474                     facultyPtr->is_dismissed = 1;
00475                     sys.redraw_all_flag = 1;
00476                 }
00477             }
00478         }
00479 #endif
00480 
00481         if(mouse.single_click(REPORT_X2-90,BUTTON_Y1,REPORT_X2-65,BUTTON_Y1+25)) {
00482             if( --report_faculty_recno < 1 ) {
00483                 report_faculty_recno = 1;
00484                 audio.play_wav("BEEPS-N1",audio.int_to_DsVolume(config.sound_effect_volume));
00485             }
00486             if(report_faculty_recno > 1) {
00487                 image_interface.put_back(REPORT_X2-90,BUTTON_Y1,"L-ARW-DN");
00488                 vga.blt_buf(REPORT_X2-90,BUTTON_Y1,REPORT_X2-65,BUTTON_Y1+25);
00489                 audio.play_wav("BEEPS-1",audio.int_to_DsVolume(config.sound_effect_volume));
00490             }
00491             sys.redraw_all_flag=1;
00492         }
00493 
00494         if(mouse.single_click(REPORT_X2-40,BUTTON_Y1,REPORT_X2-15,BUTTON_Y1+25)) {
00495             if( ++report_faculty_recno > cur_dept_ptr->faculty_array.faculty_count ) {
00496                 report_faculty_recno = cur_dept_ptr->faculty_array.faculty_count;
00497                 audio.play_wav("BEEPS-N1",audio.int_to_DsVolume(config.sound_effect_volume));
00498             }
00499             if(report_faculty_recno < cur_dept_ptr->faculty_array.faculty_count) {
00500                 image_interface.put_back(REPORT_X2-40,BUTTON_Y1,"R-ARW-DN");
00501                 vga.blt_buf(REPORT_X2-40,BUTTON_Y1,REPORT_X2-15,BUTTON_Y1+25);
00502                 audio.play_wav("BEEPS-1",audio.int_to_DsVolume(config.sound_effect_volume));
00503             }
00504             sys.redraw_all_flag=1;
00505         }
00506     }
00507     else if( report_type==REPORT_RETIRE ) {
00508         vga.use_front();
00509         if(retire_spinner.detect()) {
00510         }
00511 
00512         if( button_retire_offer.detect() ) {
00513             Faculty* facultyPtr;
00514             String str1;
00515             int rc;
00516 
00517             facultyPtr = cur_dept_ptr->faculty_array.get_unpacked_faculty(report_faculty_recno);
00518             str1 = facultyPtr->name();
00519 
00520             if(cur_dept_ptr->faculty_array.is_deleted(report_faculty_recno))
00521                 rc=2;
00522             else {
00523                 int offerDollar=(int)(facultyPtr->salary*(*(retire_spinner.var_ptr))/100);
00524                 rc=facultyPtr->think_accept_retire(offerDollar);
00525             }
00526 
00527             if(rc==1)
00528                 str1 += "  accepts the retirement offer. ";
00529             else
00530                 str1 += "  rejects the retirement offer. ";
00531             box.msg(str1);
00532 
00533             report_type=REPORT_TYPE_DETAIL;
00534             sys.redraw_all_flag = 1;
00535         }
00536         if( button_retire_cancel.detect() ) {
00537             report_type=REPORT_TYPE_DETAIL;
00538             sys.redraw_all_flag = 1;
00539         }
00540     }
00541 }
00542 
00543 //------- End of function FacultyRes::report_detect ------//
00544 
00545 #if(GAME_VERSION>=200)
00546 // --- Begin of function FacultyRes::report_hired_detect --- //
00547 //
00548 int FacultyRes::report_hired_detect() {
00549     if (button_back.detect()) {
00550         if ( faculty_res.is_year_end_report ) {
00551             button_back.push();
00552             sys.redraw_all_flag = 1;
00553             return 1;
00554         }
00555         else {
00556             button_back.push();
00557             current_report_type = last_report_type;     // REPORT_TYPE_INSTITUTION_TURNOVER
00558             //                  current_report_mode = 0;
00559             sys.redraw_all_flag = 1;
00560         }
00561     }
00562     browse_faculty.detect();
00563     return 0;
00564 }
00565 
00566 //
00567 // --- End of function FacultyRes::report_hired_detect --- //
00568 #endif
00569 
00570 //-------- Begin of static function disp_faculty_rec --------//
00571 //
00572 static void disp_faculty_rec(int recNo, int x, int y, int refreshFlag) {
00573     Faculty* facultyPtr = cur_dept_ptr->faculty_array.get_unpacked_faculty(recNo);
00574 
00575     vga_back.d3_panel_down( x, y, x+browse_faculty.rec_width-6, y+browse_faculty.rec_height-1, 1 );
00576 
00577     //--------- display the faculty portrait ---------//
00578 
00579     // 0-don't paint centre
00580     vga_back.d3_panel_down( x+5, y+8, x+FACULTY_PHOTO_WIDTH+6, y+FACULTY_PHOTO_HEIGHT+9, 1, 0 );
00581 
00582     vga_back.put_bitmap( x+6, y+9, faculty_photo_res[facultyPtr->photo_id]->bitmap_ptr);
00583 
00584     // 0=don't paint centre
00585     vga_back.d3_panel_down( x+74, y+4, x+browse_faculty.rec_width-10, y+browse_faculty.rec_height-6, 1, 0 );
00586 
00587     //------------ display info -------------//
00588 
00589     switch( faculty_res.report_list_mode ) {
00590     case REPORT_MODE1_BASIC:
00591 #if(GAME_VERSION>=200)
00592         facultyPtr->disp_summary_basic(x+79, y+7, x+350, refreshFlag,0);
00593 #else
00594         facultyPtr->disp_summary_basic(x+79, y+7, x+350, refreshFlag);
00595 #endif
00596         break;
00597 
00598     case REPORT_MODE1_ACTIVITY:
00599         facultyPtr->disp_summary_activity(x+79, y+7, x+350, refreshFlag);
00600         break;
00601 
00602     case REPORT_MODE1_ASSEST:                     //### fred 1023
00603         facultyPtr->disp_summary_assess(x+79, y+7, x+350, refreshFlag);
00604         break;
00605     }
00606 }
00607 
00608 //-------- End of static function disp_faculty_rec --------//
00609 
00610 #if(GAME_VERSION>=200)
00611 //-------- Begin of static function disp_display_faculty_rec --------//
00612 //
00613 static void disp_display_faculty_rec(int recNo, int x, int y, int refreshFlag) {
00614     Faculty* facultyPtr;
00615     if ( faculty_res.is_year_end_report )
00616         facultyPtr = (Faculty*) cur_dept_ptr->cur_faculty_array.get(recNo);
00617     else
00618         facultyPtr = (Faculty*) cur_dept_ptr->display_faculty_array.get(recNo);
00619 
00620     if (( facultyPtr->employ_status == 0 ) && (faculty_res.is_year_end_report ))
00621         return;
00622 
00623     vga_back.d3_panel_down( x, y, x+browse_faculty.rec_width-6, y+browse_faculty.rec_height-1, 1 );
00624 
00625     //--------- display the faculty portrait ---------//
00626 
00627     // 0-don't paint centre
00628     vga_back.d3_panel_down( x+5, y+8, x+FACULTY_PHOTO_WIDTH+6, y+FACULTY_PHOTO_HEIGHT+9, 1, 0 );
00629 
00630     vga_back.put_bitmap( x+6, y+9, faculty_photo_res[facultyPtr->photo_id]->bitmap_ptr);
00631 
00632     // 0=don't paint centre
00633     vga_back.d3_panel_down( x+74, y+4, x+browse_faculty.rec_width-10, y+browse_faculty.rec_height-6, 1, 0 );
00634 
00635     //------------ display info -------------//
00636 
00637     facultyPtr->disp_summary_basic(x+79, y+7, x+350, refreshFlag,1);
00638 }
00639 
00640 //-------- End of static function disp_display_faculty_rec --------//
00641 #endif
00642 
00643 //------ Begin of function Faculty::disp_summary_basic -------//
00645 #if(GAME_VERSION>=200)
00646 void Faculty::disp_summary_basic(int x, int y, int xColumn2, int refreshFlag, int displayModeFlag)
00647 #else
00648     void Faculty::disp_summary_basic(int x, int y, int xColumn2, int refreshFlag)
00649 #endif
00650 {
00651     int x2=x+97;
00652 
00653     //--------------- display fields -----------//
00654 
00655     font_chartsm.field( x, y   , "Name"         , x2, name(), xColumn2-1, refreshFlag );
00656     font_chartsm.field( x, y+17, "Gender/ethnicity", x2, game_str_res.gender_ethnic_str(gender_ethnic_group), xColumn2-1, refreshFlag );
00657     font_chartsm.field( x, y+34, "Age"        , x2, age(), 1, xColumn2-1, refreshFlag );
00658     font_chartsm.field( x, y+51, "Rank"      , x2, game_str_res.rank_str(rank_level), xColumn2-1, refreshFlag );
00659 
00660     x =xColumn2;
00661     x2=x+162;
00662 
00663     font_chartsm.field( x, y   , "Salary"           , x2, salary, 2, REPORT_X2-30, refreshFlag );
00664     //  font_chartsm.field( x, y+17, "Employed period"  , x2, employed_period(), REPORT_X2-30, refreshFlag );
00665 #if(GAME_VERSION>=200)
00666     if ( displayModeFlag ) {
00667         char employStr[123];
00668         if ( employ_status == 0 )
00669             strcpy(employStr,"0 years");
00670         else
00671             strcpy(employStr,employed_period());
00672         font_chartsm.field( x, y+17, "Time in rank" , x2, employStr, REPORT_X2-30, refreshFlag );
00673     }
00674     else
00675         font_chartsm.field( x, y+17, "Time in rank" , x2, employed_period(), REPORT_X2-30, refreshFlag );
00676 #else
00677     font_chartsm.field( x, y+17, "Time in rank" , x2, employed_period(), REPORT_X2-30, refreshFlag );
00678 #endif
00679 #if(GAME_VERSION>=200)
00680     if ( displayModeFlag ) {
00681         char statusStr[123];
00682         switch(employ_status) {
00683         case 0: strcpy(statusStr,"New hire"); break;
00684         case 1: strcpy(statusStr,"Departure"); break;
00685         case 2: strcpy(statusStr,"Promotion"); break;
00686         default: strcpy(statusStr,"");
00687         }
00688         font_chartsm.field( x, y+34, "Status change", x2, statusStr, REPORT_X2-30, refreshFlag );
00689     }
00690     else
00691         font_chartsm.field( x, y+34, "Off-duty trimester", x2, game_str_res.trimester_str(off_duty_trimester), REPORT_X2-30, refreshFlag );
00692 #else
00693     font_chartsm.field( x, y+34, "Off-duty trimester", x2, game_str_res.trimester_str(off_duty_trimester), REPORT_X2-30, refreshFlag );
00694 #endif
00695     font_chartsm.field( x, y+51, "Satisfaction index", x2, (int) satisfaction_index, 3, REPORT_X2-30, refreshFlag );
00696 
00697     if( faculty_res.report_type==REPORT_TYPE_LIST) {
00698         x2+=140;
00699         int h1,h2,h3;
00700         h1=(int)(21*performance_teaching/100);
00701         h2=(int)(21*performance_scholarship/100);
00702         h3=(int)(21*performance_research/100);
00703         vga_back.bar(x2-1,y+62-h3-h2-h1,x2+13,y+64,V_BLACK);
00704         vga_back.v_indicator(x2, y+63-h3-h2-h1, x2+12, y+63-h3-h2, performance_teaching, performance_teaching, VGA_RED );
00705         vga_back.v_indicator(x2, y+63-h3-h2, x2+12, y+63-h3, performance_scholarship, performance_scholarship, VGA_YELLOW );
00706         vga_back.v_indicator(x2, y+63-h3, x2+12, y+63, performance_research, performance_research, VGA_SEA_GREEN );
00707     }
00708 }
00709 
00710 //-------- End of function Faculty::disp_summary_basic -------//
00711 
00712 //------ Begin of function Faculty::disp_summary_activity -------//
00714 void Faculty::disp_summary_activity(int x, int y, int xColumn2, int refreshFlag) {
00715     int x2=x+200;
00716 
00717     //--------------- display fields -----------//
00718     font_chartsm.field( x, y   , "Teaching load",   x2, hour_str(teaching_contact_hour), xColumn2-1, refreshFlag );
00719     font_chartsm.field( x, y+17, "Course preparation", x2, hour_str(discretionary_hour_array[DT_COURSE_PREPARATION]), xColumn2-1, refreshFlag );
00720     font_chartsm.field( x, y+34, "Out-of-class student contact", x2, hour_str(discretionary_hour_array[DT_OUT_OF_CLASS_STUDENT_CONTACT]), xColumn2-1, refreshFlag );
00721     font_chartsm.field( x, y+51, "Educational development", x2, hour_str(discretionary_hour_array[DT_EDUCATIONAL_DEVELOPMENT]), xColumn2-1, refreshFlag );
00722     x=xColumn2;
00723     x2=x+210;
00724     font_chartsm.field( x, y   , "Research", x2, hour_str(discretionary_hour_array[DT_RESEARCH]), REPORT_X2-30, refreshFlag  );
00725     font_chartsm.field( x, y+17, "Scholarship", x2, hour_str(discretionary_hour_array[DT_SCHOLARSHIP]), REPORT_X2-30, refreshFlag  );
00726     font_chartsm.field( x, y+34, "Institutional and public service", x2, hour_str(discretionary_hour_array[DT_INSTITUTIONAL_AND_PUBLIC_SERVICE]), REPORT_X2-30, refreshFlag  );
00727     font_chartsm.field( x, y+51, "Total", x2, hour_str(total_hour()), REPORT_X2-30, refreshFlag  );
00728 }
00729 
00730 //-------- End of function Faculty::disp_summary_activity -------//
00731 
00732 //------ Begin of function Faculty::disp_summary_assess -------//
00734 void Faculty::disp_summary_assess(int x, int y, int xColumn2, int refreshFlag) {
00735     int x2=x+135;
00736 
00737     //--------------- display fields -----------//
00738 
00739     int x3=x2+39;
00740 
00741     font_chartsm.field( x, y   , "Talent: Teaching"   , x2, (int) talent_teaching, 3, x3, refreshFlag );
00742     font_chartsm.field( x, y+17, "Talent: Scholarship", x2, (int) talent_scholarship, 3, x3, refreshFlag);
00743     font_chartsm.field( x, y+34, "Talent: Research"   , x2, (int) talent_research, 3, x3, refreshFlag );
00744 
00745     x3++;
00746     int x4 = xColumn2-5;
00747 
00748     vga_back.indicator( x3, y+3 , x4, y+14, talent_teaching   , 100, VGA_RED , -2);
00749     vga_back.indicator( x3, y+20, x4, y+31, talent_scholarship, 100, VGA_YELLOW , -2);
00750     vga_back.indicator( x3, y+37, x4, y+48, talent_research   , 100, VGA_SEA_GREEN , -2);
00751 
00752     //--------------------------------------------------//
00753 
00754     x =xColumn2;
00755     x2=x+170;
00756 
00757     x3=x2+39;
00758 
00759     font_chartsm.field( x, y   , "Performance: Teaching"   , x2, (int) performance_teaching, 3, x3, refreshFlag  );
00760     font_chartsm.field( x, y+17, "Performance: Scholarship", x2, (int) performance_scholarship, 3, x3, refreshFlag  );
00761     font_chartsm.field( x, y+34, "Performance: Research"   , x2, (int) performance_research, 3, x3, refreshFlag  );
00762     font_chartsm.field( x, y+51, "Satisfaction index"      , x2, (int) satisfaction_index, 3, x3, refreshFlag  );
00763 
00764     x3++;
00765     x4=REPORT_X2-30;
00766 
00767     vga_back.indicator( x3, y+3 , x4, y+14, performance_teaching   , 100, VGA_RED , -2);
00768     vga_back.indicator( x3, y+20, x4, y+31, performance_scholarship, 100, VGA_YELLOW , -2);
00769     vga_back.indicator( x3, y+37, x4, y+48, performance_research   , 100, VGA_SEA_GREEN , -2);
00770     vga_back.indicator( x3, y+54, x4, y+65, satisfaction_index     , 100, VGA_VIOLET , -2);
00771 }
00772 
00773 //-------- End of function Faculty::disp_summary_assess -------//
00774 
00775 //------ Begin of function Faculty::disp_detail_std -------//
00777 void Faculty::disp_detail_std(int refreshFlag) {
00778     int x=REPORT_X1, y=REPORT_Y1;
00779 
00780     vga_back.d3_panel_down( REPORT_X1, REPORT_Y1, REPORT_X2, REPORT_Y2, 2);
00781 
00782     //--------- display the faculty portrait ---------//
00783     // 0-don't paint centre
00784     vga_back.d3_panel_down( x+5, y+8, x+FACULTY_PHOTO_WIDTH+6, y+FACULTY_PHOTO_HEIGHT+9, 1, 0 );
00785     //## fred 990414 //BUGHERE photo_id == 0
00786     vga_back.put_bitmap( x+6, y+9, faculty_photo_res[photo_id]->bitmap_ptr );
00787 
00788     //---------- display details ----------//
00789 
00790     x+=73;
00791     y+=5;
00792 
00793     int xColumn2 = x+270;
00794 
00795 #if(GAME_VERSION>=200)
00796     disp_summary_basic(x, y, xColumn2, refreshFlag, 0 );
00797 #else
00798     disp_summary_basic(x, y, xColumn2, refreshFlag );
00799 #endif
00800 
00801     x=REPORT_X1+5;
00802 
00803     user_interface.h_line(REPORT_X1, y+72, REPORT_X2-REPORT_X1+1, 2 );
00804 
00805     y+=77;
00806 
00807     disp_summary_activity(x, y, xColumn2, refreshFlag );
00808 
00809     user_interface.h_line(REPORT_X1, y+72, REPORT_X2-REPORT_X1+1, 2 );
00810 
00811     y+=77;
00812 
00813     disp_summary_assess(x, y, xColumn2, refreshFlag );
00814 
00815     user_interface.h_line(REPORT_X1, y+72, REPORT_X2-REPORT_X1+1, 2 );
00816 
00817     y+=77;
00818 
00819     //--------------------------------------------//
00820 
00821     disp_research_proposal(y, refreshFlag);
00822 }
00823 
00824 //-------- End of function Faculty::disp_detail_std -------//
00825 
00826 //------ Begin of function Faculty::disp_research_proposal -------//
00828 void Faculty::disp_research_proposal(int y, int refreshFlag) {
00829     int x=REPORT_X1+5;
00830 
00831     //------ display browser heading -------//
00832 
00833     font_chartsm.put( x+10   , y, "Sponsored research project dollars" );
00834     font_chartsm.put( x+355, y, "Status" );
00835     font_chartsm.put( x+500, y, "Months to status change" );
00836 
00837     y+=17;
00838 
00839     if( refreshFlag == INFO_REPAINT ) {
00840         //----------- create browser -----------//
00841         user_interface.rect(REPORT_X1+5, y-20, REPORT_X2-5, REPORT_Y2-25);
00842 
00843         browse_research.init( REPORT_X1+5, y, REPORT_X2-5, REPORT_Y2-25, 0, RESEARCH_REC_HEIGHT,
00844                               research_proposal_count, disp_research_rec, NULL, 0 );
00845 
00846         browse_research.open(faculty_res.report_research_recno,research_proposal_count);
00847     }
00848     else {                                          // refreshFlag == INFO_UPDATE
00849         //              if( research_proposal_count != last_research_count )      // no. of sharepersons are changed, refresh it
00850         //              browse_research.paint();
00851         //              else
00852         //                      browse_research.update();                // update only
00853     }
00854     user_interface.rect(REPORT_X1+5, y-20, REPORT_X2-5, REPORT_Y2-25);
00855     browse_research.paint();
00856     browse_research.refresh(-1, research_proposal_count);
00857     faculty_res.report_research_recno = browse_research.recno();
00858 
00859     last_research_count = research_proposal_count;
00860 
00861     //---------- display total ------------//
00862 
00863     y=REPORT_Y2-20;
00864 
00865     font_chartsm.field( x, y, "Total projects", x+110, research_proposal_count, 1, x+195, refreshFlag );
00866     x+=340;
00867 
00868     //## chea 221199
00869     //  font_chartsm.field( x, y, "Total monthly expenditures", x+195, research_month_expense * 1000, 2, REPORT_X2-5, refreshFlag );            // it's in the thousand unit
00870     // it's in the thousand unit
00871     font_chartsm.field( x, y, "Total monthly expenditures", x+195, research_month_expense , 2, REPORT_X2-5, refreshFlag );
00872 
00873 }
00874 
00875 //-------- End of function Faculty::disp_research_proposal -------//
00876 
00877 //-------- Begin of static function disp_research_rec --------//
00878 //
00879 static void disp_research_rec(int recNo, int x, int y, int refreshFlag) {
00880     Faculty* facultyPtr = cur_dept_ptr->faculty_array.get_unpacked_faculty(faculty_res.report_faculty_recno);
00881 
00882     ResearchProposal* researchProposal = facultyPtr->research_proposal_array + recNo - 1;
00883 
00884     x+=2;
00885     y+=1;
00886 
00887     //## chea 221199
00888     //  font_chartsm.disp(x      , y, (int) researchProposal->total_dollars *1000, 2, x+200 );  //## chea 161199 1.8.3
00889     font_chartsm.disp(x  , y, (int) researchProposal->total_dollars , 2, x+200 );
00890     font_chartsm.disp(x+350, y, researchProposal->status==RESEARCH_PROPOSED ? "Proposed" : "Active", x+495 );
00891     font_chartsm.disp(x+500, y, (researchProposal->date_to_next_status-info.game_date)/30, 1, x+550 );
00892 }
00893 
00894 //-------- End of static function disp_research_rec --------//

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