00001
00002
00003
00004
00005 #ifndef __OINVESTMENT_H
00006 #define __OINVESTMENT_H
00007
00008 #include <GAMEDEF.H>
00009 #include <OHISTORY.H>
00010
00011
00012 enum {
00013 P_HISTORY_YEAR_COUNT = 8,
00014 P_HISTORY_PROJECTED_YEAR_COUNT = 2,
00015 P_HISTORY_PASSED_YEAR_COUNT = P_HISTORY_YEAR_COUNT - P_HISTORY_PROJECTED_YEAR_COUNT,
00016
00017 P_THIS_YEAR = P_HISTORY_PASSED_YEAR_COUNT - 1,
00018 P_NEXT_YEAR,
00019 P_2ND_NEXT_YEAR,
00020 };
00021
00022 enum {
00023 PROJECTION_TYPE_COUNT=3,
00024
00025 PROJECTED_VALUE = 0,
00026 PROJECTED_MIN_VALUE,
00027 PROJECTED_MAX_VALUE,
00028 };
00029
00030 enum {
00031 ASSET_TYPE_COUNT = 3,
00032
00033 AS_LC_STOCK=0,
00034 AS_SC_STOCK,
00035 AS_BONDS,
00036 };
00037
00038
00039
00041 struct AssetItem {
00042 int allocation_percent;
00043 float return_mean;
00044 float return_deviation;
00045 };
00046
00047
00048
00052
00053
00054 public:
00055 Investment();
00056 ~Investment();
00057 void init();
00058 void deinit();
00059 void report(int);
00060 int detect();
00061 int detect2();
00062
00063
00064 char current_mode;
00065 int write_file(File* filePtr);
00066 int read_file(File* filePtr);
00067
00068
00069
00070
00071 public:
00072
00073
00074 AssetItem asset_array[ASSET_TYPE_COUNT];
00075
00076
00077 float spinner_var1;
00078
00079 float endowment_performance_history[HISTORY_MONTH_COUNT];
00080 float s_n_p_history[HISTORY_MONTH_COUNT];
00081
00082
00083
00084
00085 int endowment_spending_history[PROJECTION_TYPE_COUNT][P_HISTORY_YEAR_COUNT];
00086 float equilibrium_payout_rate;
00087
00088
00089
00090
00091
00092 char degree_smoothing_for_endowment_payout;
00093
00094
00095
00096 float smoothed_endowment_value;
00097 float endowment_change_year_to_date;
00098
00099 #if(GAME_VERSION>=200)
00100 float smoothed_quasi_endowment_value;
00101 #endif
00102
00103
00104 #if(GAME_VERSION>=200)
00105
00106 int initial_asset_array0_allocation_percent;
00107 int initial_asset_array1_allocation_percent;
00108 int initial_asset_array2_allocation_percent;
00109 float initial_endowment_performance;
00110 #endif
00111
00112
00113 private:
00114 float asset_covariance_array[ASSET_TYPE_COUNT][ASSET_TYPE_COUNT];
00115
00116 HistoryData expected_real_return;
00117 float endowment_growthrate_deviation;
00118 float endowment_ratio;
00119
00120 public:
00121 float expected_real_annual_return_rate;
00122
00123 void init_data();
00124 void next_day();
00125 void calc_smoothed_endowment_value();
00126
00127
00128 #if(GAME_VERSION>=200)
00129 void save_initial_data();
00130 #endif
00131
00132
00133
00134 private:
00135 void calc_endowment_growth();
00136 void calc_equilibrium_payout_rate();
00137 void update_history_sub();
00138 void update_history(char updateFlag=UPDATE_ALL);
00139
00140 };
00141
00142 extern Investment investment_office;
00143
00144
00145 #endif