economy_type.h

Go to the documentation of this file.
00001 /* $Id: economy_type.h 18945 2010-01-29 00:11:30Z yexo $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef ECONOMY_TYPE_H
00013 #define ECONOMY_TYPE_H
00014 
00015 #include "core/overflowsafe_type.hpp"
00016 #include "core/enum_type.hpp"
00017 
00018 typedef OverflowSafeInt64 Money;
00019 
00020 struct Economy {
00021   Money max_loan;                       
00022   int16 fluct;                          
00023   byte interest_rate;                   
00024   byte infl_amount;                     
00025   byte infl_amount_pr;                  
00026   uint32 industry_daily_change_counter; 
00027   uint32 industry_daily_increment;      
00028   uint64 inflation_prices;              
00029   uint64 inflation_payment;             
00030 
00031   /* Old stuff for savegame conversion only */
00032   Money old_max_loan_unround;           
00033   uint16 old_max_loan_unround_fract;    
00034 };
00035 
00036 enum ScoreID {
00037   SCORE_BEGIN      = 0,
00038   SCORE_VEHICLES   = 0,
00039   SCORE_STATIONS   = 1,
00040   SCORE_MIN_PROFIT = 2,
00041   SCORE_MIN_INCOME = 3,
00042   SCORE_MAX_INCOME = 4,
00043   SCORE_DELIVERED  = 5,
00044   SCORE_CARGO      = 6,
00045   SCORE_MONEY      = 7,
00046   SCORE_LOAN       = 8,
00047   SCORE_TOTAL      = 9,  
00048   SCORE_END        = 10, 
00049 
00050   SCORE_MAX = 1000       
00051   /* the scores together of score_info is allowed to be more! */
00052 };
00053 DECLARE_POSTFIX_INCREMENT(ScoreID);
00054 
00055 struct ScoreInfo {
00056   byte id;    
00057   int needed; 
00058   int score;  
00059 };
00060 
00065 enum Price {
00066   PR_BEGIN = 0,
00067   PR_STATION_VALUE = 0,
00068   PR_BUILD_RAIL,
00069   PR_BUILD_ROAD,
00070   PR_BUILD_SIGNALS,
00071   PR_BUILD_BRIDGE,
00072   PR_BUILD_DEPOT_TRAIN,
00073   PR_BUILD_DEPOT_ROAD,
00074   PR_BUILD_DEPOT_SHIP,
00075   PR_BUILD_TUNNEL,
00076   PR_BUILD_STATION_RAIL,
00077   PR_BUILD_STATION_RAIL_LENGTH,
00078   PR_BUILD_STATION_AIRPORT,
00079   PR_BUILD_STATION_BUS,
00080   PR_BUILD_STATION_TRUCK,
00081   PR_BUILD_STATION_DOCK,
00082   PR_BUILD_VEHICLE_TRAIN,
00083   PR_BUILD_VEHICLE_WAGON,
00084   PR_BUILD_VEHICLE_AIRCRAFT,
00085   PR_BUILD_VEHICLE_ROAD,
00086   PR_BUILD_VEHICLE_SHIP,
00087   PR_BUILD_TREES,
00088   PR_TERRAFORM,
00089   PR_CLEAR_GRASS,
00090   PR_CLEAR_ROUGH,
00091   PR_CLEAR_ROCKS,
00092   PR_CLEAR_FIELDS,
00093   PR_CLEAR_TREES,
00094   PR_CLEAR_RAIL,
00095   PR_CLEAR_SIGNALS,
00096   PR_CLEAR_BRIDGE,
00097   PR_CLEAR_DEPOT_TRAIN,
00098   PR_CLEAR_DEPOT_ROAD,
00099   PR_CLEAR_DEPOT_SHIP,
00100   PR_CLEAR_TUNNEL,
00101   PR_CLEAR_WATER,
00102   PR_CLEAR_STATION_RAIL,
00103   PR_CLEAR_STATION_AIRPORT,
00104   PR_CLEAR_STATION_BUS,
00105   PR_CLEAR_STATION_TRUCK,
00106   PR_CLEAR_STATION_DOCK,
00107   PR_CLEAR_HOUSE,
00108   PR_CLEAR_ROAD,
00109   PR_RUNNING_TRAIN_STEAM,
00110   PR_RUNNING_TRAIN_DIESEL,
00111   PR_RUNNING_TRAIN_ELECTRIC,
00112   PR_RUNNING_AIRCRAFT,
00113   PR_RUNNING_ROADVEH,
00114   PR_RUNNING_SHIP,
00115   PR_BUILD_INDUSTRY,
00116   PR_CLEAR_INDUSTRY,
00117   PR_BUILD_UNMOVABLE,
00118   PR_CLEAR_UNMOVABLE,
00119   PR_BUILD_WAYPOINT_RAIL,
00120   PR_CLEAR_WAYPOINT_RAIL,
00121   PR_BUILD_WAYPOINT_BUOY,
00122   PR_CLEAR_WAYPOINT_BUOY,
00123   PR_TOWN_ACTION,
00124   PR_BUILD_FOUNDATION,
00125   PR_BUILD_INDUSTRY_RAW,
00126   PR_BUILD_TOWN,
00127 
00128   PR_END,
00129   INVALID_PRICE = 0xFF
00130 };
00131 DECLARE_POSTFIX_INCREMENT(Price)
00132 
00133 typedef Money Prices[PR_END];
00134 typedef int8 PriceMultipliers[PR_END];
00135 
00136 enum ExpensesType {
00137   EXPENSES_CONSTRUCTION =  0,
00138   EXPENSES_NEW_VEHICLES,
00139   EXPENSES_TRAIN_RUN,
00140   EXPENSES_ROADVEH_RUN,
00141   EXPENSES_AIRCRAFT_RUN,
00142   EXPENSES_SHIP_RUN,
00143   EXPENSES_PROPERTY,
00144   EXPENSES_TRAIN_INC,
00145   EXPENSES_ROADVEH_INC,
00146   EXPENSES_AIRCRAFT_INC,
00147   EXPENSES_SHIP_INC,
00148   EXPENSES_LOAN_INT,
00149   EXPENSES_OTHER,
00150   EXPENSES_END,
00151   INVALID_EXPENSES      = 0xFF,
00152 };
00153 
00157 enum PriceCategory {
00158   PCAT_NONE,         
00159   PCAT_RUNNING,      
00160   PCAT_CONSTRUCTION, 
00161 };
00162 
00166 struct PriceBaseSpec {
00167   Money start_price;      
00168   PriceCategory category; 
00169   uint grf_feature;       
00170   Price fallback_price;   
00171 };
00172 
00174 static const int LOAN_INTERVAL = 10000;
00175 
00184 static const uint64 MAX_INFLATION = (1ull << (63 - 32)) - 1;
00185 
00191 enum {
00192   MIN_PRICE_MODIFIER = -8,
00193   MAX_PRICE_MODIFIER = 16,
00194   INVALID_PRICE_MODIFIER = MIN_PRICE_MODIFIER - 1,
00195 };
00196 
00197 struct CargoPayment;
00198 typedef uint32 CargoPaymentID;
00199 
00200 #endif /* ECONOMY_TYPE_H */

Generated on Thu Feb 4 17:20:23 2010 for OpenTTD by  doxygen 1.5.6