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

Password:

Onews.h Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Onews.h

Go to the documentation of this file.
00001 //Filename    : ONEWS.H
00002 //Description : Object News
00003 //Owner                 : Fred
00004 
00005 #ifndef __ONEWS_H
00006 #define __ONEWS_H
00007 
00008 #ifndef __ODYNARR_H
00009 #include <ODYNARR.H>
00010 #endif
00011 
00012 #include <OSTR.H>
00013 
00014 //----- Maximum no. of news ---------//
00015 
00016 enum { MAX_NEWS=50 };
00017 
00018 //--------- Define constant --------------//
00019 
00020 #define DISP_NEWS_DAYS  300                       // how long a news should stay on the screen before it disappears
00021 #define DISP_NEWS_COUNT 5                         //## maximum no. of news message displayed on the screen at a time
00022 
00023 #define NEWS_STR_PARA_LEN 20
00024 
00025 //-------- Define news type ---------//
00026 
00027 enum { NEWS_TYPE_NUM=1 };
00028 enum { NEWS_NORMAL=0 };
00029 
00030 enum { NEWS_WHO_NUM=1 };
00031 enum {                                            //, NEWS_DISP_FRIENDLY, NEWS_DISP_PLAYER, NEWS_DISP_NONE };
00032     NEWS_DISP_ALL=0
00033 };
00034 
00035 //------- Define other constant -------//
00036 
00037 enum {
00038     TASK_MSG_SUBTYPE_COUNT = 3,
00039     TASK_STARTED=0, TASK_EXPIRED, TASK_COMPLETED
00040 };
00041 
00042 //--------- Define news id. ----------//
00043 
00044 enum {
00045     NEWS_ALUMNI_DIE = 1,
00046 
00047     NEWS_RAPE_IN_CAMPUS,
00048 
00049     NEWS_RETROFIT_FACILITIES,
00050     NEWS_EARTH_QUAKE,
00051 
00052     NEWS_CONGRESS_RESEARCH,
00053     NEWS_STOCK_MARKET,
00054     NEWS_SCANDALOUS_FUND_USE,
00055     NEWS_NEW_GOVENOR,
00056     NEWS_COURT_LIMIT_MINORITY,
00057     NEWS_RISKY_RESEARCH,                            //## chea 160699
00058     NEWS_SCANDAL_IN_ATHLETICS,                      //## chea 170699
00059     NEWS_RESEARCH_PRIZE,
00060     NEWS_TECHNOLOGY_TRANSFER,
00061     NEWS_CAPITAL_CAMPAIGN,
00062     NEWS_STUDENT_LOANS,
00063 
00064     NEWS_PLAGIARISM_SCANDAL,                        // ## chwg 180699
00065     NEWS_FOR_PROFIT_COMPETITION,                    // ## chwg 190699
00066     NEWS_MINORITY_STUDENT_PERCENTAGE_FALLS,         // ## chwg 210699
00067     NEWS_SUCCESSFUL_GRAD,                           // ## chwg 210699
00068     NEWS_MEDIA_OBTAIN_INFORMATION,                  // ## chwg 210699
00069 
00070     NEWS_ID_NEXT_OF_LAST_CHANCE,                    // must after chance news message
00071     // only chance card event
00072     NEWS_ID_COUNT_ONLY_CHANCE = NEWS_ID_NEXT_OF_LAST_CHANCE-NEWS_ALUMNI_DIE,
00073 
00074 #if(GAME_VERSION>=200)
00075     // protagonist message
00076     NEWS_PROTAGONIST_TRUSTEE_EVALUATION = NEWS_ID_NEXT_OF_LAST_CHANCE,
00077     NEWS_PROTAGONIST_DEGREES_GRANTED,
00078     NEWS_PROTAGONIST_SPONSORED_PERFORMACE,
00079     NEWS_PROTAGONIST_INSTITUTIONAL_PRESTIGE,
00080     NEWS_PROTAGONIST_EDUCATIONAL_QUALITY,
00081     NEWS_PROTAGONIST_SCHOLARSHIP,
00082     NEWS_PROTAGONIST_STUDENT_DIVERSITY,
00083     NEWS_PROTAGONIST_FACULTY_DIVERSITY,
00084     NEWS_PROTAGONIST_ALUMNI_FIVE_YEARS,
00085     NEWS_PROTAGONIST_FACULTY_MORALE,
00086 
00087     NEWS_PROTAGONIST_STUDENT_MORALE,
00088     NEWS_PROTAGONIST_STAFF_MORALE,
00089     NEWS_PROTAGONIST_CURRENT_SURPLUS,
00090     NEWS_PROTAGONIST_SMOOTHED_SURPLUS,
00091     NEWS_PROTAGONIST_ENDOWMENT_PAYOUT,
00092     NEWS_PROTAGONIST_MAINTENANCE_BACKLOG,
00093     NEWS_PROTAGONIST_UG_SELECTIVITY,
00094     NEWS_PROTAGONIST_ALUMNI_MORALE,
00095     NEWS_PROTAGONIST_ALUMNI_DONATION,
00096     NEWS_PROTAGONIST_ENDOWMENT_MARKET_VALUE,
00097 
00098     NEWS_PROTAGONIST_CRIME_INDEX,
00099     NEWS_PROTAGONIST_RESEARCH_PERFORMANCE,
00100     NEWS_PROTAGONIST_SALARIES_INCREASE,
00101     NEWS_PROTAGONIST_SALARIES_GENDER_EQ,
00102     NEWS_PROTAGONIST_SALARIES_DEPT_EQ,
00103     NEWS_PROTAGONIST_SALARIES_RANK_EQ,
00104     NEWS_PROTAGONIST_TUITION_INCREASE,
00105     NEWS_PROTAGONIST_SPACE_SHORTFALL,
00106     NEWS_PROTAGONIST_FOOTBALL_PERFORMANCE,
00107     NEWS_PROTAGONIST_BASKETBALL_PERFORMANCE,
00108 
00109     NEWS_PROTAGONIST_DEPT_EDUCATIONAL_QUALITY,
00110     NEWS_PROTAGONIST_DEPT_PRESTIGE,
00111     NEWS_PROTAGONIST_COURSE_DENIALS,
00112     NEWS_PROTAGONIST_CLASS_SIZE_DEVIATION,
00113 #endif
00114 
00115     // non-chance event
00116     NEWS_NEW_YEAR_START,
00117     NEWS_SCENARIO_NEAR_END,
00118     NEWS_SCENARIO_NEWS,
00119     NEWS_FOOTBALL_GAME,
00120     NEWS_BASKETBALL_GAME,
00121 
00122     NEWS_OPEN_GAME_NEAR_END,
00123     NEWS_OPEN_GAME_END,
00124 
00125 #if(GAME_VERSION>=200)
00126     NEWS_BANKRUPTCY_LV1,
00127     NEWS_BANKRUPTCY_LV2,
00128     NEWS_BANKRUPTCY_LV3,
00129 #endif
00130 
00131     NEWS_NEW_TASK,                                  // must be the last id
00132 
00133     NEWS_ID_NEXT_OF_LAST_NEWS,
00134     NEWS_ID_COUNT = NEWS_ID_NEXT_OF_LAST_NEWS-1,
00135 };
00136 
00137 //------------------------------------//
00138 // Task array/list properties:
00139 //
00140 // - shown on both message (normal news) and objective sections
00141 // - will be removed from the objective section after the task offer expires or the task is completed
00142 // - checked monthly the success of the task; add bonus if task is completed
00143 //
00144 
00145 //------- Define struct News ---------//
00146 
00151 struct News {
00152 public:
00153     char  id;                                     // id. of the news, NEWS_???
00154     char  task_id;                                // the corresponding task id, TASK_???, if this is a new task messsage
00155 
00156     char  type;                                   // news type   // type may be > NEWS_TYPE_NUM, for indicating that the news has been displayed in the stock window, do display it on the newspaper again
00157     char  news_type()     { return type%NEWS_TYPE_NUM; }
00158     char  task_msg_subtype;                       // = TASK_* above
00159 
00160     long  news_date;                              // date of the news
00161 
00162     //int   nation_name_id1;   // nation res. id of the nation that generate the news
00163     //int   nation_name_id2;   // if the news is related to two nations (e.g. one nation buys the stock of another nation)
00164 
00165     //char* u_name1();
00166     //char* player_name1();
00167 
00168     int short_para1;
00169     int short_para2;
00170     int short_para3;
00171     short short_para4;
00172     short short_para5;
00173     short short_para6;
00174     short short_para7;
00175     float float_para1;
00176     char  str_para1[NEWS_STR_PARA_LEN+1];
00177 
00178     static  String str;                           // for msg
00179     int   line_count;
00180 
00181 public:
00182     char* msg();                                  // return the news msg
00183 
00184     void  task_msg();
00185     char* get_task_msg();
00186 
00187     //---- functions for return news string for msg() ----//
00188 
00189     void  alumni_die();
00190     void  rape_in_campus();
00191     void  retrofit_facilities();
00192     void  earth_quake();
00193     void  risky_research();                       //## chea 160699
00194     void  scandal_in_athletics();                 //## chea 170699
00195     void  research_prize();
00196     void  technology_transfer();
00197     void  capital_campaign();
00198     void  student_loans();
00199 
00200     void  plagiarism_scandal();                   // ## chwg 170699
00201     void  for_profit_competition();               // ## chwg 190699
00202     void  minority_student_percentage_falls();    // ## chwg 210699
00203     void  successful_grad();                      // ## chwg 210699
00204     void  media_obtain_information();             // ## chwg 210699
00205 
00206     void  congress_research();
00207     void  stock_market();
00208     void  scandalous_fund_use();
00209     void  new_governor();
00210     void  court_limit_minority();
00211 
00212     void  football_game();
00213     void  basketball_game();
00214 
00215 #if(GAME_VERSION>=200)
00216     // protagonist message
00217     void  protagonist_message();                  // for all id beginning with NEWS_PROTAGONIST_
00218     void  bankruptcy_message_lv1();
00219     void  bankruptcy_message_lv2();
00220     void  bankruptcy_message_lv3();
00221 #endif
00222 
00223     //-------------------------------//
00224 
00225     void  new_year_start();
00226     void  scenario_near_end();
00227     void  scenario_news();
00228 
00229     void  open_game_near_end();
00230     void  open_game_end();
00231 
00232     //---- news messages for tasks ----//
00233 
00234     void  new_task();
00235 
00236     void  news_rise_performance();
00237     void  news_educational_quality();             //## chea 220999
00238     void  news_student_morale();
00239     void  news_department_morale();
00240     void  news_rise_faculty_research_Per();
00241     void  news_rise_faculty_diversity_index();
00242     void  news_rise_use_of_IT();
00243     void  news_rise_staff_morale();
00244 
00245     //--------------------------------------------//
00246     // interface related section
00247 
00248     void  set_newspaper_popup();
00249     //int       put(int y, int detectAction, int& newsHeight);
00250 };
00251 
00252 //-------- Define class NewsArray ----------//
00253 
00254 class Font;
00255 
00259 class NewsArray : public DynArray {
00260 public:
00261     //------ display options ------//
00262 
00263     char  news_type_option[NEWS_TYPE_NUM];
00264     char  news_who_option;
00265     char  news_add_flag;
00266 
00267     int last_clear_recno;
00268 
00269     //--------------------------------/
00270     //##
00271 public:
00272     NewsArray();
00273 
00274     void  init();                                 // called in ogame.cpp
00275     void  deinit();                               // called in ogame.cpp
00276 
00277     int write_file(File* filePtr);
00278     int read_file(File* filePtr);
00279 
00280     void  enable()        { news_add_flag = 1; }
00281     void  disable()   { news_add_flag = 0; }
00282 
00283     void  reset();
00284     void  default_setting();
00285 
00286     void  clear_news_disp();
00287 
00288     News* add_news(int newsId, int newsType=NEWS_NORMAL);
00289     void  remove(int newsId, int shortPara1);
00290     //##
00291 
00292     //------ functions for adding news -------//
00293 
00294     void  alumni_die(int gender, int bequest);
00295     void  rape_in_campus();
00296     void  retrofit_facilities(int dollarLost);
00297     void  earth_quake();
00298     void  risky_research(int moneyLost);          //## chea 160699
00299     void  scandal_in_athletics();                 //## chea 170699
00300     void  research_prize(int deptRecno, int facultyRecno);
00301     void  technology_transfer(int deptRecno, float transferAmount);
00302     void  capital_campaign();
00303     void  student_loans(int is_increase);         //## chea 230699
00304 
00305     // ## chwg 170699
00306     void  plagiarism_scandal(int dismissedStudCount);
00307     void  for_profit_competition();               // ## chwg 170699
00308     void  minority_student_percentage_falls();    // ## chwg 210699
00309     void  successful_grad();                      // ## chwg 210699
00310     // ## chwg 210699
00311     void  media_obtain_information(float trueCostEducation);
00312 
00313     void  congress_research(char direction);
00314     void  stock_market(char direction);
00315     void  scandalous_fund_use(int dollarLost);
00316     void  new_governor(char direction);
00317     void  court_limit_minority();
00318 
00319 #if(GAME_VERSION>=200)
00320     // protagonist message
00321     // for all id beginning with NEWS_PROTAGONIST_
00322     void  protagonist_message(int protagonistId, int rating, int departmentRecno, int srcPara1, short srcPara2, short srcPara3, short srcPara4 );
00323 
00324     // bankruptcy message
00325     void  bankruptcy_message_lv1();
00326     void  bankruptcy_message_lv2( int monthsToBankruptcy );
00327     void  bankruptcy_message_lv3( int monthsToBankruptcy );
00328 #endif
00329 
00330     void  new_year_start();
00331     void  scenario_near_end();
00332     void  scenario_news(char type, char subType=0, int year=0);
00333     void  football_game(int numWins);
00334     void  basketball_game(int numWins);
00335 
00336     void  open_game_near_end();
00337     void  open_game_end();
00338 
00339     void  new_task(News *taskPtr, char subtype=TASK_STARTED);
00340 
00341     //--------------------------------------------//
00342 
00343     News* operator[](int recNo);
00344 };
00345 
00346 extern NewsArray news_array;
00347 
00348 //-------------------------------------------//
00349 #endif

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