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

Password:

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

Oletter.cpp

Go to the documentation of this file.
00001 #include <OSYS.H>
00002 #include <OCONFIG.H>
00003 #include <OGAMESET.H>
00004 #include <OWORLDMT.H>
00005 #include <OGSET.H>
00006 #include <OVGA.H>
00007 #include <OMOUSE2.H>
00008 #include <COLOR.H>
00009 #include <OFINANCE.H>
00010 #include <OPSCHOOL.H>
00011 #include <OFONT.H>
00012 #include <ODATE.H>
00013 #include <OGAMESTR.H>
00014 #include <OMOUSE.H>
00015 #include <OLETTER.H>
00016 #include <OVBROW98.H>
00017 #include <OIFACE.H>
00018 #include <OFACULTY.H>
00019 #include <ODEPT.H>
00020 #include <ONAMERES.H>
00021 #include <ODEPTRES.H>
00022 #include <OENROLL.H>
00023 #include <OSTUOFF.H>
00024 #include <OSCHLRES.H>
00025 #include <OPEERSCH.H>
00026 #include <OATHLETI.H>
00027 #include <OINFO.H>
00028 #include <OBUTTON.H>
00029 #include <OMATH.H>
00030 #include <OLOSEGAM.H>
00031 
00032 enum {                                            // screen coordinates
00033     REPORT_X1 = ZOOM_X1+15,
00034     REPORT_Y1 = ZOOM_Y1+25,
00035     REPORT_X2 = ZOOM_X2-15,
00036     REPORT_Y2 = ZOOM_Y2-55
00037 };
00038 
00039 enum {
00040     BOTTOM_BUTTON_X0 = REPORT_X1+70,
00041     BOTTOM_BUTTON_X1 = REPORT_X1+170,
00042     BOTTOM_BUTTON_Y1 = REPORT_Y2+15,
00043     BOTTOM_BUTTON_X2 = REPORT_X2-20,
00044     BOTTOM_BUTTON_Y2 = REPORT_Y2+40
00045 };
00046 
00047 enum {
00048     BOTTOM_BUTTON_WIDTH = 125,
00049     BOTTOM_BUTTON_HEIGHT = 25,
00050     HELP_BUTTON_COUNT = 3,
00051     BOTTOM_BUTTON_DISTANCE
00052     = (BOTTOM_BUTTON_X2-BOTTOM_BUTTON_X1-BOTTOM_BUTTON_WIDTH*2)/3
00053 };
00054 
00055 enum {                                            // the bg image id
00056     BG_PIC_ID = 6
00057 };
00058 
00059 #if(GAME_VERSION>=200)
00060 static float protagonist_ck1 = 3.50f;
00061 static float protagonist_ck2 = 1.75f;
00062 static float protagonist_ck3 = 1.50f;
00063 #endif
00064 
00065 static short *bottom_button_up_bitmap[HELP_BUTTON_COUNT];
00066 static short *bottom_button_down_bitmap[HELP_BUTTON_COUNT];
00067 #if(GAME_VERSION>=200)
00068 static Button button_return;
00069 #endif
00070 static Button button_back;
00071 static Button button_pgup;
00072 static Button button_pgdn;
00073 static int letter_report_init_flag;
00074 static void welcome_letter_disp_rep_row(int,int,int,int);
00075 static int welcome_letter_detect_rep_row(int,int,int);
00076 static void eval_letter_disp_rep_row(int,int,int,int);
00077 static int eval_letter_detect_rep_row(int,int,int);
00078 
00079 static VBrowse98 letter_browser;
00080 static int name_id1,name_id2,name_id3;
00081 static int staff2_name_id1,staff2_name_id2,staff2_name_id3;
00082 static double surplusDeficit;
00083 
00084 static old_scen_page_number=-1;
00085 static max_scen_page_number=2;
00086 
00087 static old_welcome_page_number=-1;
00088 static max_welcome_page_number=5;
00089 
00090 static old_eval_page_number=-1;
00091 #if(GAME_VERSION>=200)
00092 static max_eval_page_number=4;
00093 #else
00094 static max_eval_page_number=3;
00095 #endif
00096 
00097 #if(GAME_VERSION>=200)
00098 static old_state_page_number=-1;
00099 static max_state_page_number=3;
00100 #endif
00101 
00102 //--------- Define sort_data -----------//
00103 #if(GAME_VERSION>=200)
00106 struct SortData {
00107     int idx;
00108     float strength;
00109     float consistency;
00110     float k1;
00111     char tag;
00112 };
00113 #else
00116 struct SortData {
00117     int idx;
00118     float data;
00119     char tag;
00120 };
00121 #endif
00122 
00123 static struct SortData sort_data[SCORE_VAR_COUNT];
00124 
00125 //---------- define text ----------------------//
00126 #if(GAME_VERSION>=200)
00127 static char *area_str[SCORE_VAR_COUNT]= {
00128     "Degrees granted                       ",
00129     "Faculty research performance          ",
00130     "Institutional prestige                                       ",
00131     "Educational quality                  ",
00132     "Scholarship broadly defined          ",        // 1007
00133     "Student diversity                    ",
00134     "Faculty diversity                    ",
00135     "Alumni giving                 ",
00136     "Faculty morale                       ",
00137     "Student morale                       ",
00138     "Staff morale                         ",
00139     "Current surplus deficit percent      ",
00140     "Smoothed surplus deficit percent     ",
00141     "Endowment payout rate relative       ",        // 1007
00142     "Deferred maintenance backlog percent ",
00143 };
00144 #endif
00145 
00146 //------- Begin of function Letter::Letter -----------//
00148 Letter::Letter() {
00149     //  init();
00150 }
00151 
00152 //--------- End of function Letter::Letter -----------//
00153 
00154 //------- Begin of function Letter::~Letter -----------//
00156 Letter::~Letter() {
00157     deinit();
00158 }
00159 
00160 //--------- End of function Letter::~Letter -----------//
00161 
00162 //------- Begin of function Letter::deinit ---------------//
00164 void Letter::deinit() {
00165     //--------- deallocate memory -------------//
00166     for (int i = 0; i < HELP_BUTTON_COUNT; i++) {
00167         if (bottom_button_up_bitmap[i]) {
00168             mem_del(bottom_button_up_bitmap[i]);
00169             mem_del(bottom_button_down_bitmap[i]);
00170             bottom_button_up_bitmap[i] = NULL;
00171             bottom_button_down_bitmap[i] = NULL;
00172         }
00173     }
00174     letter_report_init_flag = 0;
00175 }
00176 
00177 //--------- End of function Letter::deinit ---------------//
00178 
00179 //------- Begin of function Letter::init -----------------//
00181 void Letter::init() {
00182     memset(this,0,sizeof(Letter));
00183     name_id1=m.random(name_res.first_name_count)+1;
00184     name_id2=m.random(name_res.middle_name_count)+1;
00185     name_id3=m.random(name_res.last_name_count)+1;
00186     staff2_name_id1=m.random(name_res.first_name_count);
00187     staff2_name_id2=m.random(name_res.middle_name_count);
00188     staff2_name_id3=m.random(name_res.last_name_count);
00189     eval_page_number=1;
00190     welcome_page_number=1;
00191     scen_page_number=1;
00192 #if(GAME_VERSION>=200)
00193     state_page_number=1;
00194 #endif
00195     for (int i = 0; i < HELP_BUTTON_COUNT; i++) {
00196         bottom_button_up_bitmap[i] = NULL;
00197         bottom_button_down_bitmap[i] = NULL;
00198     }
00199     letter_report_init_flag = 0;
00200 }
00201 
00202 //--------- End of function Letter::init -----------------//
00203 
00204 /*
00205 enum{
00206   WELCOME_LETTER_PART1_BEGIN=1,
00207   WELCOME_LETTER_PART1_END=14,
00208   WELCOME_LETTER_PART2_BEGIN=15,
00209 };
00210 
00211 static void welcome_letter_disp_rep_row(int recno, int x, int y,int refreshFlag)
00212 {
00213 };
00214 
00215 static int welcome_letter_detect_rep_row(int recno, int x, int y)
00216 {
00217 return 0;
00218 };
00219 
00220 static void eval_letter_disp_rep_row(int recno, int x, int y,int refreshFlag)
00221 {
00222 static char * eval_context[]={
00223 "",
00224 "",
00225 "To   : ",
00226 "          President, ",
00227 "From:",
00228 "          Chair, Board of Trustees",
00229 "Date :   September 1,",
00230 "",
00231 "Dear President",
00232 "        The Compensation Committee of the Board has completed your performance evaluation",
00233 
00234 "for      -      . The Committee believes your performance has been weak. This",
00235 "will be reflected in your salary for next year.",
00236 "",
00237 
00238 "The Committee judges the degree of improvement or degradation in each of the fifteen performance",
00239 "areas listed below. While these do not provide a complete view of the University, we believe they",
00240 "cover the most important areas. In many cases, the absolute level of the criterion is less",
00241 "important than the trend. With this in mind, 8.0f estimated the percent increase or decrease",
00242 "over last year's score and arrayed the indicators accordingly.",
00243 "",
00244 "The Committee and full Board would appreciate your continuing attention to these matters.",
00245 "We would like to see positive trends for all the items during the next year.",
00246 
00247 "",
00248 "",
00249 "",
00250 "",
00251 "",
00252 "",
00253 "",
00254 "",
00255 "",
00256 "",
00257 "",
00258 "",
00259 "",
00260 "",
00261 "",
00262 "",
00263 "",
00264 "",
00265 "",
00266 "",
00267 "",
00268 };
00269 
00270 int tab1=x+5;
00271 int tab2=x+20;
00272 String str;
00273 String str2;
00274 
00275 str=eval_context[recno];
00276 font_san.put(tab2,y+2,str);
00277 
00278 if(recno==2)
00279 {
00280 str2=player_school.player_first_name;
00281 str2+=" ";
00282 str2+=player_school.player_last_name;
00283 font_blue_san.put(tab2+48,y+2,str2);
00284 }
00285 if(recno==3)
00286 {
00287 str2=player_school.school_name;
00288 font_blue_san.put(tab2+120,y+2,str2);
00289 }
00290 if(recno==4)
00291 {
00292 str2=name_res.get_name_str(name_id1,name_id2,name_id3);
00293 font_blue_san.put(tab2+48,y+2,str2);
00294 }
00295 if(recno==6)
00296 {
00297 if(info.game_month<9)
00298 str2=m.format(info.game_year-1,16);
00299 else
00300 str2=m.format(info.game_year,16);
00301 font_blue_san.put(tab2+150,y+2,str2);
00302 }
00303 if(recno==8)
00304 {
00305 str2=player_school.player_last_name;
00306 str2+=" ,";
00307 font_blue_san.put(tab2+100,y+2,str2);
00308 }
00309 if(recno==10)
00310 {
00311 if(info.game_month<9)
00312 str2=m.format(info.game_year-2,16);
00313 else
00314 str2=m.format(info.game_year-1,16);
00315 font_blue_san.put(tab2+20,y+2,str2);
00316 if(info.game_month<9)
00317 str2=m.format(info.game_year-1,16);
00318 else
00319 str2=m.format(info.game_year,16);
00320 font_blue_san.put(tab2+60,y+2,str2);
00321 }
00322 if(recno==12)
00323 {
00324 if(finance.last_year.asset_array[AC_OPERATING_RESERVE] < 0)
00325 {
00326 str2="        Last year the University's operating reserve was in the red by ";
00327 str2+=m.format(-finance.last_year.asset_array[AC_OPERATING_RESERVE],2);
00328 str2+=" thousand.";
00329 font_red_san.put(tab2,y+2,str2);
00330 }
00331 if(finance.last_year.asset_array[AC_OPERATING_RESERVE] > 0)
00332 {
00333 str2="        Last year the University's operating reserve was in the blue by ";
00334 str2+=m.format(finance.last_year.asset_array[AC_OPERATING_RESERVE],2);
00335 str2+=" thousand.";
00336 font_blue_san.put(tab2,y+2,str2);
00337 }
00338 }
00339 };
00340 
00341 static int eval_letter_detect_rep_row(int recno, int x, int y)
00342 {
00343 return 0;
00344 };
00345 */
00346 
00348 enum{TMP_SCENARIO_COUNT = 10};
00349 static int max_scn_page[TMP_SCENARIO_COUNT] = {
00350     1,3,3,3,3,3,3,2,3,3
00351 };
00352 static int scn_id[TMP_SCENARIO_COUNT] = {
00353     SCN_RAISE_SALARY,
00354     SCN_INVEST_ACADEMIC,
00355     SCN_TEACHING_QUALITY,                           //## fred0301
00356     SCN_RESEARCH_QUALITY,                           //## fred0301
00357     SCN_WINNING_ATHLETICS,
00358     SCN_LIMIT_TUITION_GROWTH,
00359     SCN_COMPENSATE_FOR_ENROLLMENT_SHIFTS,           //## fred0301
00360     SCN_STUDENT_DIVERSITY,
00361     SCN_FACULTY_DIVERSITY,
00362     SCN_BALANCE_BUDGET,
00363 };
00364 static char* scn_name[TMP_SCENARIO_COUNT] = {
00365     "Scenario 1  -- PAY BETTER",
00366     "Scenario 2  -- ALLOCATE NEW MONEY",
00367     "Scenario 3  -- TEACH BETTER",
00368     "Scenario 4  -- IMPROVE RESEARCH PERFORMANCE",
00369     "Scenario 5  -- WIN GAMES",
00370     "Scenario 6  -- REDUCE TUITION",
00371     "Scenario 7  -- RESPOND TO ENROLLMENT SHIFTS",
00372     "Scenario 8  -- ENROLL MORE MINORITY STUDENTS",
00373     "Scenario 9  -- HIRE MORE MINORITY FACULTY MEMBERS",
00374     "Scenario 10 -- BALANCE THE BUDGET",
00375 };
00376 
00378 
00379 void Letter::scen_welcome_letter_report(int refreshFlag) {
00380     int tab1=REPORT_X1,tab2=REPORT_X1+70,
00381         tab3=REPORT_X1+100,tab4=REPORT_X1+700;
00382     int vtab1=REPORT_Y1+20,vtab2=REPORT_Y1+70,
00383         vtab3=REPORT_Y1+100,vtab4=REPORT_Y1+350;
00384 
00385     vga.use_back();
00386 
00387     if (refreshFlag == INFO_REPAINT) {
00388         if(letter_report_init_flag )
00389             deinit();
00390 
00391         //------------- paint the background ----------------//
00392         if (!letter_report_init_flag) {
00393             sys.set_speed(0);
00394             max_scen_page_number=max_scn_page[player_school.scenario_id-1];
00395             user_interface.bg_img(BG_PIC_ID, &vga_back);
00396 #if(GAME_VERSION>=200)
00397             letter_date = info.game_start_date;
00398 #endif
00399             font_letter.center_put(REPORT_X1+50,REPORT_Y1,REPORT_X1+680,REPORT_Y1+20,"Scenario Welcome Letter ");
00400             font_letter.center_put(REPORT_X1+50,REPORT_Y1+30,REPORT_X1+680,REPORT_Y1+50,scn_name[player_school.scenario_id-1]);
00401             letter_report_init_flag = 1;
00402             button_back.create_text(350,vtab4+7,450,vtab4+28,"Proceed");
00403             button_pgup.create_text(570,vtab4-10,660,vtab4+13,"Prev. page");
00404             button_pgdn.create_text(570,vtab4+15,660,vtab4+38,"Next page");
00405         }
00406     }
00407     else {
00408         vga.use_back();
00409     }
00410 
00411     if((scen_page_number!=old_scen_page_number)||(refreshFlag == INFO_REPAINT)) {
00412         old_scen_page_number=scen_page_number;
00413         String context;
00414 
00416         // Scn 1 SCN_BALANCE_BUDGET //
00418         if(player_school.scenario_id==SCN_BALANCE_BUDGET) {
00419             if(scen_page_number==1) {
00420                 context = "To : ";
00421                 context += player_school.player_first_name;
00422                 context += " ";
00423                 context += player_school.player_last_name;
00424                 context += ", ";
00425                 context += player_school.school_name;
00426 #if(GAME_VERSION>=200)
00427                 context += "           ";
00428                 context += info.date_str_julian(letter_date);
00429 #else
00430                 context += "           September 1, ";
00431                 context +=m.format(info.game_year,16);
00432 #endif
00433                 context +="\nFrom : ";
00434                 context +=name_res.get_name_str(name_id1,name_id2,name_id3);
00435                 context +=", Chair, Board of Trustees\n\n\n";
00436                 context +="    The budget deficit you project alarms the Board. ";
00437 
00438                 if(player_school.school_type==PRIVATE_SCHOOL)
00439                     context +="Unexpected shortfalls in research grants, gifts, and other income";
00440                 if(player_school.school_type==LIBERAL_ARTS_SCHOOL)
00441                     context +="Unexpected shortfalls in gifts, tuition and other income";
00442                 if(player_school.school_type==PUBLIC_SCHOOL)
00443                     context +="Unexpected shortfalls in research grants, state appropriations, tuition and other income";
00444                 if(player_school.school_type==COMPREHENSIVE_SCHOOL)
00445                     context +="Unexpected shortfalls in state appropriations and other income";
00446 
00447                 context +=" have thrown the budget ";
00448                 context +=m.format(finance.this_year.surplus_deficit,2);
00449                 context +=" thousands into the ";
00450                 if(finance.this_year.surplus_deficit<0)
00451                     context+="red ";
00452                 else
00453                     context+="black ";
00454                 context +=".  Worse, hopes of more income anytime soon are vain.  At our recent meeting, you disappointed the Board by advancing no remedy to cope with the new circumstances promptly.\n";
00455             }
00456 
00457             if(scen_page_number==2) {
00458                 context = "We are disturbed that you currently are targeting a 3 percent budget \
00459                                                           deficit for next year.\n\n";
00460 
00461                 context +="    You must act immediately. ";
00462                 context +="Although some actions may require more than one year to phase in, you must balance the budget within three years from now. ";
00463                 context +="Furthermore, after achieving a balanced budget during years 4, 5, 6, you should run surpluses for years 7, 8, 9 or until reserves rise to their current level of ";
00464                 context +=m.format(player_school.scenario_target[0],2);
00465                 context +=" thousand.";
00466             }
00467 
00468             if(scen_page_number==3) {
00469                 context = "You must accomplish the above without diminishing the average \"Performance ";
00470                 context += "indicators\" and \"Attitudes toward the institution\" scores (listed on the \"Score\" screen.)";
00471 
00472             }
00473         }
00474 
00476         // Scn 2 SCN_RAISE_SALARY //
00478         if(player_school.scenario_id==SCN_RAISE_SALARY) {
00479             if(scen_page_number==1) {
00480                 context = "To : ";
00481                 context += player_school.player_first_name;
00482                 context += " ";
00483                 context += player_school.player_last_name;
00484                 context += ", ";
00485                 context += player_school.school_name;
00486 #if(GAME_VERSION>=200)
00487                 context += "           ";
00488                 context += info.date_str_julian(letter_date);
00489 #else
00490                 context += "           September 1, ";
00491                 context +=m.format(info.game_year,16);
00492 #endif
00493                 context +="\nFrom : ";
00494                 context +=name_res.get_name_str(name_id1,name_id2,name_id3);
00495                 context +=", Chair, Board of Trustees\n\n";
00496                 context +="    The Board agrees with the concern you expressed about faculty salaries ";
00497                 context +="at our last meeting.  At the meeting you convinced ";
00498                 context +="us that the salaries we offer are 14% below the market. ";
00499                 context +="Because competitive salaries are expected to remain constant, this means our salaries need to improve by 14%. We hope you can accomplish this within ten years, or in less time if possible.";
00500                 /*
00501                   if(player_school.school_type==PRIVATE_SCHOOL || player_school.school_type==LIBERAL_ARTS_SCHOOL)
00502                   {
00503                   context +="Further, because salaries at competing institutions will grow about 20% during the next five years, ";
00504                   context +="our university must increase salaries 10 plus 20, or 30% within five years.\n";
00505                   }
00506                   else
00507                   {
00508                   context +="Further, because salaries at competing institutions will grow about 10% during the next five years, ";
00509                   context +="our university must increase salaries 10 plus 10, or 20% within five years.\n";
00510                   }
00511                 */
00512             }       
00513             /*
00514               if(scen_page_number==2)
00515               {
00516 
00517               if(player_school.school_type==PRIVATE_SCHOOL || player_school.school_type==LIBERAL_ARTS_SCHOOL)
00518               {
00519               context ="    We ask you to pass from analysis to prescription. Because our faculty is the University, we must remedy our low salaries as soon as possible. How will you raise faculty \ 
00520               salaries 30% and pay for the raises?  What combination of new money and reduced or eliminated programs will you use to finance the raises? Consider carefully \ 
00521               how, beyond a more contented faculty, the higher salaries guarantee the continuity and ";
00522               }
00523               else
00524               {
00525               context ="    We ask you to pass from analysis to prescription. Because our faculty is the University, we must remedy our low salaries as soon as possible. How will you raise faculty \ 
00526               salaries 20% and pay for the raises?  What combination of new money and reduced or eliminated programs will you use to finance the raises? Consider carefully \ 
00527               how, beyond a more contented faculty, the higher salaries guarantee the continuity and ";
00528               }
00529 
00530               context +="increase the worth of our university.";
00531               }
00532 
00533               if(scen_page_number==3)
00534               {
00535               }
00536             */
00537         }   
00538 
00540         // Scn 3 SCN_INVEST_ACADEMIC //
00542         if(player_school.scenario_id==SCN_INVEST_ACADEMIC) {
00543             if(scen_page_number==1) {
00544                 context = "To : ";
00545                 context += player_school.player_first_name;
00546                 context += " ";
00547                 context += player_school.player_last_name;
00548                 context += ", ";
00549                 context += player_school.school_name;
00550 #if(GAME_VERSION>=200)
00551                 context += "           ";
00552                 context += info.date_str_julian(letter_date );
00553 #else
00554                 context += "           September 1, ";
00555                 context +=m.format(info.game_year,16);
00556 #endif
00557                 context +="\nFrom : ";
00558                 context +=name_res.get_name_str(name_id1,name_id2,name_id3);
00559                 context +=", Chair, Board of Trustees\n\n";
00560                 context +="    Congratulations. ";
00561                 // find a female
00562                 int staff_number=game_set.open_db("N_FIRST")->rec_count();
00563                 while(name_res.is_male(staff2_name_id1)) {
00564                     staff2_name_id1++;
00565                     if(staff2_name_id1>staff_number)staff2_name_id1=1;
00566                 }
00567                 context +=name_res.get_name_str(staff2_name_id1,staff2_name_id2,staff2_name_id3);
00568                 context +=" has just pledged ";
00569                 context +=m.format(player_school.scenario_base1,2);
00570                 context +=" thousands to enhance the ";
00571 
00572                 if(player_school.school_type==PRIVATE_SCHOOL)
00573                     context +="sciences and allied fields";
00574                 if(player_school.school_type==LIBERAL_ARTS_SCHOOL)
00575                     context +="humanities and allied fields";
00576                 if(player_school.school_type==PUBLIC_SCHOOL)
00577                     context +="social sciences and allied fields";
00578                 if(player_school.school_type==COMPREHENSIVE_SCHOOL)
00579                     context +="business, education, applied science and technology";
00580 
00581                 context +=" at our university. ";
00582                 context +="The pledge will raise next year's budget (for ";
00583 #if(GAME_VERSION>=200)
00584                 context += info.date_str_ymd( date.year(letter_date)+1, 0, 0 );
00585 #else
00586                 context +=m.format(info.game_year+1,16);
00587 #endif
00588                 context +=") by about ";
00589                 context +=m.format(player_school.scenario_base2,2);
00590                 context +=" thousand.\n\n";
00591 
00592                 context +="    The donor gave to improve ";
00593 
00594                 //-------- show the list of active departments related to the scenario -----//
00595 
00596                 char* departmentPrivate[] = {
00597                     "biology", "chemistry", "physics", "mathematics", "computer science",
00598                     "engineering", "environmental science", NULL
00599                 };
00600 
00601                 char* departmentLiberalArts[] = {
00602                     "American studies", "classics", "English", "history", "philosophy",
00603                     "foreign languages", "art", "music", "drama", NULL
00604                 };
00605 
00606                 char* departmentPublic[] = {
00607                     "anthropology and sociology", "economics", "law", "political science",
00608                     "psychology", "gender/ethnic studies", "communication", NULL
00609                 };
00610 
00611                 char* departmentCompreh[] = {
00612                     "agricultural science", "technology services", "business", "education",
00613                     "health services", NULL
00614                 };
00615 
00616                 char** departmentList;
00617                 int  hasDepartmentCount=0, thisCount=0;
00618 
00619                 if(player_school.school_type==PRIVATE_SCHOOL)
00620                     departmentList = departmentPrivate;
00621                 if(player_school.school_type==LIBERAL_ARTS_SCHOOL)
00622                     departmentList = departmentLiberalArts;
00623                 if(player_school.school_type==PUBLIC_SCHOOL)
00624                     departmentList = departmentPublic;
00625                 if(player_school.school_type==COMPREHENSIVE_SCHOOL)
00626                     departmentList = departmentCompreh;
00627 
00628                 // count the number of available departments for later placement of the word "and"
00629                 for( int i=0 ; i<12 && departmentList[i] ; i++ ) {
00630                     if( department_array.has_department(departmentList[i]) )
00631                         hasDepartmentCount++;
00632                 }
00633 
00634                 // count the number of available departments for later placement of the word "and"
00635                 for( i=0 ; i<12 && departmentList[i] ; i++ ) {
00636                     if( department_array.has_department(departmentList[i]) ) {
00637                         thisCount++;
00638 
00639                         context += departmentList[i];
00640 
00641                         if( thisCount == hasDepartmentCount ) // last one
00642                             context += ".";
00643                         // second last one
00644                         else if( thisCount == hasDepartmentCount-1 )
00645                             context += " and ";
00646                         else
00647                             context += ", ";
00648                     }
00649                 }
00650             }
00651 
00652             if(scen_page_number==2) {
00653                 context ="How will you achieve the goal for which she gave so generously? \n\n\
00654                                                                     You could concentrate big money on one or two departments or\n\
00655                                                                 spend a little on many. The number of students affected by an alternative represents one criterion for \
00656                                                                 selection. Another criterion is how your allocation of resources affects nonscience departments \
00657                                                                 and such important facets of university life as the quality of teaching.";
00658             }
00659             if(scen_page_number==3) {
00660                 context ="    The Board will judge your \
00661                                                                 success first in meeting the donor's expectations, which may encourage other donors, \
00662                                                                 and then in lifting the prestige of our university.";
00663             }
00664         }
00665 
00667         // Scn 4 SCN_TEACHING_QUALITY //
00669         if(player_school.scenario_id==SCN_TEACHING_QUALITY) {
00670             if(scen_page_number==1) {
00671                 context = "To : ";
00672                 context += player_school.player_first_name;
00673                 context += " ";
00674                 context += player_school.player_last_name;
00675                 context += ", ";
00676                 context += player_school.school_name;
00677 #if(GAME_VERSION>=200)
00678                 context += "           ";
00679                 context += info.date_str_julian(letter_date);
00680 #else
00681                 context += "           September 1, ";
00682                 context += m.format(info.game_year,16);
00683 #endif
00684                 context += "\nFrom : ";
00685                 context += name_res.get_name_str(name_id1,name_id2,name_id3);
00686                 context += ", Chair, Board of Trustees\n\n\n";
00687 
00688                 context +="    The recent report by the accreditation team alarms the Board. Our proud university \
00689                                         should not be cited for poor teaching. Something must be done.\n\n\
00690                                             The team attributes our failure to inattention to education rather than to lack of \
00691                                         resources. They cited discontinued courses, student";
00692                 // find a female
00693             }
00694             if(scen_page_number==2) {
00695                 context ="demoralization, and insufficient \
00696                                         faculty time and attention devoted to students. They cited poor teaching in the \
00697                                         classroom. While some departments received a passing grade, most cry out for improvement.\n\n";
00698                 context +="    In five rather than the usual ten years, the accreditation team will return. At that time, the Board \
00699                                 expects the University's educational quality will be rated good. ";
00700                 //                              context += m.format(player_school.sub_score[S_EDUCATIONAL_QUALITY][THIS_MONTH],1);                      //BUGHERE
00701                 context +="When they come in ten years for \
00702                                                                 our next regular examination, we expect our teaching will be rated excellent.";
00703                 //                              context += m.format(player_school.sub_score[S_EDUCATIONAL_QUALITY][THIS_MONTH]+15,1);;          //BUGHERE
00704                 //                              context +="excellent.";
00705             }
00706             if(scen_page_number==3) {
00707                 context ="    Remembering the team's opinion that a lack of physical and financial \
00708                                         resources did not cause our poor teaching, the Board does not expect a \
00709                                         mere plea for more money to achieve accreditation. Rather, we expect a plan to put in our classrooms a \
00710                                         faculty that loves to teach.";
00711                 //                              How will you reach these goals?";
00712             }
00713         }
00714 
00715         if(player_school.scenario_id==SCN_RESEARCH_QUALITY) {
00716             if(scen_page_number==1) {
00717                 context = "To : ";
00718                 context += player_school.player_first_name;
00719                 context += " ";
00720                 context += player_school.player_last_name;
00721                 context += ", ";
00722                 context += player_school.school_name;
00723 #if(GAME_VERSION>=200)
00724                 context += "           ";
00725                 context += info.date_str_julian(letter_date);
00726 #else
00727                 context += "           September 1, ";
00728                 context += m.format(info.game_year,16);
00729 #endif
00730                 context += "\nFrom : ";
00731                 context += name_res.get_name_str(name_id1,name_id2,name_id3);
00732                 context += ", Chair, Board of Trustees\n\n\n";
00733                 context +="    At our last meeting you convinced the Board that faculty research and scholarship at our university are mediocre by national standards. \
00734                                         Something must be done.\n\n\
00735                                             The Faculty Senate Research Committee attributes this condition to a lack of commitment \
00736                                         by both faculty and administrators rather than a";
00737             }
00738             if(scen_page_number==2) {
00739                 context = "lack of resources. The Committee blames excessive teaching loads \
00740                                         and insufficient research support. \
00741                                         They blame low faculty morale. \
00742                                         Most departments require improvement.\n\n";
00743                 context += "    In ten years, the Board and the Faculty Senate want the University's performance rating in scholarship to be strong. ";
00744                 context += "The rating reflects the scholarship of integration, application, and \
00745                                         teaching as well as knowledge";
00746             }
00747             if(scen_page_number==3) {
00748                 context ="creation. Remembering that the University's lackluster \
00749                                         research performance is not due to a lack of physical and financial resources, \
00750                                         the Board expects more than a \
00751                                         plea for money. Rather, we expect a plan to breathe life into our laboratories and \
00752                                         to reestablish the University's preeminence as a center of scholarship and discovery. How will you reach these goals?";
00753             }
00754         }
00755 
00756         if(player_school.scenario_id==SCN_WINNING_ATHLETICS) {
00757             if(scen_page_number==1) {
00758                 context = "To : ";
00759                 context += player_school.player_first_name;
00760                 context += " ";
00761                 context += player_school.player_last_name;
00762                 context += ", ";
00763                 context += player_school.school_name;
00764 #if(GAME_VERSION>=200)
00765                 context += "           ";
00766                 context += info.date_str_julian(letter_date);
00767 #else
00768                 context += "           September 1, ";
00769                 context += m.format(info.game_year,16);
00770 #endif
00771                 context += "\nFrom : ";
00772                 context += name_res.get_name_str(name_id1,name_id2,name_id3);
00773                 context += ", Chair, Board of Trustees\n\n\n";
00774                 context +="    The Alumni Association has impressed upon the Board the mediocrity of our athletes. \
00775                                         The Board agrees that our institution should win more games, thereby strengthening the loyalty \
00776                                         of alumni and attracting new students to all our departments.  Something must be done.";
00777             }
00778             if(scen_page_number==2) {
00779                 context ="    The Alumni Association criticizes our admissions standards as too high and our athletics budget as too low. \
00780                                         We are faulted in particular for providing insufficient financial aid for athletes. \
00781                                         The Alumni expect our inattention to athletes to be corrected without damaging the academic \
00782                                         performance that, at bottom, represents the worth of our university. ";
00783                 context +="    In four years, the Board and Alumni Association will review your progress";
00784 
00785                 //                              context +=player_school.goal_deadline[PLAQUE_SILVER];
00786                 //                              context +=" years,";
00787 
00788             }
00789             if(scen_page_number==3) {
00790                 context ="as reflected in our teams' victories. By then, we want \
00791                                                         our teams to win more than 60% of their games. We would \
00792                                                         be especially pleased if they were \
00793                                                         then winning more than 60% in a higher NCAA Division. \
00794                                                         How will you achieve these goals and at what cost?";
00795 
00796                 //                                      context ="we want our teams to win more than 60 percent of \ 
00797                 //                                      their games. We would be especially pleased if they were then winning more than 60 \ 
00798                 //                                      percent in a higher league.  How will you achieve these goals and at what cost?";
00799             }
00800         }
00801         if(player_school.scenario_id==SCN_LIMIT_TUITION_GROWTH) {
00802             if(scen_page_number==1) {
00803                 context = "To : ";
00804                 context += player_school.player_first_name;
00805                 context += " ";
00806                 context += player_school.player_last_name;
00807                 context += ", ";
00808                 context += player_school.school_name;
00809 #if(GAME_VERSION>=200)
00810                 context += "           ";
00811                 context += info.date_str_julian(letter_date);
00812 #else
00813                 context += "           September 1, ";
00814                 context += m.format(info.game_year,16);
00815 #endif
00816                 context += "\nFrom : ";
00817                 context += name_res.get_name_str(name_id1,name_id2,name_id3);
00818                 context += ", Chair, Board of Trustees\n\n\n";
00819                 context +="    The Board notes with alarm that our tuition has \
00820                                         escalated at a real rate of 3% per year. \
00821                                         Equal extravagance at other institutions does not relieve us \
00822                                         of our responsibility to lessen the burden on our students and \
00823                                         their parents. People will rebel if higher education continues to \
00824                                         be seen";
00825             }
00826             if(scen_page_number==2) {
00827                 context ="as pushing aside their other needs.\n\n\
00828                                             Believing the time has come to take a stand, the Board notifies you of its firm policy \
00829                                         that our tuition shall not rise. In fact, the Board would like tuition to go down.\n\n\
00830                                             Until now the University has estimated the growth of nontuition revenue, funded new \
00831                                         programs, salary increases, and other costs, and then closed the gap by raising tuition. \
00832                                         You will now estimate tuition like ";
00833             }
00834             if(scen_page_number==3) {
00835                 context ="other revenue and close the gap by disciplining expenditures. The new \
00836                                         budgeting will strengthen internal financial discipline by forcing trade-offs \
00837                                         among competing expenditures.  Most important, tuition \
00838                                         reductions will make us accessible to a larger pool of talented students, thus \
00839                                         ensuring the worth and continuity of our university.";
00840             }
00841         }
00842         if(player_school.scenario_id==SCN_COMPENSATE_FOR_ENROLLMENT_SHIFTS) {
00843             /*                  int yy1,yy2,yy3;
00844                                 //BUGHERE
00845                                 yy1=(int)(player_school.scenario_target[0]/SCN3_TARGET_MULTIPLIER);
00846                                 yy2=(int)(player_school.scenario_target[1]*SCN3_TARGET_MULTIPLIER);
00847                                 yy3=(int)(player_school.scenario_target[2]/SCN3_TARGET_MULTIPLIER);
00848             */
00849             if(scen_page_number==1) {
00850                 context = "To : ";
00851                 context += player_school.player_first_name;
00852                 context += " ";
00853                 context += player_school.player_last_name;
00854                 context += ", ";
00855                 context += player_school.school_name;
00856 #if(GAME_VERSION>=200)
00857                 context += "           ";
00858                 context += info.date_str_julian(letter_date);
00859 #else
00860                 context += "           September 1, ";
00861                 context += m.format(info.game_year,16);
00862 #endif
00863                 context += "\nFrom : ";
00864                 context += name_res.get_name_str(name_id1,name_id2,name_id3);
00865                 context += ", Chair, Board of Trustees\n\n\n";
00866                 context +="    Shifts of enrollment among departments have distorted course listings, overloaded some \
00867                                         teachers and buildings, and left others idle. These shifts leave some courses half-filled while \
00868                                         students are foreclosed from desired, overfilled courses. Some departments have \
00869                                         upped the proportion of lecture courses to accommodate increased student numbers.";
00870             }
00871             if(scen_page_number==2) {
00872 
00873                 context ="    Because the world has moved on and made a return to the previous pattern unlikely, the \
00874                                         Board shares the concern you expressed at our last meeting.  Going beyond describing \
00875                                         misalignments, however, how will you restructure \
00876                                         our academic programs and faculty resources to match today's needs?\
00877                                         \n\n    By the second semester of year ";
00878 
00879                 context +=m.format(date.year(info.game_start_date)+player_school.goal_deadline[PLAQUE_BRONZE],4);
00880 
00881                 context +=", the Board expects educational quality to increase";
00882                 //                              context +=m.format(yy1,1);
00883                 //                              context +=" to ";
00884                 //                              context +=m.format(player_school.scenario_target[0],1);
00885                 context +=", course denials to decrease, and average";
00886             }
00887             if(scen_page_number==3) {
00888                 //                              context =" from ";
00889                 //                              context +=m.format(yy2,1);
00890                 //                              context +=" to ";
00891                 //                              context +=m.format(player_school.scenario_target[1],1);
00892                 context ="teaching load hours to rise ";
00893                 //                              context +=m.format(yy3,1);
00894                 //                              context +=" to ";
00895                 //                              context +=m.format(player_school.scenario_target[2],1);
00896                 context +="substantially. What is your plan?";
00897             }
00898         }
00899         if(player_school.scenario_id==SCN_STUDENT_DIVERSITY) {
00900             if(scen_page_number==1) {
00901                 context = "To : ";
00902                 context += player_school.player_first_name;
00903                 context += " ";
00904                 context += player_school.player_last_name;
00905                 context += ", ";
00906                 context += player_school.school_name;
00907 #if(GAME_VERSION>=200)
00908                 context += "           ";
00909                 context += info.date_str_julian(letter_date);
00910 #else
00911                 context += "           September 1, ";
00912                 context += m.format(info.game_year,16);
00913 #endif
00914                 context += "\nFrom : ";
00915                 context += name_res.get_name_str(name_id1,name_id2,name_id3);
00916                 context += ", Chair, Board of Trustees\n\n\n";
00917                 context += "    The Board shares your concern about the scarcity of minorities among our students. \
00918                                         Further, because minorities are equally scarce among freshmen as among seniors, we see no \
00919                                         evidence that time will cure the problem. Instead, you must act \
00920                                         promptly to increase the number of minorities.";
00921 
00922             }
00923             if(scen_page_number==2) {
00924                 context += "    The Board sets your goal as boosting the number of minority students twofold in ten \
00925                                         years, that is, from ";
00926                 context+=m.format(player_school.scenario_base,3);
00927                 context+=" to ";
00928                 context+=m.format(player_school.scenario_target[0],3);
00929                 context += ". At the same time, we expect this will make us \
00930                                         accessible to new pools of talented students, guaranteeing the worth and thus continuity \
00931                                         of our university.";
00932             }
00933         }
00934         if(player_school.scenario_id==SCN_FACULTY_DIVERSITY) {
00935             if(scen_page_number==1) {
00936                 context = "To : ";
00937                 context += player_school.player_first_name;
00938                 context += " ";
00939                 context += player_school.player_last_name;
00940                 context += ", ";
00941                 context += player_school.school_name;
00942 #if(GAME_VERSION>=200)
00943                 context += "           ";
00944                 context += info.date_str_julian(letter_date);
00945 #else
00946                 context += "           September 1, ";
00947                 context += m.format(info.game_year,16);
00948 #endif
00949                 context += "\nFrom : ";
00950                 context += name_res.get_name_str(name_id1,name_id2,name_id3);
00951                 context += ", Chair, Board of Trustees\n\n\n";
00952                 context += "    At our last meeting, you told the Board your concern about the few minorities and \
00953                                         women on the faculty. We agree heartily and expect the shortfall to be redressed \
00954                                         promptly.\n\n";
00955                 context += "    You told us the University has about the same underrepresentation";
00956             }
00957             if(scen_page_number==2) {
00958                 context="in all \
00959                                         fields, and that minorities are even more underrepresented than women are. The scarcity of \
00960                                         minorities and women among young as well as old faculty shows the problem will not \
00961                                         correct itself.\n\n    The Board sets your goal as boosting minority representation by \
00962                                         50% in five years.";
00963                 //                              : that \ 
00964                 //                                      is, from ";
00965 
00966                 //                              context+=m.format(player_school.scenario_target[0]/1.5f,3);
00967                 //                              context+=" to ";
00968                 //                              context+=m.format(player_school.scenario_target[0],3);
00969                 context+=". For women, the goal is a 25% increase in five years.";
00970                 //: from ";
00971                 //                              context+=m.format(player_school.scenario_target[1]/1.25f,3);
00972                 //                              context+=" to ";
00973                 //                              context+=m.format(player_school.scenario_target[1],3);
00974 
00975             }
00976             if(scen_page_number==3) {
00977                 context="    We ask how you will accomplish these goals and with what change \
00978                                         in budget and staff size. At the same time, we expect the enhanced representation of women \
00979                                         and minorities on the faculty to enrich all aspects of university life.";
00980             }
00981         }
00982 
00983         font_letter.put_paragraph(180,190,670,440,context.str_buf);
00984         String pagestr;
00985         pagestr = scen_page_number;
00986         pagestr += "/";
00987         pagestr += max_scen_page_number;
00988         font_letter.put(680,vtab4+20,pagestr.str_buf);
00989 
00990         button_back.paint();
00991         if(scen_page_number<=1)button_pgup.disable();
00992         if(scen_page_number>=max_scen_page_number)button_pgdn.disable();
00993 
00994         button_pgup.paint();
00995         button_pgdn.paint();
00996 
00997         if(refreshFlag != INFO_REPAINT)
00998             vga.blt_buf(180,190,670,440);
00999     }
01000     //------- blt the back buffer to front buffer -------//
01001 
01002     if(refreshFlag == INFO_REPAINT)
01003         vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
01004 
01005     vga.use_front();
01006 }
01007 
01008 int Letter::scen_welcome_letter_detect() {
01009     if (!letter_report_init_flag)
01010         return 0;
01011     vga.use_front();
01012     if(scen_page_number<max_scen_page_number)
01013         if(button_pgdn.detect()) {
01014             if(scen_page_number<max_scen_page_number)
01015                 scen_page_number++;
01016             sys.redraw_all_flag=1;
01017         };
01018 
01019     if(scen_page_number>1)
01020         if(button_pgup.detect()) {
01021             if(scen_page_number>1)
01022                 scen_page_number--;
01023             sys.redraw_all_flag=1;
01024         };
01025 
01026     if(button_back.detect()   ||
01027        (m.upper(mouse.is_key(mouse.scan_code, mouse.event_skey_state, (WORD) 0, K_UNIQUE_KEY))=='W')) {
01028         scen_page_number=1;
01029         old_scen_page_number=-1;
01030         if(sys.save_view_mode!=MODE_YEAR_END_REPORT) {
01031             sys.set_staying_view_mode(0);
01032             sys.set_view_mode(MODE_NORMAL);
01033         }
01034         else {
01035             sys.set_staying_view_mode(MODE_YEAR_END_REPORT);
01036         }
01037         return 1;
01038     }
01039     return 0;
01040 }
01041 
01043 
01044 int compare_ascend(const void *arg1,const void *arg2) {
01045     float p,q;
01046 #if(GAME_VERSION>=200)
01047     p=((struct SortData*)arg1)->strength;
01048     q=((struct SortData*)arg2)->strength;
01049 #else
01050     p=((struct SortData*)arg1)->data;
01051     q=((struct SortData*)arg2)->data;
01052 #endif
01053 
01054     if(p<q)return -1;
01055     if(p>q)return 1;
01056     return 0;
01057 };
01058 
01059 int compare_descend(const void *arg1,const void *arg2) {
01060     float p,q;
01061 #if(GAME_VERSION>=200)
01062     p=((struct SortData*)arg1)->strength;
01063     q=((struct SortData*)arg2)->strength;
01064 #else
01065     p=((struct SortData*)arg1)->data;
01066     q=((struct SortData*)arg2)->data;
01067 #endif
01068 
01069     if(p>q)return -1;
01070     if(p<q)return 1;
01071     return 0;
01072 };
01073 
01074 #if(GAME_VERSION>=200)
01075 int sort_consistency(const void *arg1, const void *arg2) {
01076     float p,q;
01077 
01078     p=((struct SortData*)arg1)->consistency;
01079     q=((struct SortData*)arg2)->consistency;
01080 
01081     if(p>q)return -1;
01082     if(p<q)return 1;
01083     return 0;
01084 }
01085 #endif
01086 
01087 //---------- Begin of function Letter::welcome_letter_report ------------//
01088 void Letter::welcome_letter_report(int refreshFlag) {
01089     int tab1=REPORT_X1,tab2=REPORT_X1+70,
01090         tab3=REPORT_X1+100,tab4=REPORT_X1+700;
01091     int vtab1=REPORT_Y1+20,vtab2=REPORT_Y1+70,
01092         vtab3=REPORT_Y1+100,vtab4=REPORT_Y1+350;
01093 
01094     vga.use_back();
01095 
01096     if (refreshFlag == INFO_REPAINT) {
01097         if(letter_report_init_flag )
01098             deinit();
01099 
01100         //------------- paint the background ----------------//
01101         if (!letter_report_init_flag) {
01102             sys.set_speed(0);
01103             user_interface.bg_img(BG_PIC_ID, &vga_back);
01104 
01105             font_letter.center_put(REPORT_X1+50,REPORT_Y1,REPORT_X1+680,REPORT_Y1+20,"Welcome Letter ");
01106 
01107             letter_report_init_flag = 1;
01108             button_back.create_text(350,vtab4+7,450,vtab4+28,"Proceed");
01109             button_pgup.create_text(570,vtab4-10,660,vtab4+13,"Prev. page");
01110             button_pgdn.create_text(570,vtab4+15,660,vtab4+38,"Next page");
01111         }
01112     }
01113     else {
01114         vga.use_back();
01115     }
01116 
01117     if((welcome_page_number!=old_welcome_page_number)||(refreshFlag == INFO_REPAINT)) {
01118         old_welcome_page_number=welcome_page_number;
01119         String context;
01120 
01121         if(welcome_page_number==1) {
01122             context = "To      :    ";
01123             context += player_school.player_first_name;
01124             context += " ";
01125             context += player_school.player_last_name;
01126             context += "\n";
01127 
01128             context += "              President, ";
01129             context += player_school.school_name;
01130             context += "\n";
01131 
01132             context += "From  :    ";
01133             context += name_res.get_name_str(name_id1,name_id2,name_id3);
01134             context += "\n";
01135 
01136             context += "              Chair, Board of Trustees",
01137                 context += "\n";
01138 
01139 #if(GAME_VERSION>=200)
01140             context += "Date   :    ";
01141             context += info.date_str_julian(letter_date);
01142 #else
01143             context += "Date   :    September 1, ";
01144             context +=m.format(info.game_year,16);
01145 #endif
01146             context += "\n";
01147             context += "\n";
01148 
01149             context +="Dear President ";
01150             context +=player_school.player_last_name;
01151             font_letter.put_paragraph(185,120,670,250,context.str_buf);
01152 
01153             context ="    Welcome to ";
01154             context +=player_school.school_name;
01155             context +=". The Board is pleased to have as distinguished a person as yourself as our new president.\n\n";
01156             context +="    The University has ";
01157             context +=m.format(department_array.department_count,4);
01158             context +=" departments with ";
01159             context +=m.format(department_array_faculty_level_history_FT,4);
01160             context +=" faculty members. We enroll ";
01161             context +=m.format(enroll_res_total_student_count,4);
01162             context +=" students and have ";
01163             for (int i=department_array.size(), totalDollar=0; i>0; i--) {
01164                 if (department_array.is_deleted(i))
01165                     continue;
01166                 // fix in ver 2
01167                 //totalDollar += department_array_total_research_dollar[i];
01168                 totalDollar += department_array_total_research_dollar[i-1];
01169             }
01170             context +=m.format(totalDollar,2);
01171             context +=" thousands of sponsored research expenditures monthly. The breakdown by departments is as follows :";
01172             //                  context +=m.format(department_res_general_dept_student_level_historyMT,4);
01173             //                  context +=" students have yet to declare a major)";
01174             //                  context +="\n";
01175             font_letter.put_paragraph(185,250,670,420,context.str_buf);
01176         }
01177         if(welcome_page_number==2) {
01178             int list_tab1=185;
01179             int list_tab2=500;
01180             int list_tab3=580;
01181             int list_tab4=660;
01182             int list_start_y=130;
01183             int list_line_spacing=290/(1+department_array.size());
01184 
01185             font_letter.put(list_tab2-50,list_start_y,"Faculty");
01186             font_letter.put(list_tab3-50,list_start_y,"Students");
01187             font_letter.put(list_tab4-50,list_start_y,"Research");
01188 
01189             for(int i=1;i<=department_array.size();i++) {
01190                 if(!department_array.is_deleted(i)) {
01191                     int y=list_start_y+i*list_line_spacing;
01192                     String tmp;
01193                     tmp=department_array[i]->name();
01194                     tmp.str_buf[tmp.len()-10]='\0';
01195                     font_letter.put(list_tab1,y,tmp.str_buf);
01196                     // fix in ver 2
01197                     //font_letter.right_put(list_tab2,y,m.format(department_array_faculty_array_faculty_count[i],4));
01198                     //font_letter.right_put(list_tab3,y,m.format(department_array_student_array_student_count[i],4));
01199                     //font_letter.right_put(list_tab4,y,m.format(department_array_total_research_dollar[i],2));
01200                     font_letter.right_put(list_tab2,y,m.format(department_array_faculty_array_faculty_count[i-1],4));
01201                     font_letter.right_put(list_tab3,y,m.format(department_array_student_array_student_count[i-1],4));
01202                     font_letter.right_put(list_tab4,y,m.format(department_array_total_research_dollar[i-1],2));
01203                 }
01204             }
01205         }
01206         if(welcome_page_number==3) {
01207             context ="    Traditional undergraduates number ";
01208             context +=m.format(enroll_res_student_count_UG_TRADITION,4);
01209             context +=", of which ";
01210             context +=m.format(student_office_percent_demanding_places_sl1,3);
01211             context +=" live in on-campus residence halls";
01212             context +=" and ";
01213             context +=m.format(department_res_general_dept_student_array_student_count,4);
01214             context +=" have yet to declare a major.";
01215 
01216             context +=" About ";
01217             context +=m.format(10 * school_res_player_peer_school_percent_get_bacc_in_5_year,3);
01218             context +=" graduate within five years. The University receives ";
01219             //                  context +=m.format(enroll_res_applications_rate_UG_TRADITION,4);                //### fred 1127  //## chea081099
01220             //### fred 1127  //## chea081099
01221             context +=m.format(enroll_res_applications_rate_UG_TRADITION,26);
01222             context +=" applications for every traditional undergraduate space. An additional ";
01223             context +=m.format(enroll_res_student_count_UG_NONTRADITION,4);
01224             //                  context +=m.format(enroll_res_student_count_UG_TRADITION,4);
01225             context +=" students attend part-time ";
01226             context +=" (nontraditional undergraduates) and ";
01227             context +=m.format(enroll_res_student_count_DISTANCE_LEARN,4);
01228             context +=" students enroll as distance learners.";
01229             context +=" About ";
01230             context +=m.format(enroll_res_overall_percent_minority,3);
01231             context +=" of students are minorities and ";
01232             context +=m.format(enroll_res_overall_percent_female,3);
01233             context +=" are women.";
01234             context +=" We have ",
01235                 context +=m.format(enroll_res_student_count_MASTER,4);
01236             context +=" master's students and ";
01237             context +=m.format(enroll_res_student_count_DOCTOR,4);
01238             context +=" doctoral students. ",
01239                 font_letter.put_paragraph(185,160,670,340,context.str_buf);
01240 
01241             //                  font_letter.put_paragraph(185,340,670,400,context.str_buf);
01242         }
01243         if(welcome_page_number==4) {
01244             context ="    Of our ";
01245             context +=m.format(department_array_faculty_level_history_FT,4);
01246             context +=" faculty members, ";
01247             //        context +=m.format(department_array_faculty_count_on_tenure_line,1);
01248             //## chea 110809 change by b.massy
01249             context +=m.format(department_array_faculty_count_on_tenure_line,0);
01250 
01251             context +=" are on the tenure line and ";
01252             //                  context +=m.format(department_array_faculty_count_tenured,1);
01253             //## chea 110809 change by b.massy
01254             context +=m.format(department_array_faculty_count_tenured,0);
01255 
01256             context +=" are tenured. ";
01257             /*
01258               context +=" We believe the tenure-line faculty scores at the ";
01259               context +=m.format(department_array.faculty_rank_in_research_talent,1);;
01260               context +="th";
01261               context +=" percentile nationally in research talent and the ";
01262               context +=m.format(department_array.faculty_rank_in_scholarship_talent,1);
01263               context +="th";
01264               context +=" percentile in scholarly talent, and that our whole faculty scores at the ";
01265               context +=m.format(department_array.faculty_rank_in_teaching_talent,1);
01266               context +="th";
01267               context +=" percentile in teaching talent. ";
01268             */
01269             context +="About ";
01270             int percentMinor = (department_array_faculty_gender_history_MINORITY_MALE_HISTORY_YEAR_COUNT_1+
01271                                 department_array_faculty_gender_history_MINORITY_FEMALE_HISTORY_YEAR_COUNT_1) * 100
01272                 / department_array_faculty_gender_history_GENDER_ETHNIC_TYPE_COUNT_N_TOTAL_1_HISTORY_YEAR_COUNT_1;
01273 
01274             int percentFemale = (department_array_faculty_gender_history_MINORITY_FEMALE_HISTORY_YEAR_COUNT_1+
01275                                  department_array_faculty_gender_history_NONMINORITY_FEMALE_HISTORY_YEAR_COUNT_1) * 100
01276                 / department_array_faculty_gender_history_GENDER_ETHNIC_TYPE_COUNT_N_TOTAL_1_HISTORY_YEAR_COUNT_1;
01277 
01278             context +=m.format(percentMinor,3);
01279             context +=" of faculty are minorities and ";
01280             context +=m.format(percentFemale,3);
01281             context +=" are women.";
01282             context +="\n\n";
01283             context +="  The University's men's football and women's basketball teams compete at the Division level ";
01284 
01285             if(player_school_athletic_program_intensity==INPUT_HIGH)
01286                 context +="I";
01287             if(player_school_athletic_program_intensity==INPUT_MEDIUM)
01288                 context +="II";
01289             if(player_school_athletic_program_intensity==INPUT_LOW)
01290                 context +="III";
01291 
01292             context +=". Last year's win/loss records were ";
01293 
01294             // Athletics *off = &athletics_office;
01295 
01296             int winCount, lossCount;
01297 
01298             winCount = int(off_football_probability_win * off_football_game_count_off_ncaa_level_input);
01299             lossCount = int(off_football_game_count_off_ncaa_level_input - winCount);
01300             context +=m.format(winCount,1);
01301             context +="-";
01302             context +=m.format(lossCount,1);
01303             context +=" and ";
01304 
01305             winCount = int(off_basketball_probability_win * off_basketball_game_count_off_ncaa_level_input);
01306             lossCount = int(off_basketball_game_count_off_ncaa_level_input - winCount);
01307             context +=m.format(winCount,1);
01308             context +="-";
01309             context +=m.format(lossCount,1);
01310             context +=", respectively.";
01311             font_letter.put_paragraph(185,180,670,420,context.str_buf);
01312         }
01313 
01314         if(welcome_page_number==5) {
01315             /*  
01316                 "",
01317                 "",
01318                 "",
01319                 "We will be watching these areas with special care during the years ahead.",
01320 
01321                 "The Board is counting on you and we wish you every success.",
01322                 "",
01323                 "We also want you to consider the following",
01324             */
01325             //                  context="";
01326 
01327             int surplusDeficit = (int)finance_last_year_surplus_deficit;
01328 
01329             if(surplusDeficit!=0) {
01330                 context= "    Last year the University's budget was in the ";
01331                 if(finance_last_year_surplus_deficit<0)
01332                     context+="red ";
01333                 else
01334                     context+="black ";
01335 
01336                 context+="by ";
01337 
01338                 if(surplusDeficit<0) {
01339                     context+=m.format(-surplusDeficit,2);
01340                 }
01341                 else {
01342                     context+=m.format(surplusDeficit,2);
01343                 }
01344 
01345                 context += " thousand (";
01346 
01347                 if(surplusDeficit<0)                      //## chea 110899 change by b.massy
01348                     context+=m.format((float)-surplusDeficit * 100 / finance_total_expense_total,24);
01349                 else
01350                     context+=m.format((float)surplusDeficit * 100 / finance_total_expense_total,24);
01351 
01352                 context += " of expenditures). ";
01353             }
01354 
01355             double test_surplus=finance_total_expense_total/finance_last_year_surplus_deficit;
01356             if(test_surplus==0.0)return;
01357             if(test_surplus<-0.25)
01358                 context+="The Board hopes you will correct this weak financial performance.";
01359             if(test_surplus>0.0)
01360                 context+="The Board hopes you will maintain this kind of strong financial performance.";
01361             else
01362                 context+="";
01363 
01364             font_letter.put_paragraph(185,170,670,240,context.str_buf);
01365 
01366             context="    The Board is counting on you and we wish you every success.";
01367             font_letter.put_paragraph(185,250,670,420,context.str_buf);
01368         }
01369 
01370         String pagestr;
01371         pagestr = welcome_page_number;
01372         pagestr += "/";
01373         pagestr += max_welcome_page_number;
01374         font_letter.put(680,vtab4+20,pagestr.str_buf);
01375 
01376         button_back.paint();
01377         if(welcome_page_number<=1)button_pgup.disable();
01378         if(welcome_page_number>=max_welcome_page_number)button_pgdn.disable();
01379 
01380         button_pgup.paint();
01381         button_pgdn.paint();
01382 
01383         if(refreshFlag != INFO_REPAINT)
01384             vga.blt_buf(185,140,670,420);
01385         //              vga.blt_buf(350,vtab4+10,450,vtab4+28);
01386         //              vga.blt_buf(570,vtab4-10,660,vtab4+13);
01387         //              vga.blt_buf(570,vtab4+15,660,vtab4+38);
01388     }
01389     //------- blt the back buffer to front buffer -------//
01390 
01391     if(refreshFlag == INFO_REPAINT)
01392         vga.blt_buf(ZOOM_X1, ZOOM_Y1, ZOOM_X2, ZOOM_Y2);
01393 
01394     vga.use_front();
01395 }
01396 
01397 //---------- End of function Letter::welcome_letter_report ------------//
01398 
01399 //---------- End of function Letter::welcome_letter_detect ------------//
01400 int Letter::welcome_letter_detect() {
01401     if (!letter_report_init_flag)
01402         return 0;
01403     vga.use_front();
01404     //  letter_browser.detect();
01405     if(welcome_page_number<max_welcome_page_number)
01406         if(button_pgdn.detect()) {
01407             if(welcome_page_number<max_welcome_page_number)
01408                 welcome_page_number++;
01409             sys.redraw_all_flag=1;
01410         };
01411 
01412     if(welcome_page_number>1)
01413