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