src/economy_type.h
author peter1138
Tue, 22 Jan 2008 07:27:06 +0000
changeset 8374 7a1b6c89cb89
parent 8254 1496654ca5e7
child 8515 20b5c6e8415e
permissions -rw-r--r--
(svn r11940) -Codechange: Store short filename once per open file instead of once per sprite cache entry. Not all file types need this, but most of the time no sprite cache entry needed it either.
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     1
/* $Id$ */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     2
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     3
/** @file economy_type.h Types related to the economy. */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     4
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     5
#ifndef ECONOMY_TYPE_H
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     6
#define ECONOMY_TYPE_H
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     7
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     8
#include "core/overflowsafe_type.hpp"
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
     9
#include "core/enum_type.hpp"
8119
52b48108425a (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 8116
diff changeset
    10
#include "cargo_type.h"
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    11
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    12
typedef OverflowSafeInt64 Money;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    13
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    14
struct Economy {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    15
	Money max_loan;         ///< Maximum possible loan
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    16
	Money max_loan_unround; ///< Economy fluctuation status
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    17
	uint16 max_loan_unround_fract; ///< Fraction of the unrounded max loan
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    18
	int fluct;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    19
	byte interest_rate;     ///< Interest
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    20
	byte infl_amount;       ///< inflation amount
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    21
	byte infl_amount_pr;    ///< "floating" portion of inflation
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    22
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    23
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    24
struct Subsidy {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    25
	CargoID cargo_type;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    26
	byte age;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    27
	/* from and to can either be TownID, StationID or IndustryID */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    28
	uint16 from;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    29
	uint16 to;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    30
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    31
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    32
enum ScoreID {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    33
	SCORE_BEGIN      = 0,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    34
	SCORE_VEHICLES   = 0,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    35
	SCORE_STATIONS   = 1,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    36
	SCORE_MIN_PROFIT = 2,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    37
	SCORE_MIN_INCOME = 3,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    38
	SCORE_MAX_INCOME = 4,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    39
	SCORE_DELIVERED  = 5,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    40
	SCORE_CARGO      = 6,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    41
	SCORE_MONEY      = 7,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    42
	SCORE_LOAN       = 8,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    43
	SCORE_TOTAL      = 9,  ///< This must always be the last entry
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    44
	SCORE_END        = 10, ///< How many scores are there..
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    45
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    46
	SCORE_MAX = 1000       ///< The max score that can be in the performance history
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    47
	/* the scores together of score_info is allowed to be more! */
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    48
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    49
DECLARE_POSTFIX_INCREMENT(ScoreID);
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    50
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    51
struct ScoreInfo {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    52
	byte id;    ///< Unique ID of the score
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    53
	int needed; ///< How much you need to get the perfect score
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    54
	int score;  ///< How much score it will give
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    55
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    56
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    57
struct Prices {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    58
	Money station_value;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    59
	Money build_rail;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    60
	Money build_road;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    61
	Money build_signals;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    62
	Money build_bridge;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    63
	Money build_train_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    64
	Money build_road_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    65
	Money build_ship_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    66
	Money build_tunnel;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    67
	Money train_station_track;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    68
	Money train_station_length;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    69
	Money build_airport;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    70
	Money build_bus_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    71
	Money build_truck_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    72
	Money build_dock;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    73
	Money build_railvehicle;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    74
	Money build_railwagon;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    75
	Money aircraft_base;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    76
	Money roadveh_base;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    77
	Money ship_base;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    78
	Money build_trees;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    79
	Money terraform;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    80
	Money clear_grass;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    81
	Money clear_roughland;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    82
	Money clear_rocks;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    83
	Money clear_fields;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    84
	Money remove_trees;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    85
	Money remove_rail;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    86
	Money remove_signals;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    87
	Money clear_bridge;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    88
	Money remove_train_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    89
	Money remove_road_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    90
	Money remove_ship_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    91
	Money clear_tunnel;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    92
	Money clear_water;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    93
	Money remove_rail_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    94
	Money remove_airport;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    95
	Money remove_bus_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    96
	Money remove_truck_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    97
	Money remove_dock;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    98
	Money remove_house;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    99
	Money remove_road;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   100
	Money running_rail[3];
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   101
	Money aircraft_running;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   102
	Money roadveh_running;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   103
	Money ship_running;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   104
	Money build_industry;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   105
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   106
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   107
enum {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   108
	NUM_PRICES = 49,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   109
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   110
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   111
assert_compile(NUM_PRICES * sizeof(Money) == sizeof(Prices));
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   112
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   113
enum ExpensesType {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   114
	EXPENSES_CONSTRUCTION =  0,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   115
	EXPENSES_NEW_VEHICLES =  1,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   116
	EXPENSES_TRAIN_RUN    =  2,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   117
	EXPENSES_ROADVEH_RUN  =  3,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   118
	EXPENSES_AIRCRAFT_RUN =  4,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   119
	EXPENSES_SHIP_RUN     =  5,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   120
	EXPENSES_PROPERTY     =  6,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   121
	EXPENSES_TRAIN_INC    =  7,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   122
	EXPENSES_ROADVEH_INC  =  8,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   123
	EXPENSES_AIRCRAFT_INC =  9,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   124
	EXPENSES_SHIP_INC     = 10,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   125
	EXPENSES_LOAN_INT     = 11,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   126
	EXPENSES_OTHER        = 12,
8230
64f28fe2d5c8 (svn r11793) -Codechange: pass the expense type via the CommandCost instead of a global variable. Patch by Noldo (FS#1114).
rubidium
parents: 8119
diff changeset
   127
	INVALID_EXPENSES      = 0xFF,
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   128
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   129
8254
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
   130
/* The "steps" in loan size, in British Pounds! */
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
   131
enum {
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
   132
	LOAN_INTERVAL        = 10000,
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
   133
	LOAN_INTERVAL_OLD_AI = 50000,
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
   134
};
1496654ca5e7 (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8230
diff changeset
   135
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   136
#endif /* ECONOMY_TYPE_H */