# economy_type.h

Go to the documentation of this file.

    00001 /* $Id: economy_type.h 23595 2011-12-19 17:48:04Z rubidium $ */
    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
    00021 struct Economy {
    00022   Money max_loan;
    00023   int16 fluct;
    00024   byte interest_rate;
    00025   byte infl_amount;
    00026   byte infl_amount_pr;
    00027   uint32 industry_daily_change_counter;
    00028   uint32 industry_daily_increment;
    00029   uint64 inflation_prices;
    00030   uint64 inflation_payment;
    00031
    00032   /* Old stuff for savegame conversion only */
    00033   Money old_max_loan_unround;
    00034   uint16 old_max_loan_unround_fract;
    00035 };
    00036
    00038 enum ScoreID {
    00039   SCORE_BEGIN      = 0,
    00040   SCORE_VEHICLES   = 0,
    00041   SCORE_STATIONS   = 1,
    00042   SCORE_MIN_PROFIT = 2,
    00043   SCORE_MIN_INCOME = 3,
    00044   SCORE_MAX_INCOME = 4,
    00045   SCORE_DELIVERED  = 5,
    00046   SCORE_CARGO      = 6,
    00047   SCORE_MONEY      = 7,
    00048   SCORE_LOAN       = 8,
    00049   SCORE_TOTAL      = 9,
    00050   SCORE_END        = 10,
    00051
    00052   SCORE_MAX = 1000,
    00053   /* the scores together of score_info is allowed to be more! */
    00054 };
    00055 DECLARE_POSTFIX_INCREMENT(ScoreID)
    00056
    00057
    00058 struct ScoreInfo {
    00059   int needed;
    00060   int score;
    00061 };
    00062
    00067 enum Price {
    00068   PR_BEGIN = 0,
    00069   PR_STATION_VALUE = 0,
    00070   PR_BUILD_RAIL,
    00071   PR_BUILD_ROAD,
    00072   PR_BUILD_SIGNALS,
    00073   PR_BUILD_BRIDGE,
    00074   PR_BUILD_DEPOT_TRAIN,
    00075   PR_BUILD_DEPOT_ROAD,
    00076   PR_BUILD_DEPOT_SHIP,
    00077   PR_BUILD_TUNNEL,
    00078   PR_BUILD_STATION_RAIL,
    00079   PR_BUILD_STATION_RAIL_LENGTH,
    00080   PR_BUILD_STATION_AIRPORT,
    00081   PR_BUILD_STATION_BUS,
    00082   PR_BUILD_STATION_TRUCK,
    00083   PR_BUILD_STATION_DOCK,
    00084   PR_BUILD_VEHICLE_TRAIN,
    00085   PR_BUILD_VEHICLE_WAGON,
    00086   PR_BUILD_VEHICLE_AIRCRAFT,
    00087   PR_BUILD_VEHICLE_ROAD,
    00088   PR_BUILD_VEHICLE_SHIP,
    00089   PR_BUILD_TREES,
    00090   PR_TERRAFORM,
    00091   PR_CLEAR_GRASS,
    00092   PR_CLEAR_ROUGH,
    00093   PR_CLEAR_ROCKS,
    00094   PR_CLEAR_FIELDS,
    00095   PR_CLEAR_TREES,
    00096   PR_CLEAR_RAIL,
    00097   PR_CLEAR_SIGNALS,
    00098   PR_CLEAR_BRIDGE,
    00099   PR_CLEAR_DEPOT_TRAIN,
    00100   PR_CLEAR_DEPOT_ROAD,
    00101   PR_CLEAR_DEPOT_SHIP,
    00102   PR_CLEAR_TUNNEL,
    00103   PR_CLEAR_WATER,
    00104   PR_CLEAR_STATION_RAIL,
    00105   PR_CLEAR_STATION_AIRPORT,
    00106   PR_CLEAR_STATION_BUS,
    00107   PR_CLEAR_STATION_TRUCK,
    00108   PR_CLEAR_STATION_DOCK,
    00109   PR_CLEAR_HOUSE,
    00110   PR_CLEAR_ROAD,
    00111   PR_RUNNING_TRAIN_STEAM,
    00112   PR_RUNNING_TRAIN_DIESEL,
    00113   PR_RUNNING_TRAIN_ELECTRIC,
    00114   PR_RUNNING_AIRCRAFT,
    00115   PR_RUNNING_ROADVEH,
    00116   PR_RUNNING_SHIP,
    00117   PR_BUILD_INDUSTRY,
    00118   PR_CLEAR_INDUSTRY,
    00119   PR_BUILD_OBJECT,
    00120   PR_CLEAR_OBJECT,
    00121   PR_BUILD_WAYPOINT_RAIL,
    00122   PR_CLEAR_WAYPOINT_RAIL,
    00123   PR_BUILD_WAYPOINT_BUOY,
    00124   PR_CLEAR_WAYPOINT_BUOY,
    00125   PR_TOWN_ACTION,
    00126   PR_BUILD_FOUNDATION,
    00127   PR_BUILD_INDUSTRY_RAW,
    00128   PR_BUILD_TOWN,
    00129   PR_BUILD_CANAL,
    00130   PR_CLEAR_CANAL,
    00131   PR_BUILD_AQUEDUCT,
    00132   PR_CLEAR_AQUEDUCT,
    00133   PR_BUILD_LOCK,
    00134   PR_CLEAR_LOCK,
    00135   PR_INFRASTRUCTURE_RAIL,
    00136   PR_INFRASTRUCTURE_ROAD,
    00137   PR_INFRASTRUCTURE_WATER,
    00138   PR_INFRASTRUCTURE_STATION,
    00139   PR_INFRASTRUCTURE_AIRPORT,
    00140
    00141   PR_END,
    00142   INVALID_PRICE = 0xFF
    00143 };
    00144 DECLARE_POSTFIX_INCREMENT(Price)
    00145
    00146 typedef Money Prices[PR_END];
    00147 typedef int8 PriceMultipliers[PR_END];
    00148
    00150 enum ExpensesType {
    00151   EXPENSES_CONSTRUCTION =  0,
    00152   EXPENSES_NEW_VEHICLES,
    00153   EXPENSES_TRAIN_RUN,
    00154   EXPENSES_ROADVEH_RUN,
    00155   EXPENSES_AIRCRAFT_RUN,
    00156   EXPENSES_SHIP_RUN,
    00157   EXPENSES_PROPERTY,
    00158   EXPENSES_TRAIN_INC,
    00159   EXPENSES_ROADVEH_INC,
    00160   EXPENSES_AIRCRAFT_INC,
    00161   EXPENSES_SHIP_INC,
    00162   EXPENSES_LOAN_INT,
    00163   EXPENSES_OTHER,
    00164   EXPENSES_END,
    00165   INVALID_EXPENSES      = 0xFF,
    00166 };
    00167
    00171 enum PriceCategory {
    00172   PCAT_NONE,
    00173   PCAT_RUNNING,
    00174   PCAT_CONSTRUCTION,
    00175 };
    00176
    00180 struct PriceBaseSpec {
    00181   Money start_price;
    00182   PriceCategory category;
    00183   uint grf_feature;
    00184   Price fallback_price;
    00185 };
    00186
    00188 static const int LOAN_INTERVAL = 10000;
    00189
    00198 static const uint64 MAX_INFLATION = (1ull << (63 - 32)) - 1;
    00199
    00205 static const int MIN_PRICE_MODIFIER = -8;
    00206 static const int MAX_PRICE_MODIFIER = 16;
    00207 static const int INVALID_PRICE_MODIFIER = MIN_PRICE_MODIFIER - 1;
    00208
    00210 static const uint TUNNELBRIDGE_TRACKBIT_FACTOR = 4;
    00212 static const uint LEVELCROSSING_TRACKBIT_FACTOR = 2;
    00214 static const uint LOCK_DEPOT_TILE_FACTOR = 2;
    00215
    00216 struct CargoPayment;
    00217 typedef uint32 CargoPaymentID;
    00218
    00219 #endif /* ECONOMY_TYPE_H */