# 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 "player_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.
int | UpdateCompanyRatingAndValue (Player *p, 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)
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 | VehiclePayment (Vehicle *front_v)
| Performs the vehicle payment _and_ marks 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_PLAYERS][SCORE_END]
Economy | _economy
Subsidy | _subsidies [MAX_PLAYERS]
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 1819 of file economy.cpp.

References LoadUnloadVehicle().

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 899 of file economy.cpp.

int UpdateCompanyRatingAndValue | ( | Player * | p,
|  | 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
  | p | player been evaluated

Returns:
  actual score of this player

Definition at line 148 of file economy.cpp.

References Clamp(), ClampToI32(), CountBits(), max(), min(), SCORE_END, SCORE_MAX, and SCORE_TOTAL.

Referenced by CmdBuildCompanyHQ().

void VehiclePayment | ( | Vehicle * | front_v | ) |

Performs the vehicle payment _and_ marks the vehicle to be unloaded.

Parameters:

  | front_v | the vehicle to be unloaded

Definition at line 1476 of file economy.cpp.

References ClrBit(), CargoPacket::count, CargoPacket::days_in_transit, DistanceManhattan(), CargoPacket::feeder_share, HasBit(), CargoPacket::loaded_at_xy, OFB_TRANSFER, OFB_UNLOAD, CargoPacket::paid_for, SetBit(), CargoPacket::source, and CargoPacket::source_xy.