4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
10 /** @file economy_func.h Functions related to the economy. */
12 #ifndef ECONOMY_FUNC_H
13 #define ECONOMY_FUNC_H
15 #include "economy_type.h"
16 #include "station_type.h"
17 #include "cargo_type.h"
18 #include "vehicle_type.h"
19 #include "company_type.h"
21 void ResetPriceBaseMultipliers();
22 void SetPriceBaseMultiplier(Price price
, int factor
);
24 extern const ScoreInfo _score_info
[];
25 extern int _score_part
[MAX_COMPANIES
][SCORE_END
];
26 extern Economy _economy
;
27 /* Prices and also the fractional part. */
30 int UpdateCompanyRatingAndValue(Company
*c
, bool update
);
31 void StartupIndustryDailyChanges(bool init_counter
);
33 Money
GetTransportedGoodsIncome(uint num_pieces
, uint dist
, byte transit_days
, CargoID cargo_type
);
34 uint
MoveGoodsToStation(CargoID type
, uint amount
, SourceType source_type
, SourceID source_id
, const StationList
*all_stations
);
36 void PrepareUnload(Vehicle
*front_v
);
37 void LoadUnloadStation(Station
*st
);
39 Money
GetPrice(Price index
, uint cost_factor
, const struct GRFFile
*grf_file
, int shift
= 0);
41 void InitializeEconomy();
42 void RecomputePrices();
43 bool AddInflation(bool check_year
= true);
46 * Is the economy in recession?
47 * @return \c True if economy is in recession, \c false otherwise.
49 static inline bool EconomyIsInRecession()
51 return _economy
.fluct
<= 0;
54 #endif /* ECONOMY_FUNC_H */