# economy_type.h File Reference

Types related to the economy. More...

`#include "core/overflowsafe_type.hpp"`
`#include "core/enum_type.hpp"`
`#include "cargo_type.h"`

Go to the source code of this file.

## Data Structures

struct | Economy
struct | ScoreInfo
struct | PriceBaseSpec
| Describes properties of price bases. More...

## Typedefs

typedef OverflowSafeInt64 | Money
typedef Money | Prices [PR_END]
typedef int8 | PriceMultipliers [PR_END]
typedef uint32 | CargoPaymentID

## Enumerations

enum | ScoreID { SCORE_BEGIN = 0, SCORE_VEHICLES = 0, SCORE_STATIONS = 1, SCORE_MIN_PROFIT = 2, SCORE_MIN_INCOME = 3, SCORE_MAX_INCOME = 4, SCORE_DELIVERED = 5, SCORE_CARGO = 6, SCORE_MONEY = 7, SCORE_LOAN = 8, SCORE_TOTAL = 9, SCORE_END = 10, SCORE_MAX = 1000 }

enum

Price {
PR_BEGIN = 0, PR_STATION_VALUE = 0, PR_BUILD_RAIL, PR_BUILD_ROAD,
PR_BUILD_SIGNALS, PR_BUILD_BRIDGE, PR_BUILD_DEPOT_TRAIN, PR_BUILD_DEPOT_ROAD,
PR_BUILD_DEPOT_SHIP, PR_BUILD_TUNNEL, PR_BUILD_STATION_RAIL, PR_BUILD_STATION_RAIL_LENGTH,
PR_BUILD_STATION_AIRPORT, PR_BUILD_STATION_BUS, PR_BUILD_STATION_TRUCK, PR_BUILD_STATION_DOCK,
PR_BUILD_VEHICLE_TRAIN, PR_BUILD_VEHICLE_WAGON, PR_BUILD_VEHICLE_AIRCRAFT, PR_BUILD_VEHICLE_ROAD,
PR_BUILD_VEHICLE_SHIP, PR_BUILD_TREES, PR_TERRAFORM, PR_CLEAR_GRASS,
PR_CLEAR_ROUGH, PR_CLEAR_ROCKS, PR_CLEAR_FILEDS, PR_CLEAR_TREES,
PR_CLEAR_RAIL, PR_CLEAR_SIGNALS, PR_CLEAR_BRIDGE, PR_CLEAR_DEPOT_TRAIN,
PR_CLEAR_DEPOT_ROAD, PR_CLEAR_DEPOT_SHIP, PR_CLEAR_TUNNEL, PR_CLEAR_WATER,
PR_CLEAR_STATION_RAIL, PR_CLEAR_STATION_AIRPORT, PR_CLEAR_STATION_BUS, PR_CLEAR_STATION_TRUCK,
PR_CLEAR_STATION_DOCK, PR_CLEAR_HOUSE, PR_CLEAR_ROAD, PR_RUNNING_TRAIN_STEAM,
PR_RUNNING_TRAIN_DIESEL, PR_RUNNING_TRAIN_ELECTRIC, PR_RUNNING_AIRCRAFT, PR_RUNNING_ROADVEH,
PR_RUNNING_SHIP, PR_BUILD_INDUSTRY, PR_CLEAR_INDUSTRY, PR_BUILD_UNMOVABLE,
PR_CLEAR_UNMOVABLE, PR_BUILD_WAYPOINT_RAIL, PR_CLEAR_WAYPOINT_RAIL, PR_BUILD_WAYPOINT_BUOY,
PR_CLEAR_WAYPOINT_BUOY, PR_TOWN_ACTION, PR_BUILD_FOUNDATION, PR_BUILD_INDUSTRY_RAW,
PR_BUILD_TOWN, PR_END, INVALID_PRICE = 0xFF
}

| Enumeration of all base prices for use with Prices. More...
enum | ExpensesType { EXPENSES_CONSTRUCTION = 0, EXPENSES_NEW_VEHICLES, EXPENSES_TRAIN_RUN, EXPENSES_ROADVEH_RUN, EXPENSES_AIRCRAFT_RUN, EXPENSES_SHIP_RUN, EXPENSES_PROPERTY, EXPENSES_TRAIN_INC, EXPENSES_ROADVEH_INC, EXPENSES_AIRCRAFT_INC, EXPENSES_SHIP_INC, EXPENSES_LOAN_INT, EXPENSES_OTHER, EXPENSES_END, INVALID_EXPENSES = 0xFF }
enum | PriceCategory { PCAT_NONE, PCAT_RUNNING, PCAT_CONSTRUCTION }
| Categories of a price bases. More...
enum | { MIN_PRICE_MODIFIER = -8, MAX_PRICE_MODIFIER = 16, INVALID_PRICE_MODIFIER = MIN_PRICE_MODIFIER - 1 }
| Maximum NewGRF price modifiers. More...

## Functions

| DECLARE_POSTFIX_INCREMENT (ScoreID)

## Variables

static const int | LOAN_INTERVAL = 10000
| The "steps" in loan size, in British Pounds!
static const uint64 | MAX_INFLATION = (1ull << (63 - 32)) - 1
| Maximum inflation (including fractional part) without causing overflows in int64 price computations.

## Detailed Description

Types related to the economy.

Definition in file economy_type.h.

## Enumeration Type Documentation

anonymous enum

Maximum NewGRF price modifiers.

Increasing base prices by factor 65536 should be enough.

See also:
  MAX_INFLATION

Definition at line 192 of file economy_type.h.

enum Price

Enumeration of all base prices for use with Prices.

The prices are ordered as they are expected by NewGRF cost multipliers, so don't shuffle them.

Definition at line 66 of file economy_type.h.

enum PriceCategory

Categories of a price bases.

Enumerator:

  PCAT_NONE | Not affected by difficulty settings.
  PCAT_RUNNING | Price is affected by "vehicle running cost" difficulty setting.
  PCAT_CONSTRUCTION | Price is affected by "construction cost" difficulty setting.

Definition at line 158 of file economy_type.h.

enum ScoreID

Enumerator:

  SCORE_TOTAL | This must always be the last entry.
  SCORE_END | How many scores are there..
  SCORE_MAX | The max score that can be in the performance history.

Definition at line 37 of file economy_type.h.

## Variable Documentation

const uint64 MAX_INFLATION = (1ull << (63 - 32)) - 1`[static]`

Maximum inflation (including fractional part) without causing overflows in int64 price computations.

This allows for 32 bit base prices (21 are currently needed). Considering the sign bit and 16 fractional bits, there are 15 bits left. 170 years of 4% inflation result in a inflation of about 822, so 10 bits are actually enough. Note, that NewGRF multipliers share the 16 fractional bits.

See also:
  MAX_PRICE_MODIFIER

Definition at line 185 of file economy_type.h.

Referenced by AddInflation().