# economy_func.h File Reference

Functions related to the economy. More...

`#include "core/geometry_type.hpp"`
`#include "economy_type.h"`
`#include "cargo_type.h"`
`#include "vehicle_type.h"`
`#include "tile_type.h"`
`#include "town_type.h"`
`#include "industry_type.h"`
`#include "company_type.h"`
`#include "station_type.h"`

Go to the source code of this file.

## Functions
void | ResetPriceBaseMultipliers ()
| Reset changes to the price base multipliers.
void | SetPriceBaseMultiplier (uint price, byte factor)
| Change a price base by the given factor.
void | ResetEconomy ()
int | UpdateCompanyRatingAndValue (Company *c, bool update)
| if update is set to true, the economy is updated with this score (also the house is updated, should only be true in the on-tick event)
Pair | SetupSubsidyDecodeParam (const Subsidy *s, bool mode)
void | DeleteSubsidyWithTown (TownID index)
void | DeleteSubsidyWithIndustry (IndustryID index)
void | DeleteSubsidyWithStation (StationID index)
void | StartupIndustryDailyChanges (bool init_counter)
| Initialize the variables that will maintain the daily industry change system.
Money | GetTransportedGoodsIncome (uint num_pieces, uint dist, byte transit_days, CargoID cargo_type)
uint | MoveGoodsToStation (TileIndex tile, int w, int h, CargoID type, uint amount)
void | PrepareUnload (Vehicle *front_v)
| Prepare the vehicle to be unloaded.
void | LoadUnloadStation (Station *st)
| Load/unload the vehicles in this station according to the order they entered.
Money | GetPriceByIndex (uint8 index)
## Variables
const ScoreInfo | _score_info []
int | _score_part [MAX_COMPANIES][SCORE_END]
Economy | _economy
Subsidy | _subsidies [MAX_COMPANIES]
Prices | _price
uint16 | _price_frac [NUM_PRICES]
Money | _cargo_payment_rates [NUM_CARGO]
uint16 | _cargo_payment_rates_frac [NUM_CARGO]

## Detailed Description

Functions related to the economy.

Definition in file economy_func.h.

## Function Documentation

void LoadUnloadStation | ( | Station * | st | ) |

Load/unload the vehicles in this station according to the order they entered.

Parameters:

  | st | the station to do the loading/unloading for

Definition at line 1840 of file economy.cpp.

References SmallVector< T, S >::Begin(), SmallVector< T, S >::Clear(), SmallVector< T, S >::End(), Station::goods, Station::loading_vehicles, LoadUnloadVehicle(), and TriggerIndustryProduction().

void PrepareUnload | ( | Vehicle * | front_v | ) |

Prepare the vehicle to be unloaded.

Parameters:

  | front_v | the vehicle to be unloaded

Definition at line 1534 of file economy.cpp.

References CargoPayment::CargoPayment(), ClrBit(), OUFB_NO_UNLOAD, and SetBit().

void SetPriceBaseMultiplier | ( | uint | price,
|  | byte | factor |
| ) |  |  |

Change a price base by the given factor.

The price base is altered by factors of two, with an offset of 8. NewBaseCost = OldBaseCost * 2^(n-8)

Parameters:

  | price | Index of price base to change.
  | factor | Amount to change by.

Definition at line 777 of file economy.cpp.

void StartupIndustryDailyChanges | ( | bool | init_counter | ) |

Initialize the variables that will maintain the daily industry change system.

Parameters:

  | init_counter | specifies if the counter is required to be initialized

Definition at line 787 of file economy.cpp.

References MapLogX(), and MapLogY().

Referenced by Load_ECMY().

int UpdateCompanyRatingAndValue | ( | Company * | c,
|  | bool | update |
| ) |  |  |

if update is set to true, the economy is updated with this score (also the house is updated, should only be true in the on-tick event)

Parameters:

  | update | the economy with calculated score
  | c | company been evaluated

Returns:
  actual score of this company

Definition at line 141 of file economy.cpp.

References Clamp(), ClampToI32(), CountBits(), Station::facilities, InvalidateWindow(), max(), min(), Station::owner, SCORE_END, SCORE_MAX, and SCORE_TOTAL.

Referenced by CmdBuildCompanyHQ().