author | bjarni |
Sat, 22 Jan 2005 23:55:45 +0000 | |
changeset 1099 | ad7522bd5c1c |
parent 1093 | 4fdc46eaf423 |
child 1220 | 8b951444b021 |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef TOWN_H |
2 |
#define TOWN_H |
|
3 |
||
4 |
#include "player.h" |
|
5 |
||
6 |
struct Town { |
|
7 |
TileIndex xy; |
|
8 |
||
9 |
// Current population of people and amount of houses. |
|
10 |
uint16 num_houses; |
|
11 |
uint32 population; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
12 |
|
0 | 13 |
// Town name |
14 |
uint16 townnametype; |
|
15 |
uint32 townnameparts; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
16 |
|
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
17 |
// NOSAVE: Location of name sign, UpdateTownVirtCoord updates this. |
0 | 18 |
ViewportSign sign; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
19 |
|
0 | 20 |
// Makes sure we don't build certain house types twice. |
21 |
byte flags12; |
|
22 |
||
23 |
// Which players have a statue? |
|
24 |
byte statues; |
|
25 |
||
26 |
// Sort index in listings |
|
27 |
byte sort_index_obsolete; |
|
28 |
||
29 |
// Player ratings as well as a mask that determines which players have a rating. |
|
30 |
byte have_ratings; |
|
31 |
uint8 unwanted[MAX_PLAYERS]; // how many months companies aren't wanted by towns (bribe) |
|
121
c2f18f4d8be1
(svn r122) Change: exclusive transport rights are now stored per town instead of per station
dominik
parents:
4
diff
changeset
|
32 |
uint8 exclusivity; // which player has exslusivity |
c2f18f4d8be1
(svn r122) Change: exclusive transport rights are now stored per town instead of per station
dominik
parents:
4
diff
changeset
|
33 |
uint8 exclusive_counter; // months till the exclusivity expires |
0 | 34 |
int16 ratings[MAX_PLAYERS]; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
35 |
|
0 | 36 |
// Maximum amount of passengers and mail that can be transported. |
37 |
uint16 max_pass; |
|
38 |
uint16 max_mail; |
|
39 |
uint16 new_max_pass; |
|
40 |
uint16 new_max_mail; |
|
41 |
uint16 act_pass; |
|
42 |
uint16 act_mail; |
|
43 |
uint16 new_act_pass; |
|
44 |
uint16 new_act_mail; |
|
45 |
||
46 |
// Amount of passengers that were transported. |
|
47 |
byte pct_pass_transported; |
|
48 |
byte pct_mail_transported; |
|
49 |
||
50 |
// Amount of food and paper that was transported. Actually a bit mask would be enough. |
|
51 |
uint16 act_food; |
|
4
cad62d5f9708
(svn r5) -Fix: townname generation of TTDLX savegames. All work
darkvater
parents:
0
diff
changeset
|
52 |
uint16 act_water; |
0 | 53 |
uint16 new_act_food; |
4
cad62d5f9708
(svn r5) -Fix: townname generation of TTDLX savegames. All work
darkvater
parents:
0
diff
changeset
|
54 |
uint16 new_act_water; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
55 |
|
0 | 56 |
// Time until we rebuild a house. |
57 |
byte time_until_rebuild; |
|
58 |
||
59 |
// When to grow town next time. |
|
60 |
byte grow_counter; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
61 |
byte growth_rate; |
0 | 62 |
|
63 |
// Fund buildings program in action? |
|
64 |
byte fund_buildings_months; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
121
diff
changeset
|
65 |
|
0 | 66 |
// Fund road reconstruction in action? |
67 |
byte road_build_months; |
|
68 |
||
69 |
// Index in town array |
|
820
924f78b43e9e
(svn r1291) -Codechange: prepared subsidies and towns to become an uint16 (happens
truelight
parents:
193
diff
changeset
|
70 |
uint16 index; |
0 | 71 |
|
72 |
// NOSAVE: UpdateTownRadius updates this given the house count. |
|
73 |
uint16 radius[5]; |
|
74 |
}; |
|
75 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1080
diff
changeset
|
76 |
uint32 GetWorldPopulation(void); |
0 | 77 |
|
835
f6a341f541d7
(svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents:
820
diff
changeset
|
78 |
void UpdateTownVirtCoord(Town *t); |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1080
diff
changeset
|
79 |
void InitializeTown(void); |
0 | 80 |
void ShowTownViewWindow(uint town); |
81 |
void DeleteTown(Town *t); |
|
82 |
void ExpandTown(Town *t); |
|
83 |
bool GrowTown(Town *t); |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1080
diff
changeset
|
84 |
Town *CreateRandomTown(void); |
0 | 85 |
|
86 |
enum { |
|
87 |
ROAD_REMOVE = 0, |
|
88 |
UNMOVEABLE_REMOVE = 1, |
|
89 |
TUNNELBRIDGE_REMOVE = 1, |
|
90 |
INDUSTRY_REMOVE = 2 |
|
91 |
}; |
|
92 |
||
1005 | 93 |
enum { |
94 |
// These refer to the maximums, so Appalling is -1000 to -400 |
|
95 |
// MAXIMUM RATINGS BOUNDARIES |
|
96 |
RATING_MINIMUM = -1000, |
|
97 |
RATING_APPALLING = -400, |
|
98 |
RATING_VERYPOOR = -200, |
|
99 |
RATING_POOR = 0, |
|
100 |
RATING_MEDIOCRE = 200, |
|
101 |
RATING_GOOD = 400, |
|
102 |
RATING_VERYGOOD = 600, |
|
103 |
RATING_EXCELLENT = 800, |
|
104 |
RATING_OUTSTANDING= 1000, // OUTSTANDING |
|
105 |
||
106 |
RATING_MAXIMUM = RATING_OUTSTANDING, |
|
107 |
||
108 |
// RATINGS AFFECTING NUMBERS |
|
109 |
RATING_TREE_DOWN_STEP = -35, |
|
110 |
RATING_TREE_MINIMUM = RATING_MINIMUM, |
|
111 |
RATING_TREE_UP_STEP = 7, |
|
112 |
RATING_TREE_MAXIMUM = 220, |
|
113 |
||
114 |
RATING_TUNNEL_BRIDGE_DOWN_STEP = -250, |
|
115 |
RATING_TUNNEL_BRIDGE_MINIMUM = 0, |
|
116 |
||
117 |
RATING_INDUSTRY_DOWN_STEP = -1500, |
|
118 |
RATING_INDUSTRY_MINIMUM = RATING_MINIMUM, |
|
119 |
||
120 |
RATING_ROAD_DOWN_STEP = -50, |
|
121 |
RATING_ROAD_MINIMUM = -100, |
|
122 |
RATING_HOUSE_MINIMUM = RATING_MINIMUM, |
|
123 |
||
124 |
RATING_BRIBE_UP_STEP = 200, |
|
125 |
RATING_BRIBE_MAXIMUM = 800, |
|
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1005
diff
changeset
|
126 |
RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER? |
1005 | 127 |
}; |
128 |
||
0 | 129 |
bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type); |
130 |
||
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
131 |
VARDEF Town _towns[70]; |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
132 |
VARDEF uint _towns_size; |
0 | 133 |
|
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
134 |
VARDEF uint16 *_town_sort; |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
135 |
|
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
136 |
static inline Town *GetTown(uint index) |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
137 |
{ |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
138 |
assert(index < _towns_size); |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
139 |
return &_towns[index]; |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
140 |
} |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
141 |
|
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
142 |
#define FOR_ALL_TOWNS(t) for(t = _towns; t != &_towns[_towns_size]; t++) |
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
835
diff
changeset
|
143 |
|
0 | 144 |
VARDEF int _total_towns; // For the AI: the amount of towns active |
145 |
||
146 |
VARDEF bool _town_sort_dirty; |
|
147 |
VARDEF byte _town_sort_order; |
|
148 |
||
149 |
VARDEF Town *_cleared_town; |
|
150 |
VARDEF int _cleared_town_rating; |
|
151 |
||
152 |
#endif /* TOWN_H */ |