economy.h
author Darkvater
Thu, 02 Mar 2006 02:22:15 +0000
changeset 3121 2e50f731567a
parent 2630 35249d2ded3e
child 3344 d86c852715fa
permissions -rw-r--r--
(svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
- Remove the temporary synchronisation in during the map-transfer as this is no longer needed
- The saved patches work just like the saved gameoptions. You have a _patches and a _patches_newgame struct. The _patches_newgame struct contains the values from the configuration file and thus the defaults for new games. When a new game is started or an older game is loaded, the default values are copied over to _patches to be used. When you load a game that has PATS saved, the default values are also loaded, but immediately overwritten by the values from the savegame. This ensures that player-based values are always taken from your personal preferences.
- The current implementation also changes the default values if you change player-based settings in the game. For example changing window_snap_radius in a certain game will also change it for all next OpenTTD sessions.
- The savegame version has been increased to 22.
- The last 6 orso patches close the following reports:
[ 1366446 ] different names for patches: all patch settings have the same name as in the configuration file and are reachable from the console.
[ 1288024 ] Strange string on OTTD initial screen: configuration (and this includes patches) inputs are validated and clamped to their minimum/maximum values.
[ 1423198 ] Make "Signals on Drive side" player, not server, based: this is only visual so current setting is to save it with the savegame but not synchronise in multiplayer.
[ 1208070 ] Patches and New GRF options saved: apart from newgrf this is done
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 1977
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 1977
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#ifndef ECONOMY_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     4
#define ECONOMY_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
2506
777ac2d9a98a (svn r3032) -NewGRF, Feature: Add support for changing base prices.
peter1138
parents: 2261
diff changeset
     6
void ResetPriceBaseMultipliers(void);
2508
c1a1af1920ce (svn r3034) -NewGRF: Improve error checking of setting price bases.
peter1138
parents: 2506
diff changeset
     7
void SetPriceBaseMultiplier(uint price, byte factor);
2506
777ac2d9a98a (svn r3032) -NewGRF, Feature: Add support for changing base prices.
peter1138
parents: 2261
diff changeset
     8
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
	// Maximum possible loan
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
	int32 max_loan;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
	int32 max_loan_unround;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
	// Economy fluctuation status
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
	int fluct;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
	// Interest
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
	byte interest_rate;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    17
	byte infl_amount;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
	byte infl_amount_pr;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
} Economy;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
VARDEF Economy _economy;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
typedef struct Subsidy {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
	byte cargo_type;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
	byte age;
820
9d311999f866 (svn r1291) -Codechange: prepared subsidies and towns to become an uint16 (happens
truelight
parents: 240
diff changeset
    26
	uint16 from;
9d311999f866 (svn r1291) -Codechange: prepared subsidies and towns to become an uint16 (happens
truelight
parents: 240
diff changeset
    27
	uint16 to;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
} Subsidy;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
116
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    31
enum {
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    32
    SCORE_VEHICLES = 0,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    33
    SCORE_STATIONS = 1,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    34
    SCORE_MIN_PROFIT = 2,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    35
    SCORE_MIN_INCOME = 3,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    36
    SCORE_MAX_INCOME = 4,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    37
    SCORE_DELIVERED = 5,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    38
    SCORE_CARGO = 6,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    39
    SCORE_MONEY = 7,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    40
    SCORE_LOAN = 8,
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    41
    SCORE_TOTAL = 9, // This must always be the last entry
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    42
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    43
    NUM_SCORE = 10, // How many scores are there..
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 179
diff changeset
    44
116
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    45
    SCORE_MAX = 1000, 	// The max score that can be in the performance history
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    46
    					//  the scores together of score_info is allowed to be more!
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    47
};
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    48
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    49
typedef struct ScoreInfo {
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    50
    byte id;			// Unique ID of the score
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    51
    int needed;			// How much you need to get the perfect score
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    52
    int score;			// How much score it will give
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    53
} ScoreInfo;
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    54
2261
3f78323707bb (svn r2781) Fix some of the issues with variables in .h files.
ludde
parents: 2186
diff changeset
    55
extern const ScoreInfo _score_info[];
3f78323707bb (svn r2781) Fix some of the issues with variables in .h files.
ludde
parents: 2186
diff changeset
    56
extern int _score_part[MAX_PLAYERS][NUM_SCORE];
116
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    57
147
d0c8100d18cf (svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater
parents: 116
diff changeset
    58
int UpdateCompanyRatingAndValue(Player *p, bool update);
d0c8100d18cf (svn r148) -Feature: Company HQ can now be moved somewhere else (cost 1% of company value). Water floods HQ.
darkvater
parents: 116
diff changeset
    59
void UpdatePlayerHouse(Player *p, uint score);
116
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    60
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 0
diff changeset
    61
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
VARDEF Subsidy _subsidies[MAX_PLAYERS];
2630
35249d2ded3e (svn r3172) static, const
tron
parents: 2522
diff changeset
    63
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode);
820
9d311999f866 (svn r1291) -Codechange: prepared subsidies and towns to become an uint16 (happens
truelight
parents: 240
diff changeset
    64
void DeleteSubsidyWithIndustry(uint16 index);
9d311999f866 (svn r1291) -Codechange: prepared subsidies and towns to become an uint16 (happens
truelight
parents: 240
diff changeset
    65
void DeleteSubsidyWithStation(uint16 index);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, byte cargo_type);
1977
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 820
diff changeset
    68
uint MoveGoodsToStation(TileIndex tile, int w, int h, int type, uint amount);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
#endif /* ECONOMY_H */