OpenTTD Source: src/economy_func.h Source File

OpenTTD Source 13.2.1

economy_func.h
Go to the documentation of this file.
1 /*
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/>.
6 */
7
10 #ifndef ECONOMY_FUNC_H
11 #define ECONOMY_FUNC_H
12
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"
18
19 void ResetPriceBaseMultipliers();
20 void SetPriceBaseMultiplier(Price price, int factor);
21
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. */
26 extern Prices _price;
27
28 int UpdateCompanyRatingAndValue(Company *c, bool update);
29 void StartupIndustryDailyChanges(bool init_counter);
30
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, Owner exclusivity = INVALID_OWNER);
33
34 void PrepareUnload(Vehicle *front_v);
35 void LoadUnloadStation(Station *st);
36
37 Money GetPrice(Price index, uint cost_factor, const struct GRFFile *grf_file, int shift = 0);
38
39 void InitializeEconomy();
40 void RecomputePrices();
41 bool AddInflation(bool check_year = true);
42
47 static inline bool EconomyIsInRecession()
48 {
49 return _economy.fluct <= 0;
50 }
51
52 #endif /* ECONOMY_FUNC_H */
GetPrice
Money GetPrice(Price index, uint cost_factor, const GRFFile *grf_file, int shift)
Determine a certain price.
Definition: economy.cpp:961
LoadUnloadStation
void LoadUnloadStation(Station *st)
Load/unload the vehicles in this station according to the order they entered.
Definition: economy.cpp:1927
Station
Station data structure.
Definition: station_base.h:454
Price
Price
Enumeration of all base prices for use with Prices.
Definition: economy_type.h:74
PrepareUnload
void PrepareUnload(Vehicle *front_v)
Prepare the vehicle to be unloaded.
Definition: economy.cpp:1259
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:224
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
ResetPriceBaseMultipliers
void ResetPriceBaseMultipliers()
Reset changes to the price base multipliers.
Definition: economy.cpp:882
Economy::fluct
int16 fluct
Economy fluctuation status.
Definition: economy_type.h:30
InitializeEconomy
void InitializeEconomy()
Resets economy to initial values.
Definition: economy.cpp:946
StartupIndustryDailyChanges
void StartupIndustryDailyChanges(bool init_counter)
Initialize the variables that will maintain the daily industry change system.
Definition: economy.cpp:904
SourceID
uint16 SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
Definition: cargo_type.h:153
SCORE_END
@ SCORE_END
How many scores are there..
Definition: economy_type.h:57
cargo_type.h
INVALID_OWNER
@ INVALID_OWNER
An invalid owner.
Definition: company_type.h:29
SetPriceBaseMultiplier
void SetPriceBaseMultiplier(Price price, int factor)
Change a price base by the given factor.
Definition: economy.cpp:894
MAX_COMPANIES
@ MAX_COMPANIES
Maximum number of companies.
Definition: company_type.h:23
_score_info
const ScoreInfo _score_info[]
Score info, values used for computing the detailed performance rating.
Definition: economy.cpp:86
StationList
std::set< Station *, StationCompare > StationList
List of stations.
Definition: station_type.h:95
EconomyIsInRecession
static bool EconomyIsInRecession()
Is the economy in recession?
Definition: economy_func.h:47
RecomputePrices
void RecomputePrices()
Computes all prices, payments and maximum loan.
Definition: economy.cpp:758
vehicle_type.h
SourceType
SourceType
Types of cargo source and destination.
Definition: cargo_type.h:147
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:166
Economy
Data of the economy.
Definition: economy_type.h:28
OverflowSafeInt< int64 >
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:20
economy_type.h
Company
Definition: company_base.h:117
AddInflation
bool AddInflation(bool check_year=true)
Add monthly inflation.
Definition: economy.cpp:720
company_type.h
GRFFile
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:106
Prices
Money Prices[PR_END]
Prices of everything.
Definition: economy_type.h:153
ScoreInfo
Data structure for storing how the score is computed for a single score id.
Definition: economy_type.h:65
station_type.h