author | rubidium |
Tue, 18 Dec 2007 20:38:16 +0000 | |
changeset 8598 | 14ae80fe4c8f |
parent 8450 | dce58137301f |
child 8599 | b609cdeeff3f |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
3 |
/** @file player.h */ |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
4 |
|
0 | 5 |
#ifndef PLAYER_H |
6 |
#define PLAYER_H |
|
7 |
||
5216
d581e4db95b6
(svn r7331) - Codechange: Rename all memory pool macro's and types to "old pool", so the new pool implementation can be committed alongside it.
matthijs
parents:
5077
diff
changeset
|
8 |
#include "oldpool.h" |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
9 |
#include "aystar.h" |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
10 |
#include "rail.h" |
8598
14ae80fe4c8f
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8450
diff
changeset
|
11 |
#include "road_func.h" |
2573
1950c5c3aab5
(svn r3110) Replace another 256 with TOTAL_NUM_ENGINES.
peter1138
parents:
2544
diff
changeset
|
12 |
#include "engine.h" |
4603
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
13 |
#include "livery.h" |
8353
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
14 |
#include "genworld.h" |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
15 |
#include "gfx.h" |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
16 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
17 |
struct PlayerEconomyEntry { |
7449
5cedaf2c861c
(svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents:
7448
diff
changeset
|
18 |
Money income; |
5cedaf2c861c
(svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents:
7448
diff
changeset
|
19 |
Money expenses; |
0 | 20 |
int32 delivered_cargo; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
21 |
int32 performance_history; ///< player score (scale 0-1000) |
7451
82101e591f90
(svn r10210) -Codechange: make all money related variables 64 bits, so overflowing them should become a little harder.
rubidium
parents:
7449
diff
changeset
|
22 |
Money company_value; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
23 |
}; |
0 | 24 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
25 |
struct AiBuildRec { |
0 | 26 |
TileIndex spec_tile; |
27 |
TileIndex use_tile; |
|
28 |
byte rand_rng; |
|
29 |
byte cur_building_rule; |
|
30 |
byte unk6; |
|
31 |
byte unk7; |
|
32 |
byte buildcmd_a; |
|
33 |
byte buildcmd_b; |
|
34 |
byte direction; |
|
3344
d86c852715fa
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents:
2952
diff
changeset
|
35 |
CargoID cargo; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
36 |
}; |
0 | 37 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
38 |
struct PlayerAI { |
0 | 39 |
byte state; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
40 |
byte tick; ///< Used to determine how often to move |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
41 |
uint32 state_counter; ///< Can hold tile index! |
0 | 42 |
uint16 timeout_counter; |
43 |
||
44 |
byte state_mode; |
|
45 |
byte banned_tile_count; |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
46 |
RailTypeByte railtype_to_use; |
0 | 47 |
|
3344
d86c852715fa
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents:
2952
diff
changeset
|
48 |
CargoID cargo_type; |
0 | 49 |
byte num_wagons; |
50 |
byte build_kind; |
|
51 |
byte num_build_rec; |
|
52 |
byte num_loco_to_build; |
|
53 |
byte num_want_fullload; |
|
54 |
||
55 |
byte route_type_mask; |
|
56 |
||
57 |
TileIndex start_tile_a; |
|
58 |
TileIndex cur_tile_a; |
|
7813
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
59 |
DiagDirectionByte cur_dir_a; |
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
60 |
DiagDirectionByte start_dir_a; |
145 | 61 |
|
0 | 62 |
TileIndex start_tile_b; |
63 |
TileIndex cur_tile_b; |
|
7813
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
64 |
DiagDirectionByte cur_dir_b; |
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
65 |
DiagDirectionByte start_dir_b; |
0 | 66 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
67 |
Vehicle *cur_veh; ///< only used by some states |
145 | 68 |
|
0 | 69 |
AiBuildRec src, dst, mid1, mid2; |
145 | 70 |
|
0 | 71 |
VehicleID wagon_list[9]; |
72 |
byte order_list_blocks[20]; |
|
145 | 73 |
|
0 | 74 |
TileIndex banned_tiles[16]; |
75 |
byte banned_val[16]; |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
76 |
}; |
0 | 77 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
78 |
struct Ai_PathFinderInfo { |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
79 |
TileIndex start_tile_tl; ///< tl = top-left |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
80 |
TileIndex start_tile_br; ///< br = bottom-right |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
81 |
TileIndex end_tile_tl; ///< tl = top-left |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
82 |
TileIndex end_tile_br; ///< br = bottom-right |
7813
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
83 |
DiagDirection start_direction; ///< 0 to 3 or AI_PATHFINDER_NO_DIRECTION |
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
84 |
DiagDirection end_direction; ///< 0 to 3 or AI_PATHFINDER_NO_DIRECTION |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
85 |
|
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
86 |
TileIndex route[500]; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
87 |
byte route_extra[500]; ///< Some extra information about the route like bridge/tunnel |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
88 |
int route_length; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
89 |
int position; ///< Current position in the build-path, needed to build the path |
145 | 90 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
91 |
bool rail_or_road; ///< true = rail, false = road |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
92 |
}; |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
93 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
94 |
/* The amount of memory reserved for the AI-special-vehicles */ |
145 | 95 |
#define AI_MAX_SPECIAL_VEHICLES 100 |
96 |
||
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
97 |
struct Ai_SpecialVehicle { |
145 | 98 |
VehicleID veh_id; |
99 |
uint32 flag; |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
100 |
}; |
145 | 101 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
102 |
struct PlayerAiNew { |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
103 |
uint8 state; |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
104 |
uint tick; |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
105 |
uint idle; |
145 | 106 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
107 |
int temp; ///< A value used in more than one function, but it just temporary |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
108 |
///< The use is pretty simple: with this we can 'think' about stuff |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
109 |
///< in more than one tick, and more than one AI. A static will not |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
110 |
///< do, because they are not saved. This way, the AI is almost human ;) |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
111 |
int counter; ///< For the same reason as temp, we have counter. It can count how |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
112 |
///< long we are trying something, and just abort if it takes too long |
145 | 113 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
114 |
/* Pathfinder stuff */ |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
115 |
Ai_PathFinderInfo path_info; |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
116 |
AyStar *pathfinder; |
145 | 117 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
118 |
/* Route stuff */ |
145 | 119 |
|
3344
d86c852715fa
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents:
2952
diff
changeset
|
120 |
CargoID cargo; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
121 |
byte tbt; ///< train/bus/truck 0/1/2 AI_TRAIN/AI_BUS/AI_TRUCK |
7486
d130c10f4dab
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
7451
diff
changeset
|
122 |
Money new_cost; |
145 | 123 |
|
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
124 |
byte action; |
145 | 125 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
126 |
int last_id; ///< here is stored the last id of the searched city/industry |
4289
ff1b2b915cab
(svn r5919) -Cleanup: use the type Date when the variable really is a date
rubidium
parents:
4077
diff
changeset
|
127 |
Date last_vehiclecheck_date; // Used in CheckVehicle |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
128 |
Ai_SpecialVehicle special_vehicles[AI_MAX_SPECIAL_VEHICLES]; ///< Some vehicles have some special flags |
145 | 129 |
|
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
130 |
TileIndex from_tile; |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
131 |
TileIndex to_tile; |
145 | 132 |
|
7813
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
133 |
DiagDirectionByte from_direction; |
49fbe41f8a04
(svn r10672) -Codechange: typify some parameters/variables.
rubidium
parents:
7486
diff
changeset
|
134 |
DiagDirectionByte to_direction; |
145 | 135 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
136 |
bool from_deliver; ///< True if this is the station that GIVES cargo |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
137 |
bool to_deliver; |
145 | 138 |
|
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
139 |
TileIndex depot_tile; |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
140 |
DiagDirectionByte depot_direction; |
145 | 141 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
142 |
byte amount_veh; ///< How many vehicles we are going to build in this route |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
143 |
byte cur_veh; ///< How many vehicles did we bought? |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
144 |
VehicleID veh_id; ///< Used when bought a vehicle |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
145 |
VehicleID veh_main_id; ///< The ID of the first vehicle, for shared copy |
145 | 146 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
147 |
int from_ic; ///< ic = industry/city. This is the ID of them |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
148 |
byte from_type; ///< AI_NO_TYPE/AI_CITY/AI_INDUSTRY |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
149 |
int to_ic; |
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
150 |
byte to_type; |
145 | 151 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
152 |
}; |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
153 |
|
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
154 |
|
7405
480f118e5551
(svn r10158) -Codechange: port some changes from NoAI and FS#872 to make the loan commands a little better readable.
rubidium
parents:
7181
diff
changeset
|
155 |
/* The "steps" in loan size, in British Pounds! */ |
480f118e5551
(svn r10158) -Codechange: port some changes from NoAI and FS#872 to make the loan commands a little better readable.
rubidium
parents:
7181
diff
changeset
|
156 |
enum { |
480f118e5551
(svn r10158) -Codechange: port some changes from NoAI and FS#872 to make the loan commands a little better readable.
rubidium
parents:
7181
diff
changeset
|
157 |
LOAN_INTERVAL = 10000, |
480f118e5551
(svn r10158) -Codechange: port some changes from NoAI and FS#872 to make the loan commands a little better readable.
rubidium
parents:
7181
diff
changeset
|
158 |
LOAN_INTERVAL_OLD_AI = 50000, |
480f118e5551
(svn r10158) -Codechange: port some changes from NoAI and FS#872 to make the loan commands a little better readable.
rubidium
parents:
7181
diff
changeset
|
159 |
}; |
480f118e5551
(svn r10158) -Codechange: port some changes from NoAI and FS#872 to make the loan commands a little better readable.
rubidium
parents:
7181
diff
changeset
|
160 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
161 |
struct Player { |
0 | 162 |
uint32 name_2; |
163 |
uint16 name_1; |
|
164 |
||
165 |
uint16 president_name_1; |
|
166 |
uint32 president_name_2; |
|
167 |
||
6516
ee6d057b9850
(svn r8969) -Codechange: rework of the player face bits.
rubidium
parents:
6001
diff
changeset
|
168 |
PlayerFace face; |
0 | 169 |
|
7451
82101e591f90
(svn r10210) -Codechange: make all money related variables 64 bits, so overflowing them should become a little harder.
rubidium
parents:
7449
diff
changeset
|
170 |
Money player_money; |
7449
5cedaf2c861c
(svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents:
7448
diff
changeset
|
171 |
Money current_loan; |
0 | 172 |
|
173 |
byte player_color; |
|
4603
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
174 |
Livery livery[LS_END]; |
0 | 175 |
byte player_money_fraction; |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
176 |
byte avail_railtypes; |
7181
f966d75af3a6
(svn r9917) -Codechange: prepare some more areas for more road types.
rubidium
parents:
7139
diff
changeset
|
177 |
byte avail_roadtypes; |
0 | 178 |
byte block_preview; |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
179 |
PlayerByte index; |
0 | 180 |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
181 |
uint16 cargo_types; ///< which cargo types were transported the last year |
0 | 182 |
|
183 |
TileIndex location_of_house; |
|
184 |
TileIndex last_build_coordinate; |
|
145 | 185 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
186 |
PlayerByte share_owners[4]; |
145 | 187 |
|
4326
c2ae4dbc1074
(svn r5999) -Feature: change the original date format to a 32 bits format based at the year 0.
rubidium
parents:
4289
diff
changeset
|
188 |
Year inaugurated_year; |
0 | 189 |
byte num_valid_stat_ent; |
145 | 190 |
|
0 | 191 |
byte quarters_of_bankrupcy; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
192 |
byte bankrupt_asked; ///< which players were asked about buying it? |
0 | 193 |
int16 bankrupt_timeout; |
7449
5cedaf2c861c
(svn r10208) -Codechange: replace int32 with Money where appropriate.
rubidium
parents:
7448
diff
changeset
|
194 |
Money bankrupt_value; |
0 | 195 |
|
196 |
bool is_active; |
|
3345
40dc834caa24
(svn r4129) - CodeChange: Add proper bool type for is_ai as well...it is a bool type.
Darkvater
parents:
3344
diff
changeset
|
197 |
bool is_ai; |
0 | 198 |
PlayerAI ai; |
84
1e0721c29bad
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents:
0
diff
changeset
|
199 |
PlayerAiNew ainew; |
145 | 200 |
|
7451
82101e591f90
(svn r10210) -Codechange: make all money related variables 64 bits, so overflowing them should become a little harder.
rubidium
parents:
7449
diff
changeset
|
201 |
Money yearly_expenses[3][13]; |
0 | 202 |
PlayerEconomyEntry cur_economy; |
203 |
PlayerEconomyEntry old_economy[24]; |
|
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
204 |
EngineRenewList engine_renew_list; ///< Defined later |
2293
a71c210076be
(svn r2817) -Codechange: [autoreplace]: moved autoreplace and autorenew to serverside
bjarni
parents:
2186
diff
changeset
|
205 |
bool engine_renew; |
2617
a9e1a187de99
(svn r3155) -Feature: [autoreplace] autoreplace can now remove cars from too long trains
bjarni
parents:
2613
diff
changeset
|
206 |
bool renew_keep_length; |
2293
a71c210076be
(svn r2817) -Codechange: [autoreplace]: moved autoreplace and autorenew to serverside
bjarni
parents:
2186
diff
changeset
|
207 |
int16 engine_renew_months; |
a71c210076be
(svn r2817) -Codechange: [autoreplace]: moved autoreplace and autorenew to serverside
bjarni
parents:
2186
diff
changeset
|
208 |
uint32 engine_renew_money; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
209 |
uint16 num_engines[TOTAL_NUM_ENGINES]; ///< caches the number of engines of each type the player owns (no need to save this) |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
210 |
}; |
0 | 211 |
|
4428
0b0ee542d5b6
(svn r6183) Move GetDrawStringPlayerColor() out of gfx.[ch]
tron
parents:
4344
diff
changeset
|
212 |
uint16 GetDrawStringPlayerColor(PlayerID player); |
0b0ee542d5b6
(svn r6183) Move GetDrawStringPlayerColor() out of gfx.[ch]
tron
parents:
4344
diff
changeset
|
213 |
|
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2425
diff
changeset
|
214 |
void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player); |
4849
9a3c3ae7f62f
(svn r6775) -Codechange: Use some more proper types, especially Owner and PlayerID as
Darkvater
parents:
4848
diff
changeset
|
215 |
void GetNameOfOwner(Owner owner, TileIndex tile); |
7814
fe643468ad64
(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents:
7813
diff
changeset
|
216 |
Money CalculateCompanyValue(const Player *p); |
fe643468ad64
(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents:
7813
diff
changeset
|
217 |
void InvalidatePlayerWindows(const Player *p); |
5564
6e1b3ea1ba7f
(svn r7561) -Fix (FS#431): core and (patches) GUI were not in-sync with respect to autorenew settings. This is only a temporary fix, as the definite fix needs to move the autorenew settings to a per-company settings window.
rubidium
parents:
5216
diff
changeset
|
218 |
void SetLocalPlayer(PlayerID new_player); |
2952 | 219 |
#define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++) |
0 | 220 |
|
8004
f7619f7bff22
(svn r11023) -Fix [FS#1150]: Switching players (using the cheat) crashed on Big Endian machines.
rubidium
parents:
7814
diff
changeset
|
221 |
VARDEF PlayerByte _local_player; |
f7619f7bff22
(svn r11023) -Fix [FS#1150]: Switching players (using the cheat) crashed on Big Endian machines.
rubidium
parents:
7814
diff
changeset
|
222 |
VARDEF PlayerByte _current_player; |
2154
63a6b880b4c0
(svn r2664) Remove depedency on player.h from variables.h
tron
parents:
2147
diff
changeset
|
223 |
|
0 | 224 |
VARDEF Player _players[MAX_PLAYERS]; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
225 |
/* NOSAVE: can be determined from player structs */ |
2154
63a6b880b4c0
(svn r2664) Remove depedency on player.h from variables.h
tron
parents:
2147
diff
changeset
|
226 |
VARDEF byte _player_colors[MAX_PLAYERS]; |
0 | 227 |
|
6573 | 228 |
static inline byte ActivePlayerCount() |
4824
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
229 |
{ |
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
230 |
const Player *p; |
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
231 |
byte count = 0; |
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
232 |
|
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
233 |
FOR_ALL_PLAYERS(p) { |
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
234 |
if (p->is_active) count++; |
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
235 |
} |
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
236 |
|
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
237 |
return count; |
ddbd525a04d0
(svn r6748) -Codechange: Use already existing function to count active players.
Darkvater
parents:
4603
diff
changeset
|
238 |
} |
2944
7c392e7b51c6
(svn r3500) - Workaround the inaccurate count of spectators/companies that can happen in certain border-cases. For now just dynamically get this value when requested so it is always right. To do properly all player/client creation/destruction needs a hook for networking.
Darkvater
parents:
2848
diff
changeset
|
239 |
|
7814
fe643468ad64
(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents:
7813
diff
changeset
|
240 |
static inline Player *GetPlayer(PlayerID i) |
1767
394867897b0a
(svn r2271) CMD_SET_PLAYER_FACE, CMD_SET_PLAYER_COLOR, CMD_INCREASE_LOAN, CMD_DECREASE_LOAN only make sense for the current player, so don't explicitly pass a player number
tron
parents:
1576
diff
changeset
|
241 |
{ |
8450
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8424
diff
changeset
|
242 |
assert(IsInsideBS(i, PLAYER_FIRST, lengthof(_players))); |
2425
99e1e8430a28
(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
Darkvater
parents:
2293
diff
changeset
|
243 |
return &_players[i]; |
99e1e8430a28
(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
Darkvater
parents:
2293
diff
changeset
|
244 |
} |
99e1e8430a28
(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
Darkvater
parents:
2293
diff
changeset
|
245 |
|
6573 | 246 |
static inline bool IsLocalPlayer() |
2425
99e1e8430a28
(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
Darkvater
parents:
2293
diff
changeset
|
247 |
{ |
99e1e8430a28
(svn r2951) - Fix: [ 1259345 ] Changing engine in netgame opens train window for everyone
Darkvater
parents:
2293
diff
changeset
|
248 |
return _local_player == _current_player; |
1767
394867897b0a
(svn r2271) CMD_SET_PLAYER_FACE, CMD_SET_PLAYER_COLOR, CMD_INCREASE_LOAN, CMD_DECREASE_LOAN only make sense for the current player, so don't explicitly pass a player number
tron
parents:
1576
diff
changeset
|
249 |
} |
394867897b0a
(svn r2271) CMD_SET_PLAYER_FACE, CMD_SET_PLAYER_COLOR, CMD_INCREASE_LOAN, CMD_DECREASE_LOAN only make sense for the current player, so don't explicitly pass a player number
tron
parents:
1576
diff
changeset
|
250 |
|
4850
b4e9be22945f
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4849
diff
changeset
|
251 |
static inline bool IsValidPlayer(PlayerID pi) |
b4e9be22945f
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4849
diff
changeset
|
252 |
{ |
8450
dce58137301f
(svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style
skidd13
parents:
8424
diff
changeset
|
253 |
return IsInsideBS(pi, PLAYER_FIRST, MAX_PLAYERS); |
4850
b4e9be22945f
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4849
diff
changeset
|
254 |
} |
b4e9be22945f
(svn r6776) -Codechange: Use IsValidPlayer() function to determine of a PlayerID is an
Darkvater
parents:
4849
diff
changeset
|
255 |
|
2544 | 256 |
byte GetPlayerRailtypes(PlayerID p); |
7181
f966d75af3a6
(svn r9917) -Codechange: prepare some more areas for more road types.
rubidium
parents:
7139
diff
changeset
|
257 |
byte GetPlayerRoadtypes(PlayerID p); |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
258 |
|
8353
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
259 |
/** Finds out if a Player has a certain railtype available |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
260 |
* @param p Player in question |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
261 |
* @param Railtype requested RailType |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
262 |
* @return true if player has requested RailType available |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
263 |
*/ |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
264 |
static inline bool HasRailtypeAvail(const Player *p, const RailType Railtype) |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
265 |
{ |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8353
diff
changeset
|
266 |
return HasBit(p->avail_railtypes, Railtype); |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
267 |
} |
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
268 |
|
8353
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
269 |
/** Finds out, whether given player has all given RoadTypes available |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
270 |
* @param PlayerID ID of player |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
271 |
* @param rts RoadTypes to test |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
272 |
* @return true if player has all requested RoadTypes available |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
273 |
*/ |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
274 |
static inline bool HasRoadTypesAvail(const PlayerID p, const RoadTypes rts) |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
275 |
{ |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
276 |
RoadTypes avail_roadtypes; |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
277 |
|
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
278 |
if (p == OWNER_TOWN || _game_mode == GM_EDITOR || IsGeneratingWorld()) { |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
279 |
avail_roadtypes = ROADTYPES_ROAD; |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
280 |
} else { |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
281 |
if (!IsValidPlayer(p)) return false; |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
282 |
avail_roadtypes = (RoadTypes)GetPlayer(p)->avail_roadtypes | ROADTYPES_ROAD; // road is available for always for everybody |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
283 |
} |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
284 |
return (rts & ~avail_roadtypes) == 0; |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
285 |
} |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
286 |
|
4845
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
287 |
static inline bool IsHumanPlayer(PlayerID pi) |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
288 |
{ |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
289 |
return !GetPlayer(pi)->is_ai; |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
290 |
} |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
291 |
|
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
292 |
static inline bool IsInteractivePlayer(PlayerID pi) |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
293 |
{ |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
294 |
return pi == _local_player; |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
295 |
} |
49105d3b5a9a
(svn r6771) -Codechange: Replace two macros with functions. IS_HUMAN_PLAYER and
Darkvater
parents:
4824
diff
changeset
|
296 |
|
6001
1e4c5406cd1a
(svn r8300) -Codechange: Add a prototype for DrawPlayerIcon to players.h and include that
maedhros
parents:
5980
diff
changeset
|
297 |
void DrawPlayerIcon(PlayerID p, int x, int y); |
1e4c5406cd1a
(svn r8300) -Codechange: Add a prototype for DrawPlayerIcon to players.h and include that
maedhros
parents:
5980
diff
changeset
|
298 |
|
2154
63a6b880b4c0
(svn r2664) Remove depedency on player.h from variables.h
tron
parents:
2147
diff
changeset
|
299 |
/* Validate functions for rail building */ |
8424
4a488a90ccab
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
8353
diff
changeset
|
300 |
static inline bool ValParamRailtype(const uint32 rail) { return HasBit(GetPlayer(_current_player)->avail_railtypes, rail);} |
8353
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
301 |
|
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
302 |
/* Validate functions for road building */ |
49a1d9b9d937
(svn r11407) -Fix: do not allow building of tram-tracks when they are not available (SmatZ)
truelight
parents:
8230
diff
changeset
|
303 |
static inline bool ValParamRoadType(const RoadType rt) { return HasRoadTypesAvail(_current_player, RoadTypeToRoadTypes(rt));} |
2154
63a6b880b4c0
(svn r2664) Remove depedency on player.h from variables.h
tron
parents:
2147
diff
changeset
|
304 |
|
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
305 |
/** Returns the "best" railtype a player can build. |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3355
diff
changeset
|
306 |
* As the AI doesn't know what the BEST one is, we have our own priority list |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3355
diff
changeset
|
307 |
* here. When adding new railtypes, modify this function |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3355
diff
changeset
|
308 |
* @param p the player "in action" |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3355
diff
changeset
|
309 |
* @return The "best" railtype a player has available |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3355
diff
changeset
|
310 |
*/ |
7814
fe643468ad64
(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents:
7813
diff
changeset
|
311 |
static inline RailType GetBestRailtype(const Player *p) |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
312 |
{ |
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
313 |
if (HasRailtypeAvail(p, RAILTYPE_MAGLEV)) return RAILTYPE_MAGLEV; |
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
314 |
if (HasRailtypeAvail(p, RAILTYPE_MONO)) return RAILTYPE_MONO; |
3355
a653b8e47f27
(svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
celestar
parents:
3345
diff
changeset
|
315 |
if (HasRailtypeAvail(p, RAILTYPE_ELECTRIC)) return RAILTYPE_ELECTRIC; |
2147
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
316 |
return RAILTYPE_RAIL; |
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
317 |
} |
42efdf5020d1
(svn r2657) -Codechange: The available railtypes per player are now a bitmask, so
celestar
parents:
1977
diff
changeset
|
318 |
|
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
319 |
struct HighScore { |
983
1be852dcdd4c
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
826
diff
changeset
|
320 |
char company[100]; |
6678
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
321 |
StringID title; ///< NO_SAVE, has troubles with changing string-numbers. |
6353b8865d42
(svn r9391) -Documentation : correct Doxygen of comments and @file inclusion. Time for P and Q files
belugas
parents:
6574
diff
changeset
|
322 |
uint16 score; ///< do NOT change type, will break hs.dat |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
323 |
}; |
983
1be852dcdd4c
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
826
diff
changeset
|
324 |
|
998
d9dc257b8949
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
990
diff
changeset
|
325 |
VARDEF HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5 |
6573 | 326 |
void SaveToHighScore(); |
327 |
void LoadFromHighScore(); |
|
998
d9dc257b8949
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
990
diff
changeset
|
328 |
int8 SaveHighScoreValue(const Player *p); |
6573 | 329 |
int8 SaveHighScoreValueNetwork(); |
983
1be852dcdd4c
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
826
diff
changeset
|
330 |
|
2848 | 331 |
/* Engine Replacement Functions */ |
332 |
||
333 |
/** |
|
334 |
* Remove all engine replacement settings for the given player. |
|
335 |
* @param p Player. |
|
336 |
*/ |
|
337 |
static inline void RemoveAllEngineReplacementForPlayer(Player *p) { RemoveAllEngineReplacement(&p->engine_renew_list); } |
|
338 |
||
339 |
/** |
|
340 |
* Retrieve the engine replacement for the given player and original engine type. |
|
341 |
* @param p Player. |
|
342 |
* @param engine Engine type. |
|
343 |
* @return The engine type to replace with, or INVALID_ENGINE if no |
|
344 |
* replacement is in the list. |
|
345 |
*/ |
|
7139
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6678
diff
changeset
|
346 |
static inline EngineID EngineReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacement(p->engine_renew_list, engine, group); } |
2848 | 347 |
|
348 |
/** |
|
349 |
* Check if a player has a replacement set up for the given engine. |
|
350 |
* @param p Player. |
|
351 |
* @param engine Engine type to be replaced. |
|
352 |
* @return true if a replacement was set up, false otherwise. |
|
353 |
*/ |
|
7139
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6678
diff
changeset
|
354 |
static inline bool EngineHasReplacementForPlayer(const Player *p, EngineID engine, GroupID group) { return EngineReplacementForPlayer(p, engine, group) != INVALID_ENGINE; } |
2848 | 355 |
|
356 |
/** |
|
357 |
* Add an engine replacement for the player. |
|
358 |
* @param p Player. |
|
359 |
* @param old_engine The original engine type. |
|
360 |
* @param new_engine The replacement engine type. |
|
361 |
* @param flags The calling command flags. |
|
362 |
* @return 0 on success, CMD_ERROR on failure. |
|
363 |
*/ |
|
7439
0c0e2945c890
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
7405
diff
changeset
|
364 |
static inline CommandCost AddEngineReplacementForPlayer(Player *p, EngineID old_engine, EngineID new_engine, GroupID group, uint32 flags) { return AddEngineReplacement(&p->engine_renew_list, old_engine, new_engine, group, flags); } |
2848 | 365 |
|
366 |
/** |
|
367 |
* Remove an engine replacement for the player. |
|
368 |
* @param p Player. |
|
369 |
* @param engine The original engine type. |
|
370 |
* @param flags The calling command flags. |
|
371 |
* @return 0 on success, CMD_ERROR on failure. |
|
372 |
*/ |
|
7439
0c0e2945c890
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
7405
diff
changeset
|
373 |
static inline CommandCost RemoveEngineReplacementForPlayer(Player *p, EngineID engine, GroupID group, uint32 flags) {return RemoveEngineReplacement(&p->engine_renew_list, engine, group, flags); } |
2697
c7b1a950c4cf
(svn r3239) - Codechange: Introduce and use helper functions for engine replacement code.
peter1138
parents:
2617
diff
changeset
|
374 |
|
4603
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
375 |
/** |
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
376 |
* Reset the livery schemes to the player's primary colour. |
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
377 |
* This is used on loading games without livery information and on new player start up. |
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
378 |
* @param p Player to reset. |
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
379 |
*/ |
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
380 |
void ResetPlayerLivery(Player *p); |
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
381 |
|
0 | 382 |
#endif /* PLAYER_H */ |