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

Password:

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

Onewsmsg.cpp

Go to the documentation of this file.
00001 //Filename    : ONEWSMSG.CPP
00002 //Description : Object news msg generating routines News::msg() and its helper
00003 //Owner                 : Fred
00004 
00005 #include <OSTR.H>
00006 #include <ONEWS.H>
00007 #include <OFONT.H>
00008 #include <ODATE.H>
00009 #include <OINFO.H>
00010 #include <OCONFIG.H>
00011 
00012 #include <OSYS.H>
00013 #include <OCHANCE.H>
00014 #include <OPSCHOOL.H>
00015 #include <OFINANCE.H>
00016 #include <ODEPT.H>
00017 
00018 //--------- Define variable type ----------//
00019 
00020 typedef void (News::*NewsFP)();
00021 
00022 //-------- Define struct NewsInfo -------//
00023 
00025 struct NewsInfo {
00026     NewsFP news_function_ptr;
00027 };
00028 
00029 //------ Define function pointers array ------//
00030 
00031 static NewsInfo news_info_array[NEWS_ID_COUNT] = {
00032     { News::alumni_die },
00033     { News::rape_in_campus },
00034 
00035     { News::retrofit_facilities },
00036     { News::earth_quake },
00037 
00038     { News::congress_research },
00039     { News::stock_market },
00040     { News::scandalous_fund_use },
00041     { News::new_governor },
00042     { News::court_limit_minority },
00043     { News::risky_research },
00044     { News::scandal_in_athletics },
00045 
00046     { News::research_prize },
00047     { News::technology_transfer },
00048     { News::capital_campaign },
00049     { News::student_loans },
00050 
00051     { News::plagiarism_scandal },
00052     { News::for_profit_competition },
00053     { News::minority_student_percentage_falls },
00054     { News::successful_grad },
00055     { News::media_obtain_information },
00056 
00057 #if(GAME_VERSION>=200)
00058     // protagonist message
00059     { News::protagonist_message },
00060     { News::protagonist_message },
00061     { News::protagonist_message },
00062     { News::protagonist_message },
00063     { News::protagonist_message },
00064     { News::protagonist_message },
00065     { News::protagonist_message },
00066     { News::protagonist_message },
00067     { News::protagonist_message },
00068     { News::protagonist_message },
00069 
00070     { News::protagonist_message },
00071     { News::protagonist_message },
00072     { News::protagonist_message },
00073     { News::protagonist_message },
00074     { News::protagonist_message },
00075     { News::protagonist_message },
00076     { News::protagonist_message },
00077     { News::protagonist_message },
00078     { News::protagonist_message },
00079     { News::protagonist_message },
00080 
00081     { News::protagonist_message },
00082     { News::protagonist_message },
00083     { News::protagonist_message },
00084     { News::protagonist_message },
00085     { News::protagonist_message },
00086     { News::protagonist_message },
00087     { News::protagonist_message },
00088     { News::protagonist_message },
00089     { News::protagonist_message },
00090     { News::protagonist_message },
00091 
00092     { News::protagonist_message },
00093     { News::protagonist_message },
00094     { News::protagonist_message },
00095     { News::protagonist_message },
00096 #endif
00097 
00098     { News::new_year_start },
00099     { News::scenario_near_end },
00100     { News::scenario_news },
00101     { News::football_game },
00102     { News::basketball_game },
00103 
00104     { News::open_game_near_end },
00105     { News::open_game_end },
00106 
00107 #if(GAME_VERSION>=200)
00108     { News::bankruptcy_message_lv1 },
00109     { News::bankruptcy_message_lv2 },
00110     { News::bankruptcy_message_lv3 },
00111 #endif
00112 
00113     { News::task_msg },
00114 };
00115 
00116 //------- Define static variables --------//
00117 
00118 String News::str;
00119 
00120 //------ Begin of function News::msg -----//
00124 char* News::msg() {
00125     NewsFP newsFP = news_info_array[id-1].news_function_ptr;
00126 
00127     (this->*newsFP)();                              // call the corrsponding function to return the news msg
00128 
00129     line_count=font_chartsm.count_line(400,str);
00130 
00131     return str;
00132 }
00133 
00134 //------- End of function News::msg -----//
00135 
00136 //------ Begin of function News::set_newspaper_popup -----//
00138 void News::set_newspaper_popup() {
00139     sys.set_news_pop_up();
00140     News* newsPtr = this;
00141     chance_event.news_str = newsPtr->msg();
00142     chance_event.news_news_str=chance_event.news_str;
00143 
00144     //--- convert the year to 200? year format -----//
00145 
00146     int thisDate = date.julian( date.year(newsPtr->news_date),
00147                                 date.month(newsPtr->news_date),
00148                                 date.day(newsPtr->news_date) );
00149 
00150     // memcpy(chance_event.news_date_str, date.date_str(thisDate),55);
00151     strncpy( chance_event.news_date_str, info.date_str_julian(thisDate), 55);
00152     chance_event.news_date_str[55-1] = '\0';
00153     // chance_event.date_str = date.date_str(thisDate,1,0);
00154     chance_event.date_str = info.date_str_julian( thisDate, INFO_DATE_DEFAULT|INFO_DATE_SHORT_MONTH|INFO_DATE_NO_DAY);
00155 }
00156 
00157 //------- End of function News::set_newspaper_popup -----//
00158 
00159 //------ Begin of function News::alumni_die -----//
00164 void News::alumni_die() {
00165     //---------------- Text Format -----------------//
00166     //
00167     // An old <alumnus/alumna> dies andleaves a bequest of $<bequest> thousand which is transferred to Development Office.
00168     //
00169     //----------------------------------------------//
00170 
00171     str = "An old ";
00172 
00173     if( short_para1 == GENDER_MALE )
00174         str += "alumnus";
00175     else
00176         str += "alumna";
00177 
00178     err_when(short_para2<0);
00179 
00180     str += " dies and leaves a bequest of $";
00181     str += m.format(short_para2);
00182     str += " thousand which is transferred to the Development Office.";
00183 }
00184 
00185 //------- End of function News::alumni_die -----//
00186 
00187 //------ Begin of function News::rape_in_campus -------//
00189 void News::rape_in_campus() {
00190     str = "Assaults occur on campus. Student and alumni morale plummet. ";
00191     str += "You need to spend more on \"Administration\" (which includes spending for Security).";
00192 }
00193 
00194 //------- End of function News::rape_in_campus --------//
00195 
00196 //------ Begin of function News::retrofit_facilities -------//
00200 void News::retrofit_facilities() {
00201     str = "More physically challenged students require modification of facilities. Lay out $";
00202     str += m.format(short_para1);
00203     str += " thousand.";
00204 }
00205 
00206 //------- End of function News::retrofit_facilities --------//
00207 
00208 //------ Begin of function News::earth_quake -------//
00210 void News::earth_quake() {
00211     str = "Earthquake. Your available square footage drops dramatically. Faculty, staff, and students report that they have insufficient space.";
00212 }
00213 
00214 //------- End of function News::earth_quake --------//
00215 
00216 //------ Begin of function News::congress_research -------//
00220 void News::congress_research() {
00221     str = "Congress adjusts research funding ";
00222     str += (short_para1>=0) ? "positively.":"negatively.";
00223 }
00224 
00225 //------- End of function News::congress_research --------//
00226 
00227 //------ Begin of function News::stock_market -------//
00231 void News::stock_market() {
00232     str = "Stock market ";
00233     str += (short_para1>=0) ? "soars.":"crashes.";
00234 }
00235 
00236 //------- End of function News::stock_market --------//
00237 
00238 //------ Begin of function News::scandalous_fund_use -------//
00242 void News::scandalous_fund_use() {
00243     str = "Auditors find scandalous use of funds. Senior officer of the University resigns. $";
00244     str += m.format(short_para1);
00245     str += " thousands disappear.  Fund-raising depressed.";
00246 }
00247 
00248 //------- End of function News::scandalous_fund_use --------//
00249 
00250 //------ Begin of function News::new_governor-------//
00254 void News::new_governor() {
00255     str = "A new governor of your state is elected. ";
00256 
00257     if ( short_para1>=0 ) {
00258         str += "She likes the University and raises the appropriation.";
00259     }
00260     else {
00261         str += "He wants to spend on prisons, not universities.  Your appropriation drops.";
00262     }
00263 }
00264 
00265 //------- End of function News::new_governor --------//
00266 
00267 //------ Begin of function News::court_limit_minority-------//
00269 void News::court_limit_minority() {
00270     str = "Courts ban favoring admission and financial aid on the basis of race or ethnicity.";
00271 }
00272 
00273 //------- End of function News::court_limit_minority --------//
00274 
00275 //## chea 150699
00276 //------ Begin of function News::risky_research-------//
00278 void News::risky_research() {
00279 
00280     str = "Risky genetic research on your campus attracts demostrators, who cause $";
00281     str += m.format(short_para1);
00282     str += " thousand in damage to the laboratory. The insurance company will not pay.";
00283 
00284 }
00285 
00286 //------- End of function News::risky_research --------//
00287 //## chea 150699
00288 
00289 //## chea 170699
00290 //------ Begin of function News::scandal_in_athletics-------//
00292 void News::scandal_in_athletics() {
00293     str = "Your athletes took illegal drugs. Your athletic talent drops and you cannot recruit athletes for 3 years. Donations fall.";
00294 }
00295 
00296 //------- End of function News::scandal_in_athletics --------//
00297 //## chea 170699
00298 
00299 //## chwg 170699
00300 //------ Begin of function News::plagiarism_scandal-------//
00302 void News::plagiarism_scandal() {
00303     str = "Plagiarism scandal rocks the University. ";
00304     str += m.format(short_para1,4);
00305     str += " students dismissed. Morale and donations fall.";
00306 }
00307 
00308 //------- End of function News::plagiarism_scandal --------//
00309 //## chwg 170699
00310 
00311 //## chwg 190699
00312 //------ Begin of function News::for_profit_competition-------//
00314 void News::for_profit_competition() {
00315     str = "For-profit universities are growing fast and attracting students. The University cannot raise tuition for the next 3 years.";
00316     //          if((yield_for_profit_competition-1.0f)>0)
00317 }
00318 
00319 //------- End of function News::for_profit_competition --------//
00320 //## chwg 190699
00321 
00322 //## chwg 210699
00323 //------ Begin of function News::minority_student_percentage_falls-------//
00325 void News::minority_student_percentage_falls() {
00326     str = "Courts ban favoring admission and financial aid on the basis of race or ethnicity.";
00327 }
00328 
00329 //------- End of function News::minority_student_percentage_falls --------//
00330 //## chwg 210699
00331 
00332 //## chwg 210699
00333 //------ Begin of function News::successful_grad-------//
00335 void News::successful_grad() {
00336     if(m.random(2)>1)
00337         str = "A graduate wins the Oscar for Best Actress and credits the University. Applications rise.";
00338     else
00339         str = "A graduate is elected president of the United States and credits the University. Applications rise.";
00340 }
00341 
00342 //------- End of function News::successful_grad --------//
00343 //## chwg 210699
00344 
00345 //## chwg 210699
00346 //------ Begin of function News::media_obtain_infomation-------//
00350 void News::media_obtain_information() {
00351 
00352     str = "An investigative reporter obtains information about 'the true cost of education' ";
00353     str += m.format(float_para1,2);
00354 
00355     str +=" relative to tuition income";            // (for private institutions)
00356 
00357     if(!player_school.is_public())
00358         str +=".";
00359     else
00360         str +=" plus state appropriation";            // (for public institutions).";
00361 }
00362 
00363 //------- End of function News::media_obtain_infomation --------//
00364 //## chwg 210699
00365 
00366 //------ Begin of function News::research_prize() -------------//
00374 void News::research_prize() {
00375     Department *dept = department_array[short_para1];
00376 
00377 #if(GAME_VERSION>=200)
00378     str = "Professor ";
00379     if ( dept->faculty_array.is_deleted( short_para2 ) ) {
00380         str += Faculty::name( short_para3, short_para4, short_para5 );
00381     }
00382     else {
00383         str += dept->faculty_array[short_para2]->name();
00384     }
00385     str += " receives the Nobel Prize. Prestige soars.";
00386 #else
00387     str = "Professor ";
00388     str += dept->faculty_array[short_para2]->name();
00389     str += " receives the Nobel Prize. Prestige soars.";
00390 #endif
00391 }
00392 
00393 //------- End of function News::research_prize() --------------//
00394 
00395 //## chea begin 260699
00396 //------ Begin of function News::technology_transfer() -------------//
00401 void News::technology_transfer() {
00402     str="Your ";
00403     str += department_array[short_para1]->name();
00404     str += " signs a deal with a company for a breakthrough that the company will market. For the next 5 years, the University receives $";
00405     str += m.format((int)float_para1);
00406     str += " thousand/year.";
00407 
00408 }
00409 
00410 //------- End of function News::technology_transfer() --------------//
00411 //## chea end 260699
00412 
00413 //------ Begin of function News::capital_campaign() -------------//
00414 void News::capital_campaign() {
00415     str="You announce a capital campaign. Note that spending for the Development has increased.";
00416 }
00417 
00418 //------- End of function News::capital_campaign() --------------//
00419 
00420 //------ Begin of function News::student_loans() -------------//
00421 void News::student_loans() {
00422     if ( short_para1 == 0 )
00423         str="Student loans become harder to get. Applications rise at cheaper public institutions and fall at the more expensive privates.";
00424     else
00425         str="Student loans become easier to get. Applications rise at the more expensive privates and fall at cheaper public institutions.";
00426     //## chea (wfm: March 10,1999) 17b
00427 }
00428 
00429 //------- End of function News::student_loans() --------------//
00430 
00431 //------ Begin of function News::football_game -------//
00435 void News::football_game() {
00436     str = "Your football team wins the league title and goes to a New Year's Day Bowl Game. ";
00437     str += "You earn $";
00438     str += m.format(short_para1);
00439     str += " thousand, and donations and applications rise.";
00440 }
00441 
00442 //------- End of function News::football_game --------//
00443 
00444 //------ Begin of function News::basketball_game -------//
00448 void News::basketball_game() {
00449     str = "Your hoopsters win their league title. ";
00450     str += "You earn $";
00451     str += m.format(short_para1);
00452     str += " thousand, and donations and applications rise.";
00453 }
00454 
00455 //------- End of function News::basketball_game --------//
00456 
00457 #if(GAME_VERSION>=200)
00458 // --- Begin of function News::bankruptcy_message_lv1 --- //
00459 //
00460 void News::bankruptcy_message_lv1() {
00461     str = "The Financial Office projects bankruptcy at year-end. You must act now to avoid fiscal disaster.";
00462 }
00463 
00464 // --- End of function News::bankruptcy_message_lv1 --- //
00465 
00466 // --- Begin of function News::bankruptcy_message_lv2 --- //
00467 //
00468 void News::bankruptcy_message_lv2() {
00469     str = "The Finance Office projects bankruptcy in warning in ";
00470     str += m.format(short_para1+12);
00471     str += " months. You should take remedial action very soon.";
00472 }
00473 
00474 // --- End of function News::bankruptcy_message_lv2 --- //
00475 
00476 // --- Begin of function News::bankruptcy_message_lv3 --- //
00477 //
00478 void News::bankruptcy_message_lv3() {
00479     str = "The Finance Office projects bankruptcy in warning in ";
00480     str += m.format(short_para1+24);
00481     str += " months. You should change your budget policies as soon as possible.";
00482 }
00483 
00484 // --- End of function News::bankruptcy_message_lv3 --- //
00485 #endif
00486 
00487 //------ Begin of function News::new_year_start -------//
00489 void News::new_year_start() {
00490     str = "31 August deadline is approaching for next year's budget decisions.";
00491 }
00492 
00493 //------- End of function News::new_year_start --------//
00494 
00495 //------ Begin of function News::scenario_near_end -------//
00498 void News::scenario_near_end() {
00499     str = "Make haste! You have only one year left to achieve your goal(s).";
00500 }
00501 
00502 //------- End of function News::scenario_near_end --------//
00503 
00504 //------ Begin of function News::open_game_near_end -------//
00507 void News::open_game_near_end() {
00508     str = "This is a demo of the custom game and it will end at the end of the upcoming year.";
00509 
00510 #ifdef DEMO
00511     str = "This demo game will end at the end of the upcoming year.";
00512 #endif
00513 
00514 #ifdef ADMIN
00515     str = "The simulation will complete at the end of the upcoming year.";
00516 #endif
00517 }
00518 
00519 //------- End of function News::open_game_near_end --------//
00520 
00521 //------ Begin of function News::open_game_end -------//
00523 void News::open_game_end() {
00524     str = "This is a demo of the custom game and it has reached its time limit. Please consider buying the Administrator version for fully functional custom games.";
00525 
00526 #ifdef DEMO
00527     str = "This demo game has reached its time limit. Please consider buying the full version to extend play.";
00528 #endif
00529 
00530 #ifdef ADMIN
00531     str = "You have reached the end of the simulation. Congratulations.";
00532 #endif
00533 }
00534 
00535 //------- End of function News::open_game_end --------//
00536 
00537 //------ Begin of function News::scenario_news -------//
00543 void News::scenario_news() {
00544     if ( short_para1 == 0 ) {
00545 #if(GAME_VERSION>=200)
00546         char *plaqueStr[] = { "Summa Cum Laude", "Magna Cum Laude", "Cum Laude" };
00547 #else
00548         char *plaqueStr[] = { "gold", "silver", "bronze" };
00549 #endif
00550 
00551         str = "Congratulations! You have achieved the ";
00552         str += plaqueStr[short_para2];
00553         str += " scenario goal by September ";
00554         str += m.format(short_para3,4);
00555         str += ".  In honor of this occasion, the Board of Trustees is pleased to present you with this ";
00556         str += plaqueStr[short_para2];
00557         str += " plaque.";
00558     }
00559     else if ( short_para1 == 1 ) {
00560         str = "The time limit for this scenario has expired.";
00561     }
00562     else
00563         err_here();
00564 }
00565 
00566 //------- End of function News::scenario_news --------//
00567 
00568 // News::protagonist_message moved to OPSCH_PO.CPP

Generated on Fri Aug 23 01:38:08 2002 for VirtualU by doxygen1.2.17