src/economy_type.h
author rubidium
Fri, 21 Dec 2007 21:50:46 +0000
changeset 8116 8da76dcb3287
child 8119 52b48108425a
permissions -rw-r--r--
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
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"
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    10
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    11
typedef OverflowSafeInt64 Money;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    12
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    13
struct Economy {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    14
	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
    15
	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
    16
	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
    17
	int fluct;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    18
	byte interest_rate;     ///< Interest
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    19
	byte infl_amount;       ///< inflation amount
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    20
	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
    21
};
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
struct Subsidy {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    24
	CargoID cargo_type;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    25
	byte age;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    26
	/* 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
    27
	uint16 from;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    28
	uint16 to;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    29
};
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
enum ScoreID {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    32
	SCORE_BEGIN      = 0,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    33
	SCORE_VEHICLES   = 0,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    34
	SCORE_STATIONS   = 1,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    35
	SCORE_MIN_PROFIT = 2,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    36
	SCORE_MIN_INCOME = 3,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    37
	SCORE_MAX_INCOME = 4,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    38
	SCORE_DELIVERED  = 5,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    39
	SCORE_CARGO      = 6,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    40
	SCORE_MONEY      = 7,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    41
	SCORE_LOAN       = 8,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    42
	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
    43
	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
    44
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    45
	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
    46
	/* 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
    47
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    48
DECLARE_POSTFIX_INCREMENT(ScoreID);
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    49
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    50
struct ScoreInfo {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    51
	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
    52
	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
    53
	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
    54
};
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
struct Prices {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    57
	Money station_value;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    58
	Money build_rail;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    59
	Money build_road;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    60
	Money build_signals;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    61
	Money build_bridge;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    62
	Money build_train_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    63
	Money build_road_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    64
	Money build_ship_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    65
	Money build_tunnel;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    66
	Money train_station_track;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    67
	Money train_station_length;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    68
	Money build_airport;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    69
	Money build_bus_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    70
	Money build_truck_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    71
	Money build_dock;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    72
	Money build_railvehicle;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    73
	Money build_railwagon;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    74
	Money aircraft_base;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    75
	Money roadveh_base;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    76
	Money ship_base;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    77
	Money build_trees;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    78
	Money terraform;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    79
	Money clear_grass;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    80
	Money clear_roughland;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    81
	Money clear_rocks;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    82
	Money clear_fields;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    83
	Money remove_trees;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    84
	Money remove_rail;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    85
	Money remove_signals;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    86
	Money clear_bridge;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    87
	Money remove_train_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    88
	Money remove_road_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    89
	Money remove_ship_depot;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    90
	Money clear_tunnel;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    91
	Money clear_water;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    92
	Money remove_rail_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    93
	Money remove_airport;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    94
	Money remove_bus_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    95
	Money remove_truck_station;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    96
	Money remove_dock;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    97
	Money remove_house;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    98
	Money remove_road;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
    99
	Money running_rail[3];
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   100
	Money aircraft_running;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   101
	Money roadveh_running;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   102
	Money ship_running;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   103
	Money build_industry;
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   104
};
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
enum {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   107
	NUM_PRICES = 49,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   108
};
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
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
   111
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   112
enum ExpensesType {
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   113
	EXPENSES_CONSTRUCTION =  0,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   114
	EXPENSES_NEW_VEHICLES =  1,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   115
	EXPENSES_TRAIN_RUN    =  2,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   116
	EXPENSES_ROADVEH_RUN  =  3,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   117
	EXPENSES_AIRCRAFT_RUN =  4,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   118
	EXPENSES_SHIP_RUN     =  5,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   119
	EXPENSES_PROPERTY     =  6,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   120
	EXPENSES_TRAIN_INC    =  7,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   121
	EXPENSES_ROADVEH_INC  =  8,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   122
	EXPENSES_AIRCRAFT_INC =  9,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   123
	EXPENSES_SHIP_INC     = 10,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   124
	EXPENSES_LOAN_INT     = 11,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   125
	EXPENSES_OTHER        = 12,
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   126
};
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   127
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
diff changeset
   128
#endif /* ECONOMY_TYPE_H */