2004-08-09 17:04:08 +00:00
|
|
|
#ifndef TOWN_H
|
|
|
|
#define TOWN_H
|
|
|
|
|
|
|
|
#include "player.h"
|
|
|
|
|
|
|
|
struct Town {
|
|
|
|
TileIndex xy;
|
|
|
|
|
|
|
|
// Current population of people and amount of houses.
|
|
|
|
uint16 num_houses;
|
|
|
|
uint32 population;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
// Town name
|
|
|
|
uint16 townnametype;
|
|
|
|
uint32 townnameparts;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
|
|
|
// NOSAVE: Location of name sign, UpdateTownVirtCoord updates this.
|
2004-08-09 17:04:08 +00:00
|
|
|
ViewportSign sign;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
// Makes sure we don't build certain house types twice.
|
|
|
|
byte flags12;
|
|
|
|
|
|
|
|
// Which players have a statue?
|
|
|
|
byte statues;
|
|
|
|
|
|
|
|
// Sort index in listings
|
|
|
|
byte sort_index_obsolete;
|
|
|
|
|
|
|
|
// Player ratings as well as a mask that determines which players have a rating.
|
|
|
|
byte have_ratings;
|
|
|
|
uint8 unwanted[MAX_PLAYERS]; // how many months companies aren't wanted by towns (bribe)
|
2004-08-23 21:04:39 +00:00
|
|
|
uint8 exclusivity; // which player has exslusivity
|
|
|
|
uint8 exclusive_counter; // months till the exclusivity expires
|
2004-08-09 17:04:08 +00:00
|
|
|
int16 ratings[MAX_PLAYERS];
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
// Maximum amount of passengers and mail that can be transported.
|
|
|
|
uint16 max_pass;
|
|
|
|
uint16 max_mail;
|
|
|
|
uint16 new_max_pass;
|
|
|
|
uint16 new_max_mail;
|
|
|
|
uint16 act_pass;
|
|
|
|
uint16 act_mail;
|
|
|
|
uint16 new_act_pass;
|
|
|
|
uint16 new_act_mail;
|
|
|
|
|
|
|
|
// Amount of passengers that were transported.
|
|
|
|
byte pct_pass_transported;
|
|
|
|
byte pct_mail_transported;
|
|
|
|
|
|
|
|
// Amount of food and paper that was transported. Actually a bit mask would be enough.
|
|
|
|
uint16 act_food;
|
2004-08-10 14:42:52 +00:00
|
|
|
uint16 act_water;
|
2004-08-09 17:04:08 +00:00
|
|
|
uint16 new_act_food;
|
2004-08-10 14:42:52 +00:00
|
|
|
uint16 new_act_water;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
// Time until we rebuild a house.
|
|
|
|
byte time_until_rebuild;
|
|
|
|
|
|
|
|
// When to grow town next time.
|
|
|
|
byte grow_counter;
|
2004-09-10 19:02:27 +00:00
|
|
|
byte growth_rate;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
// Fund buildings program in action?
|
|
|
|
byte fund_buildings_months;
|
2004-09-10 19:02:27 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
// Fund road reconstruction in action?
|
|
|
|
byte road_build_months;
|
|
|
|
|
|
|
|
// Index in town array
|
2004-12-28 17:40:15 +00:00
|
|
|
uint16 index;
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
// NOSAVE: UpdateTownRadius updates this given the house count.
|
|
|
|
uint16 radius[5];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-12-31 18:57:24 +00:00
|
|
|
void UpdateTownVirtCoord(Town *t);
|
2004-08-09 17:04:08 +00:00
|
|
|
void InitializeTown();
|
|
|
|
void ShowTownViewWindow(uint town);
|
|
|
|
void DeleteTown(Town *t);
|
|
|
|
void ExpandTown(Town *t);
|
|
|
|
bool GrowTown(Town *t);
|
|
|
|
Town *CreateRandomTown();
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ROAD_REMOVE = 0,
|
|
|
|
UNMOVEABLE_REMOVE = 1,
|
|
|
|
TUNNELBRIDGE_REMOVE = 1,
|
|
|
|
INDUSTRY_REMOVE = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type);
|
|
|
|
|
|
|
|
VARDEF Town _towns[70];
|
2005-01-06 22:31:58 +00:00
|
|
|
VARDEF uint _towns_size;
|
|
|
|
|
|
|
|
VARDEF uint16 *_town_sort;
|
|
|
|
|
|
|
|
static inline Town *GetTown(uint index)
|
|
|
|
{
|
|
|
|
assert(index < _towns_size);
|
|
|
|
return &_towns[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
#define FOR_ALL_TOWNS(t) for(t = _towns; t != &_towns[_towns_size]; t++)
|
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
VARDEF int _total_towns; // For the AI: the amount of towns active
|
|
|
|
|
|
|
|
VARDEF bool _town_sort_dirty;
|
|
|
|
VARDEF byte _town_sort_order;
|
|
|
|
|
|
|
|
VARDEF Town *_cleared_town;
|
|
|
|
VARDEF int _cleared_town_rating;
|
|
|
|
|
|
|
|
#endif /* TOWN_H */
|