00001
00002
00003
00004
00005 #include <OMATH.H>
00006
00007 #include <ODEPT.H>
00008 #include <ODEPTRES.H>
00009 #include <OENROLL.H>
00010 #include <OSCHLRES.H>
00011 #include <OPSCHOOL.H>
00012 #include <OPEERSCH.H>
00013 #include <OFINANCE.H>
00014 #include <OATHLETI.H>
00015 #include <OLIBTECH.H>
00016 #include <OCHANCE.H>
00017 #include <OSTUDENT.H>
00018
00019 static StudentArray *get_student_array(int deptRecno) {
00020 if (deptRecno)
00021 return &(department_array[deptRecno]->student_array);
00022 else
00023 return &department_res.general_dept.student_array;
00024 }
00025
00026
00032
00033 switch (update_flag) {
00034 case UPDATE_MONTH:
00035 calc_satisfaction_student_life();
00036 calc_satisfaction_athletics();
00037 calc_satisfaction_overall();
00038 calc_faculty_workweek();
00039 break;
00040 case UPDATE_TRIMESTER:
00041 calc_satisfaction_academic();
00042
00043
00044
00045
00046 break;
00047 case UPDATE_YEAR:
00048 reaction_summer_course_last = reaction_summer_course;
00049 break;
00050 case UPDATE_ALL:
00051 update_history(UPDATE_MONTH);
00052 update_history(UPDATE_TRIMESTER);
00053 update_history(UPDATE_YEAR);
00054 break;
00055 default:
00056 err_here();
00057 break;
00058 }
00059 }
00060
00061
00062
00063
00064 void Student::calc_satisfaction_academic() {
00065
00066 #define VAR_COUNT_SL1 5
00067 int i, count;
00068 float input[VAR_COUNT_SL1];
00069 memset(input, 0, sizeof(input));
00070
00071
00072
00073
00074 for (count=0, i=department_array.size(); i>0; i--) {
00075 if ( department_array.is_deleted(i) )
00076 continue;
00077
00078 if ( course_taking_array[i-1] > 0 ) {
00079 input[0] += department_array[i]->p_educational_quality;
00080 count++;
00081 }
00082 }
00083 if ( count > 0 )
00084 input[0] /= count;
00085
00086
00087
00088
00089
00090 #if(GAME_VERSION>=200)
00091 if ( initializationValueAC_LIBRARIES == 0 )
00092 #else
00093 if(info.game_year==1)
00094 if(info.game_month==9)
00095 #endif
00096 initializationValueAC_LIBRARIES=(float)finance.expense_array[AC_LIBRARIES].total;
00097 input[1] = float(finance.expense_array[AC_LIBRARIES].total)/
00098 (initializationValueAC_LIBRARIES*(1+math.get_random_snd(0.0f, PSCH_SD(0.05f))));
00099
00100 if (department_recno)
00101 input[2] = (department_array[department_recno]->p_tech_utilization);
00102 else
00103 input[2] = library_tech_office.tech_utilization;
00104
00105
00106
00107 input[3] = course_denials_this_trimester;
00108
00109
00110
00111 input[4] = course_failures_this_trimester;
00112
00113
00114 input[0] = math.dual_response_func(1,50,100,29.30f,32.83f,20.19f,76.09f, input[0]);
00115
00116
00117 input[1] = math.single_response_func(1,100, 0.5200f,1.030f, input[1]);
00118 input[2] = math.dual_response_func(0,49.8f,100,40.49f,29.41f,20.04f,85.05f, input[2]);
00119 input[3] = math.single_response_func(1,100,-1.4230f,0.9125f, input[3]);
00120 input[4] = math.single_response_func(1,100,-1.1857f,0.7756f, input[4]);
00121
00122 float newValue = 0;
00123 float weight[VAR_COUNT_SL1] = {0.40f, 0.10f, 0.1f, 0.20f, 0.20f, };
00124
00125 for(i=0; i<VAR_COUNT_SL1; i++)
00126 newValue += weight[i] * input[i];
00127
00128
00129
00130 if ( student_level <= MASTER ) {
00131 }
00132 else if ( student_level == DOCTOR ) {
00133 newValue = 0.5f * newValue + 0.5f * (department_recno ? department_array[department_recno]->p_academic_standing_no_latency : 0);
00134 }
00135 else if ( student_level == DISTANCE_LEARN ) {
00136 newValue = 0;
00137 float weightSL5[VAR_COUNT_SL1] = { 0.30f, 0.30f, 0, 0.2f, 0.20f, };
00138
00139 for(i=0; i<VAR_COUNT_SL1; i++)
00140 newValue += weightSL5[i] * input[i];
00141 }
00142 else
00143 err_here();
00144
00145
00146 satisfaction_academic = (char) player_school.latency_func( 0.60f, satisfaction_academic, newValue);
00147
00148
00149
00150 if( extra_effect_satisfaction_academic ) {
00151 satisfaction_academic *= extra_effect_satisfaction_academic;
00152
00153 extra_effect_satisfaction_academic += (1.0f - extra_effect_satisfaction_academic) * 0.3f;
00154
00155 satisfaction_academic = max(0, min(100,satisfaction_academic ) );
00156 }
00157 }
00158
00159
00160
00161
00162 void Student::calc_satisfaction_student_life() {
00163 if ( student_level != UG_TRADITION ) {
00164 satisfaction_student_life = -1;
00165 return;
00166 }
00167
00168 int const SL_VAR_COUNT = 4;
00169 int i;
00170 float input[SL_VAR_COUNT];
00171 memset(input, 0, sizeof(input));
00172
00173
00174 if ( 0 < enroll_res.student_count[UG_TRADITION] + enroll_res.student_count[UG_NONTRADITION] )
00175 input[0] = float(finance.expense_array[AC_STUDENT_LIFE].total) / (enroll_res.student_count[UG_TRADITION] + enroll_res.student_count[UG_NONTRADITION] );
00176
00177
00178 input[1] = get_student_array(department_recno)->ave_satisfaction_student_life[student_level];
00179
00180
00181
00182
00183 #if(GAME_VERSION>=200)
00184 if ( initializationValueAC_ATHLETICS == 0 )
00185 #else
00186 if(info.game_year==1)
00187 if(info.game_month==9)
00188 #endif
00189 initializationValueAC_ATHLETICS=(float)finance.expense_array[AC_ATHLETICS].total;
00190 input[2] = float(finance.expense_array[AC_ATHLETICS].total)/
00191 (initializationValueAC_ATHLETICS*(1+math.get_random_snd(0.0f, PSCH_SD(0.05f))));
00192
00193
00194 input[3] = talent_extracurricular;
00195
00196
00197 input[0] = math.single_response_func(1,100,9.885f,5.475f, input[0]);
00198
00199 input[2] = math.single_response_func(1,100,0.5200f,1.030f, input[2]);
00200
00201
00202 float newValue = 0;
00203 float weight[SL_VAR_COUNT] = {0.40f, 0.20f, 0.15f, 0.25f, };
00204
00205 for(i=0; i<SL_VAR_COUNT; i++)
00206 newValue += weight[i] * input[i];
00207
00208
00209
00210 if( chance_event.event_last_happen_date[NEWS_RAPE_IN_CAMPUS-1] > info.game_date-365 ) {
00211
00212
00213 satisfaction_student_life = (char) player_school.latency_func( 0.10f, satisfaction_student_life, newValue);
00214 }
00215 else
00216
00217 satisfaction_student_life = (char) player_school.latency_func( 0.90f, satisfaction_student_life, newValue);
00218
00219
00220
00221 satisfaction_student_life = char(satisfaction_student_life * finance.cost_rise_policy_array[PL_STUDENT_LIFE].penalty_multiplier1);
00222
00223 satisfaction_student_life = max(0,min(100,satisfaction_student_life));
00224 }
00225
00226
00227
00228
00229 void Student::calc_satisfaction_athletics() {
00230 if ( student_level != UG_TRADITION ) {
00231 satisfaction_athletics = -1;
00232 return;
00233 }
00234
00235 float input[2];
00236 memset(input, 0, sizeof(input));
00237
00238
00239 input[0] = athletics_office.avg_percent_win;
00240
00241
00242 input[1] = float(talent_athletics);
00243
00244
00245 input[0] = math.dual_response_func(1,50,100,34.12f,27.83f,24.44f,79.95f, input[0]);
00246
00247 float newValue = 0.5f * input[0] + 0.5f * input[1];
00248
00249
00250
00251 satisfaction_athletics = (char) player_school.latency_func( 0.85f, satisfaction_athletics, newValue);
00252
00253
00254 satisfaction_athletics = char(satisfaction_athletics * finance.cost_rise_policy_array[PL_ATHLETICS].penalty_multiplier1);
00255
00256 satisfaction_athletics = max(0,min(100,satisfaction_athletics));
00257 }
00258
00259
00260
00261
00262 void Student::calc_satisfaction_overall() {
00263 int i;
00264
00265 if ( student_level != UG_TRADITION ) {
00266 const int VAR_COUNT = 2;
00267
00268 float input[2];
00269
00270
00271 input[0] = satisfaction_academic;
00272
00273
00274
00275
00276 input[1] = 0;
00277
00278
00279 float newValue = 0;
00280 float weight[VAR_COUNT] = {0.40f, 0.05f,};
00281 float weightMinority[VAR_COUNT] = {0.45f, 0.10f,};
00282
00283 if ( gender_ethnic_group == NONMINORITY_MALE ) {
00284 for(i=0; i<VAR_COUNT; i++)
00285 newValue += weight[i] * input[i];
00286 }
00287 else {
00288 for(i=0; i<VAR_COUNT; i++)
00289 newValue += weightMinority[i] * input[i];
00290 }
00291
00292 satisfaction_overall = (char) player_school.latency_func( 0.95f, satisfaction_overall, newValue);
00293
00294
00295 return;
00296 }
00297
00298 const int OVERALL_VAR_COUNT = 6;
00299 float input[OVERALL_VAR_COUNT];
00300 memset(input, 0, sizeof(input));
00301
00302
00303 input[0] = satisfaction_academic;
00304 input[1] = satisfaction_student_life;
00305 input[2] = satisfaction_athletics;
00306
00307
00308
00309 input[3] = player_school.sub_score[S_STUDENT_DIVERSITY][THIS_MONTH];
00310
00311
00312
00313 input[4] = department_recno ? department_array[department_recno]->p_faculty_diversity :0;
00314
00315
00316
00317
00318
00319
00320
00321
00322 const float lamda = 0.975f;
00323
00324 reaction_summer_course = (char) max(0.0f,
00325 (1-lamda)*(-10)*(player_school.summer_emphasis*player_school.summer_emphasis - player_school.summer_emphasis_last*player_school.summer_emphasis_last)
00326 + lamda*reaction_summer_course_last);
00327
00328 input[5] = (float) reaction_summer_course;
00329
00330
00331 input[3] = math.dual_response_func(1,49.48f,100,20.74f,29.48f,20.30f,75.12f, input[3]);
00332 input[4] = math.dual_response_func(1,49.48f,100,20.74f,29.48f,20.30f,75.12f, input[4]);
00333
00334 float newValue = 0;
00335
00336 float weight[OVERALL_VAR_COUNT] = {0.40f, 0.35f, 0.10f, 0.05f, 0.05f, 0.05f, };
00337 float weightMinority[OVERALL_VAR_COUNT] = {0.45f, 0.25f, 0.10f, 0.10f, 0.10f, 0.05f,};
00338
00339 if ( gender_ethnic_group == NONMINORITY_MALE ) {
00340 for(i=0; i<OVERALL_VAR_COUNT; i++)
00341 newValue += weight[i] * input[i];
00342 }
00343 else {
00344 for(i=0; i<OVERALL_VAR_COUNT; i++)
00345 newValue += weightMinority[i] * input[i];
00346 }
00347
00348
00349
00350 satisfaction_overall = (char) player_school.latency_func( 0.67f, satisfaction_overall, newValue);
00351
00352
00353 satisfaction_overall = char(satisfaction_overall * finance.revenue_policy_array[PL_TUITION_RATE_GROWTH].penalty_multiplier1);
00354 satisfaction_overall = char(satisfaction_overall * finance.revenue_policy_array[PL_FINANCIAL_AID].penalty_multiplier1);
00355
00356
00357 satisfaction_overall = char(satisfaction_overall * finance.cost_rise_policy_array[PL_LIBRARIES].penalty_multiplier2);
00358
00359
00360
00361 satisfaction_overall = max(0,min(100,satisfaction_overall));
00362 }
00363
00364
00365
00366
00367 void Student::calc_faculty_workweek() {
00368 float input;
00369
00370
00371 input = department_recno ? department_array[department_recno]->p_faculty_morale_history[THIS_MONTH] : 0;
00372
00373
00374 input = math.dual_response_func(30,44,60,20.18f,24.18f,19.88f,83.89f, input);
00375
00376
00377
00378 faculty_workweek = (char) player_school.latency_func( 0.84f, faculty_workweek, input);
00379
00380 }
00381
00382
00383
00384
00385 void Student::calc_probability_change_major() {
00386 const char M_VAR_COUNT = 2;
00387 int i;
00388 float input[M_VAR_COUNT];
00389 memset(input, 0, sizeof(input));
00390
00391 input[0] = (float) satisfaction_overall;
00392
00393
00394 int requiredCourseCount;
00395
00396 switch( student_level ) {
00397 case UG_TRADITION:
00398 case UG_NONTRADITION:
00399 requiredCourseCount = COURSE_COUNT_REQUIRED_FOR_BACHELOR;
00400 break;
00401
00402 case MASTER:
00403 requiredCourseCount = COURSE_COUNT_REQUIRED_FOR_MASTER;
00404 break;
00405
00406 case DOCTOR:
00407 requiredCourseCount = COURSE_COUNT_REQUIRED_FOR_DOCTOR;
00408 break;
00409
00410 case DISTANCE_LEARN:
00411 return;
00412 }
00413
00414
00415 input[1] = float(requiredCourseCount - total_course_all);
00416
00417
00418 input[0] = math.dual_response_func(0.000f,0.189f,0.500f,-28.960f,-29.670f,80.010f,24.990f, input[0]);
00419 input[1] = math.single_response_func(0.00f,0.50f,25.00f,12.54f, input[1]);
00420
00421 float weight[M_VAR_COUNT] = {0.6f, 0.4f };
00422
00423 float newValue = 0;
00424 for(i=0; i<M_VAR_COUNT; i++)
00425 newValue += weight[i] * input[i];
00426
00427 probability_change_major = player_school.latency_func( 0.3f, probability_change_major, newValue);
00428 }
00429
00430
00431
00432
00433 void Student::calc_multiplier_on_dropout_prob() {
00434 const char D_VAR_COUNT = 3;
00435 int i;
00436 float input[D_VAR_COUNT];
00437 memset(input, 0, sizeof(input));
00438
00439
00440 input[0] = (float) satisfaction_overall;
00441
00442
00443
00444 input[1] = float(failed_course_count) / ( 8 * year_in_program);
00445
00446
00447 input[2] = player_school.sub_score[S_STUDENT_DIVERSITY][THIS_MONTH];
00448
00449
00450 input[0] = math.dual_response_func(0.500f,0.950f,2.000f,-31.945f,-38.384f,79.997f,39.993f, input[0]);
00451
00452
00453 input[1] = math.single_response_func(0.500f,1.000f,0.096f,0.056f, input[1]);
00454 input[2] = math.dual_response_func(0.500f,1.001f,2.000f,-29.947f,-29.945f,75.015f,19.970f, input[2]);
00455
00456 float weight[D_VAR_COUNT] = {0.50f, 0.50f, };
00457 float weightMinority[D_VAR_COUNT] = {0.30f, 0.50f, 0.2f, };
00458 float newValue = 0;
00459
00460 if ( gender_ethnic_group == NONMINORITY_MALE ) {
00461 for(i=0; i<D_VAR_COUNT; i++)
00462 newValue += weight[i] * input[i];
00463 }
00464 else {
00465 for(i=0; i<D_VAR_COUNT; i++)
00466 newValue += weightMinority[i] * input[i];
00467 }
00468
00469 multiplier_on_dropout_prob = player_school.latency_func( 0.67f, multiplier_on_dropout_prob, newValue);
00470 }
00471
00472
00473
00474
00475
00476
00477
00478 void StudentArray::update_history(char update_flag) {
00479
00480
00481
00482
00483
00484 Student *studentPtr;
00485 int i, sl;
00486 int studentCount[MAX_STUDENT_LEVEL];
00487
00488 memset(studentCount, 0, sizeof(studentCount));
00489 memset(ave_satisfaction_student_life, 0, sizeof(ave_satisfaction_student_life));
00490
00491 for( i=size() ; i>0 ; i-- ) {
00492 if( is_deleted(i) )
00493 continue;
00494
00495 studentPtr = operator[](i);
00496
00497 sl = studentPtr->student_level;
00498
00499 err_when(sl<0 || sl>=MAX_STUDENT_LEVEL);
00500
00501 if ( sl != UG_TRADITION )
00502 continue;
00503
00504 studentCount[sl]++;
00505 ave_satisfaction_student_life[sl] += studentPtr->satisfaction_student_life;
00506 }
00507
00508 for (i=0; i<MAX_STUDENT_LEVEL; i++) {
00509 if ( studentCount[i] )
00510 ave_satisfaction_student_life[i] /= studentCount[i];
00511 else
00512 err_when( ave_satisfaction_student_life[i] != 0 );
00513 }
00514
00515
00516 PeerSchool *player;
00517
00518 switch (update_flag) {
00519 case UPDATE_MONTH:
00520 calc_student_performance();
00521 break;
00522 case UPDATE_TRIMESTER:
00523 break;
00524 case UPDATE_YEAR:
00525 calc_degree_awarded();
00526 break;
00527 case UPDATE_ALL:
00528
00529
00530
00531 player = school_res.player_peer_school;
00532
00533
00534 cur_bachelor_degree = player->total_bach_degrees / department_array.department_count;
00535 cur_master_degree = player->total_masters_and_prof_degree / department_array.department_count;
00536 cur_doctor_degree = player->total_doctoral_degrees / department_array.department_count;
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581 update_history(UPDATE_MONTH);
00582 update_history(UPDATE_TRIMESTER);
00583 update_history(UPDATE_YEAR);
00584
00585
00586
00587 for (i=0; i<DEGREE_TYPE_COUNT; i++) {
00588
00589
00590 time_to_degree[BACHELOR_DEGREE][THIS_YEAR] = 4.37f;
00591
00592 time_to_degree[MASTER_DEGREE][THIS_YEAR] = 1.05f;
00593
00594 time_to_degree[DOCTOR_DEGREE][THIS_YEAR] = player->doc_time_to_degree;
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604 }
00605
00606 break;
00607
00608 default:
00609 err_here();
00610 break;
00611 }
00612 }
00613
00614
00615
00616
00618
00619 shift_history(talent_academic, HISTORY_MONTH_COUNT);
00620 shift_history(talent_extracurricular, HISTORY_MONTH_COUNT);
00621 shift_history(talent_athletics, HISTORY_MONTH_COUNT);
00622
00623 shift_history(satisfaction_academic, HISTORY_MONTH_COUNT);
00624 shift_history(satisfaction_student_life, HISTORY_MONTH_COUNT);
00625 shift_history(satisfaction_athletics, HISTORY_MONTH_COUNT);
00626
00627 shift_history(satisfaction_overall, HISTORY_MONTH_COUNT);
00628
00629 for (int d=0; d<DEGREE_TYPE_COUNT; d++)
00630 shift_history(talent_academic_all[d], HISTORY_MONTH_COUNT);
00631
00632 shift_history(performance_academic_ug, HISTORY_MONTH_COUNT);
00633
00634
00635
00636 Student *stuPtr;
00637 const char AVG_VAR_COUNT = 11;
00638 int total[AVG_VAR_COUNT];
00639 int i, ugtStuCount=0, ugAllCount=0, stuCount = 0, docCount=0, masCount=0;
00640
00641 memset(total, 0, sizeof(total));
00642
00643 for( i=size() ; i>0 ; i-- ) {
00644 if( is_deleted(i) )
00645 continue;
00646
00647 stuPtr = operator[](i);
00648
00649 if ( stuPtr->student_level == UG_TRADITION ) {
00650 total[0] += stuPtr->talent_academic;
00651 total[1] += stuPtr->talent_extracurricular;
00652 total[2] += stuPtr->talent_athletics;
00653
00654 total[3] += stuPtr->satisfaction_academic;
00655 total[4] += stuPtr->satisfaction_student_life;
00656 total[5] += stuPtr->satisfaction_athletics;
00657 total[6] += stuPtr->satisfaction_overall;
00658 ugtStuCount++;
00659 }
00660
00661 if ( (stuPtr->student_level) == UG_TRADITION ) {
00662 total[7] += (int) stuPtr->academic_achievement;
00663 total[8] += stuPtr->talent_academic;
00664
00665 }
00666 else if ( stuPtr->student_level == MASTER ) {
00667 total[9] += stuPtr->talent_academic;
00668 masCount++;
00669 }
00670 else if ( stuPtr->student_level == DOCTOR ) {
00671 total[10] += stuPtr->talent_academic;
00672 docCount++;
00673 }
00674
00675 stuCount++;
00676 }
00677
00678 if (!stuCount)
00679 return;
00680
00681 if ( ugtStuCount ) {
00682
00683 talent_academic[THIS_MONTH] = char(total[0] / ugtStuCount);
00684 talent_extracurricular [THIS_MONTH] = char(total[1] / ugtStuCount);
00685 talent_athletics [THIS_MONTH] = char(total[2] / ugtStuCount);
00686
00687 satisfaction_academic [THIS_MONTH] = char(total[3] / ugtStuCount);
00688 satisfaction_student_life [THIS_MONTH] = char(total[4] / ugtStuCount);
00689 satisfaction_athletics [THIS_MONTH] = char(total[5] / ugtStuCount);
00690 satisfaction_overall [THIS_MONTH] = char(total[6] / ugtStuCount);
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700 }
00701
00702 if ( ugtStuCount ) {
00703 performance_academic_ug[THIS_MONTH] = char(total[7] / ugtStuCount);
00704 talent_academic_all[BACHELOR_DEGREE][THIS_MONTH] = char(total[8] / ugtStuCount);
00705 }
00706
00707 if ( masCount )
00708 talent_academic_all[MASTER_DEGREE][THIS_MONTH] = char(total[9] / masCount);
00709
00710 if ( docCount )
00711 talent_academic_all[DOCTOR_DEGREE][THIS_MONTH] = char(total[10] / docCount);
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 }
00723
00724
00725
00726
00727 void StudentArray::calc_degree_awarded() {
00728
00729
00730 shift_history(bachelor_degree, HISTORY_YEAR_COUNT);
00731 #if(GAME_VERSION>=200)
00732 shift_history(non_ug_bachelor_degree, HISTORY_YEAR_COUNT );
00733 #endif
00734 shift_history(master_degree, HISTORY_YEAR_COUNT);
00735 shift_history(doctor_degree, HISTORY_YEAR_COUNT);
00736
00737 for (int y=0; y<DEGREE_TYPE_COUNT; y++) {
00738 shift_history(time_to_degree[y], HISTORY_YEAR_COUNT);
00739 shift_history(fake_disp_time_to_degree[y], HISTORY_YEAR_COUNT);
00740 shift_history(dropout_rate[y], HISTORY_YEAR_COUNT);
00741 }
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758 bachelor_degree[THIS_YEAR] = cur_bachelor_degree;
00759 #if(GAME_VERSION>=200)
00760 non_ug_bachelor_degree[THIS_YEAR] = cur_non_ug_bachelor_degree;
00761 #endif
00762 master_degree [THIS_YEAR] = cur_master_degree;
00763 doctor_degree [THIS_YEAR] = cur_doctor_degree;
00764
00765
00766
00767 #if(GAME_VERSION>=200)
00768 if( info.prerun_year && info.game_year == 1 )
00769 #else
00770 if( info.prerun_year )
00771 #endif
00772 {
00773
00774
00775 int masterCount=0, doctorCount=0;
00776
00777 for( int i=size() ; i>0 ; i-- ) {
00778 if( is_deleted(i) )
00779 continue;
00780
00781 Student* stuPtr = operator[](i);
00782
00783 if( stuPtr->student_level == MASTER )
00784 masterCount++;
00785 else if( stuPtr->student_level == DOCTOR )
00786 doctorCount++;
00787 }
00788
00789
00790 master_degree[THIS_YEAR] = int( (float) masterCount / 1.6f);
00791 doctor_degree [THIS_YEAR] = doctorCount/5;
00792 }
00793
00794
00795
00796 time_to_degree[BACHELOR_DEGREE][THIS_YEAR] = math.safe_divide(time_to_degree_cumm[BACHELOR_DEGREE], cur_bachelor_degree);
00797 time_to_degree[MASTER_DEGREE][THIS_YEAR] = math.safe_divide(time_to_degree_cumm[MASTER_DEGREE], cur_master_degree);
00798 time_to_degree[DOCTOR_DEGREE][THIS_YEAR] = math.safe_divide(time_to_degree_cumm[DOCTOR_DEGREE], cur_doctor_degree);
00799
00800
00801
00802 fake_disp_time_to_degree[BACHELOR_DEGREE][THIS_YEAR] = m.fmax( time_to_degree[BACHELOR_DEGREE][THIS_YEAR], math.get_random_snd(4.3f, 0.07f) );
00803
00804
00805 int curSize[DEGREE_TYPE_COUNT];
00806 const char degMap[MAX_STUDENT_LEVEL] = { BACHELOR_DEGREE, -1, MASTER_DEGREE, DOCTOR_DEGREE, -1};
00807
00808 memset(curSize,0,sizeof(curSize));
00809
00810 for (int i=size(); i>0; i--) {
00811 if ( is_deleted(i) )
00812 continue;
00813
00814 Student* stuPtr = operator[](i);
00815
00816
00817 if ( stuPtr->year_in_program == 1 ) {
00818 char deg = degMap[stuPtr->student_level];
00819
00820 if (deg >= 0)
00821 curSize[deg]++;
00822 }
00823 }
00824
00825 const float lamda[] = { 0.775f, 0.1f, 0.8f };
00826
00827 for (y=0; y<DEGREE_TYPE_COUNT; y++) {
00828
00829
00830
00831
00832 dropout_rate[y][THIS_YEAR] = (float) cur_dropout[y];
00833 }
00834
00835
00836
00837 cur_bachelor_degree = 0;
00838 #if(GAME_VERSION>=200)
00839 cur_non_ug_bachelor_degree = 0;
00840 #endif
00841 cur_master_degree = 0;
00842 cur_doctor_degree = 0;
00843
00844 for (y=0; y<DEGREE_TYPE_COUNT; y++) {
00845 time_to_degree_cumm[y] = 0;
00846 cur_dropout[y] = 0;
00847 #if(GAME_VERSION>=200)
00848 last_year_dropout[y]=0;
00849 last_year_dropout[y+1]=0;
00850 last_year_degree[y]=0;
00851 last_year_degree[y+1]=0;
00852 #endif
00853 }
00854
00855 ave_time_to_graduation_for_ug = 0;
00856 }
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888 #if(GAME_VERSION>=200)
00889
00890 void StudentArray::save_initial_data() {
00891 for (int i = 0; i < DEGREE_TYPE_COUNT; i++) {
00892 for (int j = 0; j < HISTORY_MONTH_COUNT; j++)
00893 initial_talent_academic_all[i][j] = talent_academic_all[i][j];
00894
00895 for (j = 0; j < HISTORY_YEAR_COUNT; j++) {
00896 initial_fake_disp_time_to_degree[i][j] = fake_disp_time_to_degree[i][j];
00897 initial_time_to_degree[i][j] = time_to_degree[i][j];
00898 initial_dropout_rate[i][j] = dropout_rate[i][j];
00899 }
00900 }
00901
00902 for (i = 0; i < HISTORY_MONTH_COUNT; i++) {
00903 initial_performance_academic_ug[i] = performance_academic_ug[i];
00904
00905 }
00906
00907 for (i = 0; i < HISTORY_YEAR_COUNT; i++) {
00908
00909
00910 initial_bachelor_degree[i] = bachelor_degree[i]+non_ug_bachelor_degree[i];
00911 initial_master_degree[i] = master_degree[i];
00912 initial_doctor_degree[i] = doctor_degree[i];
00913 }
00914
00915 }
00916
00917
00918 #endif
00919