OpenTTD

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