Go to the documentation of this file.
1 /* $Id: economy_func.h 24565 2012-10-01 19:31:55Z frosch $ */
3 /*
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 <>.
8  */
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"
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. */
28 extern Prices _price;
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);
49 static inline bool EconomyIsInRecession()
50 {
51  return _economy.fluct <= 0;
52 }
54 #endif /* ECONOMY_FUNC_H */
Money Prices[PR_END]
Prices of everything.
Definition: economy_type.h:146
const ScoreInfo _score_info[]
Score info, values used for computing the detailed performance rating.
Definition: economy.cpp:85
void SetPriceBaseMultiplier(Price price, int factor)
Change a price base by the given factor.
Definition: economy.cpp:899
Enumeration of all base prices for use with Prices.
Definition: economy_type.h:67
Vehicle data structure.
Definition: vehicle_base.h:212
Types related to cargoes...
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
Definition: economy.cpp:958
void ResetPriceBaseMultipliers()
Reset changes to the price base multipliers.
Definition: economy.cpp:887
Types related to stations.
How many scores are there..
Definition: economy_type.h:50
void PrepareUnload(Vehicle *front_v)
Prepare the vehicle to be unloaded.
Definition: economy.cpp:1247
Types related to the economy.
void LoadUnloadStation(Station *st)
Load/unload the vehicles in this station according to the order they entered.
Definition: economy.cpp:1899
void RecomputePrices()
Computes all prices, payments and maximum loan.
Definition: economy.cpp:760
static bool EconomyIsInRecession()
Is the economy in recession?
Definition: economy_func.h:49
bool AddInflation(bool check_year=true)
Add monthly inflation.
Definition: economy.cpp:722
Data of the economy.
Definition: economy_type.h:21
Maximum number of companies.
Definition: company_type.h:25
void StartupIndustryDailyChanges(bool init_counter)
Initialize the variables that will maintain the daily industry change system.
Definition: economy.cpp:909
Types of cargo source and destination.
Definition: cargo_type.h:139
uint16 SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
Definition: cargo_type.h:146
Types related to vehicles.
int16 fluct
Economy fluctuation status.
Definition: economy_type.h:23
Types related to companies.
void InitializeEconomy()
Resets economy to initial values.
Definition: economy.cpp:943
Data structure for storing how the score is computed for a single score id.
Definition: economy_type.h:58
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
int UpdateCompanyRatingAndValue(Company *c, bool update)
if update is set to true, the economy is updated with this score (also the house is updated...
Definition: economy.cpp:153
Station data structure.
Definition: station_base.h:446
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:104