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;
|
|
12 |
|
|
13 |
// Town name
|
|
14 |
uint16 townnametype;
|
|
15 |
uint32 townnameparts;
|
|
16 |
|
|
17 |
// NOSAVE: Location of name sign, UpdateTownVirtCoord updates this.
|
|
18 |
ViewportSign sign;
|
|
19 |
|
|
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)
|
|
32 |
int16 ratings[MAX_PLAYERS];
|
|
33 |
|
|
34 |
// Maximum amount of passengers and mail that can be transported.
|
|
35 |
uint16 max_pass;
|
|
36 |
uint16 max_mail;
|
|
37 |
uint16 new_max_pass;
|
|
38 |
uint16 new_max_mail;
|
|
39 |
uint16 act_pass;
|
|
40 |
uint16 act_mail;
|
|
41 |
uint16 new_act_pass;
|
|
42 |
uint16 new_act_mail;
|
|
43 |
|
|
44 |
// Amount of passengers that were transported.
|
|
45 |
byte pct_pass_transported;
|
|
46 |
byte pct_mail_transported;
|
|
47 |
|
|
48 |
// Amount of food and paper that was transported. Actually a bit mask would be enough.
|
|
49 |
uint16 act_food;
|
|
50 |
uint16 act_paper;
|
|
51 |
uint16 new_act_food;
|
|
52 |
uint16 new_act_paper;
|
|
53 |
|
|
54 |
// Time until we rebuild a house.
|
|
55 |
byte time_until_rebuild;
|
|
56 |
|
|
57 |
// When to grow town next time.
|
|
58 |
byte grow_counter;
|
|
59 |
byte growth_rate;
|
|
60 |
|
|
61 |
// Fund buildings program in action?
|
|
62 |
byte fund_buildings_months;
|
|
63 |
|
|
64 |
// Fund road reconstruction in action?
|
|
65 |
byte road_build_months;
|
|
66 |
|
|
67 |
// Index in town array
|
|
68 |
byte index;
|
|
69 |
|
|
70 |
// NOSAVE: UpdateTownRadius updates this given the house count.
|
|
71 |
uint16 radius[5];
|
|
72 |
};
|
|
73 |
|
|
74 |
|
|
75 |
void InitializeTown();
|
|
76 |
void ShowTownViewWindow(uint town);
|
|
77 |
void DeleteTown(Town *t);
|
|
78 |
void ExpandTown(Town *t);
|
|
79 |
bool GrowTown(Town *t);
|
|
80 |
Town *CreateRandomTown();
|
|
81 |
|
|
82 |
enum {
|
|
83 |
ROAD_REMOVE = 0,
|
|
84 |
UNMOVEABLE_REMOVE = 1,
|
|
85 |
TUNNELBRIDGE_REMOVE = 1,
|
|
86 |
INDUSTRY_REMOVE = 2
|
|
87 |
};
|
|
88 |
|
|
89 |
bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type);
|
|
90 |
|
|
91 |
#define DEREF_TOWN(i) (&_towns[i])
|
|
92 |
#define FOR_ALL_TOWNS(c) for(c=_towns; c != endof(_towns); c++)
|
|
93 |
|
|
94 |
VARDEF Town _towns[70];
|
|
95 |
VARDEF int _total_towns; // For the AI: the amount of towns active
|
|
96 |
|
|
97 |
VARDEF bool _town_sort_dirty;
|
|
98 |
VARDEF byte _town_sort_order;
|
|
99 |
|
|
100 |
VARDEF Town *_cleared_town;
|
|
101 |
VARDEF int _cleared_town_rating;
|
|
102 |
|
|
103 |
#endif /* TOWN_H */
|