author | rubidium |
Fri, 25 Apr 2008 15:22:32 +0000 | |
changeset 9055 | 4dc6a0c0ef47 |
parent 9017 | 3d422fffe39c |
child 9061 | 8ebd40e86171 |
permissions | -rw-r--r-- |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
2 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
3 |
/** @file player_base.h Definition of stuff that is very close to a player, like the player struct itself. */ |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
4 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
5 |
#ifndef PLAYER_BASE_H |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
6 |
#define PLAYER_BASE_H |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
7 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
8 |
#include "road_type.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
9 |
#include "rail_type.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
10 |
#include "date_type.h" |
8786
1823ff88a054
(svn r12490) -Codechange: rename engine.h to engine_func.h and remove unneeded inclusions of engine.h and/or replace them with engine_type.h.
rubidium
parents:
8515
diff
changeset
|
11 |
#include "engine_type.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
12 |
#include "livery.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
13 |
#include "autoreplace_type.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
14 |
#include "economy_type.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
15 |
#include "tile_type.h" |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
16 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
17 |
struct PlayerEconomyEntry { |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
18 |
Money income; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
19 |
Money expenses; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
20 |
int32 delivered_cargo; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
21 |
int32 performance_history; ///< player score (scale 0-1000) |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
22 |
Money company_value; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
23 |
}; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
24 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
25 |
struct Player { |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
26 |
uint32 name_2; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
27 |
uint16 name_1; |
8258
9fa31acb07bc
(svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is
peter1138
parents:
8254
diff
changeset
|
28 |
char *name; |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
29 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
30 |
uint16 president_name_1; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
31 |
uint32 president_name_2; |
8258
9fa31acb07bc
(svn r11822) -Codechange: Replaced fixed size custom name array. Names are now attached to their object directly and there is
peter1138
parents:
8254
diff
changeset
|
32 |
char *president_name; |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
33 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
34 |
PlayerFace face; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
35 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
36 |
Money player_money; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
37 |
Money current_loan; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
38 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
39 |
byte player_color; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
40 |
Livery livery[LS_END]; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
41 |
byte player_money_fraction; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
42 |
RailTypes avail_railtypes; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
43 |
RoadTypes avail_roadtypes; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
44 |
byte block_preview; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
45 |
PlayerByte index; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
46 |
|
9017
3d422fffe39c
(svn r12816) -Fix: the cargo count in the performance rating window could be wrong.
rubidium
parents:
8786
diff
changeset
|
47 |
uint32 cargo_types; ///< which cargo types were transported the last year |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
48 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
49 |
TileIndex location_of_house; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
50 |
TileIndex last_build_coordinate; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
51 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
52 |
PlayerByte share_owners[4]; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
53 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
54 |
Year inaugurated_year; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
55 |
byte num_valid_stat_ent; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
56 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
57 |
byte quarters_of_bankrupcy; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
58 |
byte bankrupt_asked; ///< which players were asked about buying it? |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
59 |
int16 bankrupt_timeout; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
60 |
Money bankrupt_value; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
61 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
62 |
bool is_active; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
63 |
bool is_ai; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
64 |
|
8515
20b5c6e8415e
(svn r12090) -Codechange : removed a magic number and code style application on enum ExpensesType
belugas
parents:
8258
diff
changeset
|
65 |
Money yearly_expenses[3][EXPENSES_END]; |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
66 |
PlayerEconomyEntry cur_economy; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
67 |
PlayerEconomyEntry old_economy[24]; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
68 |
EngineRenewList engine_renew_list; ///< Defined later |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
69 |
bool engine_renew; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
70 |
bool renew_keep_length; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
71 |
int16 engine_renew_months; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
72 |
uint32 engine_renew_money; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
73 |
uint16 num_engines[TOTAL_NUM_ENGINES]; ///< caches the number of engines of each type the player owns (no need to save this) |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
74 |
}; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
75 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
76 |
extern Player _players[MAX_PLAYERS]; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
77 |
#define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++) |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
78 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
79 |
static inline byte ActivePlayerCount() |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
80 |
{ |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
81 |
const Player *p; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
82 |
byte count = 0; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
83 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
84 |
FOR_ALL_PLAYERS(p) { |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
85 |
if (p->is_active) count++; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
86 |
} |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
87 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
88 |
return count; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
89 |
} |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
90 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
91 |
static inline Player *GetPlayer(PlayerID i) |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
92 |
{ |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
93 |
assert(IsInsideBS(i, PLAYER_FIRST, lengthof(_players))); |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
94 |
return &_players[i]; |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
95 |
} |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
96 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
97 |
Money CalculateCompanyValue(const Player *p); |
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
98 |
|
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
diff
changeset
|
99 |
#endif /* PLAYER_BASE_H */ |