town.h
author tron
Tue, 12 Apr 2005 10:31:26 +0000
changeset 1685 46783dea9b44
parent 1377 7ab329d1fc28
child 1784 d0698aac0c2e
permissions -rw-r--r--
(svn r2189) Introduce and use IsCompatibleTrainStationTile()
This should prevent trains, which are longer than the station, to turn around without stopping under certain circumstances and fix speed limit for trains entering a station, when realistic accerlation is used
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     1
#ifndef TOWN_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     2
#define TOWN_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
1260
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
     4
#include "pool.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "player.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
struct Town {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
	TileIndex xy;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
	// Current population of people and amount of houses.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
	uint16 num_houses;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
	uint32 population;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    13
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
	// Town name
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
	uint16 townnametype;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
	uint32 townnameparts;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    17
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    18
	// NOSAVE: Location of name sign, UpdateTownVirtCoord updates this.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
	ViewportSign sign;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    20
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
	// Makes sure we don't build certain house types twice.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
	byte flags12;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
	// Which players have a statue?
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
	byte statues;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
	// Sort index in listings
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
	byte sort_index_obsolete;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
	// Player ratings as well as a mask that determines which players have a rating.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
	byte have_ratings;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
	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
    33
	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
    34
	uint8 exclusive_counter;     // months till the exclusivity expires
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
	int16 ratings[MAX_PLAYERS];
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    36
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
	// Maximum amount of passengers and mail that can be transported.
1377
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    38
	uint32 max_pass;
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    39
	uint32 max_mail;
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    40
	uint32 new_max_pass;
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    41
	uint32 new_max_mail;
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    42
	uint32 act_pass;
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    43
	uint32 act_mail;
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    44
	uint32 new_act_pass;
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1362
diff changeset
    45
	uint32 new_act_mail;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
	// Amount of passengers that were transported.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
	byte pct_pass_transported;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
	byte pct_mail_transported;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
	// Amount of food and paper that was transported. Actually a bit mask would be enough.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
	uint16 act_food;
4
cad62d5f9708 (svn r5) -Fix: townname generation of TTDLX savegames. All work
darkvater
parents: 0
diff changeset
    53
	uint16 act_water;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
	uint16 new_act_food;
4
cad62d5f9708 (svn r5) -Fix: townname generation of TTDLX savegames. All work
darkvater
parents: 0
diff changeset
    55
	uint16 new_act_water;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    56
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
	// Time until we rebuild a house.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
	byte time_until_rebuild;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
	// When to grow town next time.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
	byte grow_counter;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    62
	byte growth_rate;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
	// Fund buildings program in action?
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
	byte fund_buildings_months;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 121
diff changeset
    66
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
	// Fund road reconstruction in action?
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
	byte road_build_months;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
	// Index in town array
820
924f78b43e9e (svn r1291) -Codechange: prepared subsidies and towns to become an uint16 (happens
truelight
parents: 193
diff changeset
    71
	uint16 index;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    73
	// NOSAVE: UpdateTownRadius updates this given the house count.
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
	uint16 radius[5];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    75
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
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
    77
uint32 GetWorldPopulation(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
835
f6a341f541d7 (svn r1312) -Add: Patch which is on by default: population in label of the town
truelight
parents: 820
diff changeset
    79
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
    80
void InitializeTown(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
void ShowTownViewWindow(uint town);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
void DeleteTown(Town *t);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
void ExpandTown(Town *t);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
bool GrowTown(Town *t);
1362
bceb3c57353d (svn r1866) -Fix: Intercepted generated maps with 0 towns on it. Currently just an
celestar
parents: 1330
diff changeset
    85
Town *CreateRandomTown(uint attempts);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
	ROAD_REMOVE = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
	UNMOVEABLE_REMOVE = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    90
	TUNNELBRIDGE_REMOVE = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    91
	INDUSTRY_REMOVE = 2
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
1005
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
    94
enum {
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
    95
	// These refer to the maximums, so Appalling is -1000 to -400
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
    96
	// MAXIMUM RATINGS BOUNDARIES
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
    97
	RATING_MINIMUM 		= -1000,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
    98
	RATING_APPALLING 	= -400,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
    99
	RATING_VERYPOOR 	= -200,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   100
	RATING_POOR 			= 0,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   101
	RATING_MEDIOCRE		= 200,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   102
	RATING_GOOD				= 400,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   103
	RATING_VERYGOOD		= 600,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   104
	RATING_EXCELLENT	= 800,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   105
	RATING_OUTSTANDING= 1000, 	// OUTSTANDING
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   106
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   107
	RATING_MAXIMUM = RATING_OUTSTANDING,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   108
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   109
	// RATINGS AFFECTING NUMBERS
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   110
	RATING_TREE_DOWN_STEP = -35,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   111
	RATING_TREE_MINIMUM = RATING_MINIMUM,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   112
	RATING_TREE_UP_STEP = 7,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   113
	RATING_TREE_MAXIMUM = 220,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   114
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   115
	RATING_TUNNEL_BRIDGE_DOWN_STEP = -250,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   116
	RATING_TUNNEL_BRIDGE_MINIMUM = 0,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   117
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   118
	RATING_INDUSTRY_DOWN_STEP = -1500,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   119
	RATING_INDUSTRY_MINIMUM = RATING_MINIMUM,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   120
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   121
	RATING_ROAD_DOWN_STEP = -50,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   122
	RATING_ROAD_MINIMUM = -100,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   123
	RATING_HOUSE_MINIMUM = RATING_MINIMUM,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   124
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   125
	RATING_BRIBE_UP_STEP = 200,
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   126
	RATING_BRIBE_MAXIMUM = 800,
1019
6bae6c11e865 (svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents: 1005
diff changeset
   127
	RATING_BRIBE_DOWN_TO = -50 					// XXX SHOULD BE SOMETHING LOWER?
1005
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   128
};
f48b2bdd84fc (svn r1504) enummed town ratings (Jango)
celestar
parents: 919
diff changeset
   129
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   130
bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
919
544f374ee392 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 835
diff changeset
   132
VARDEF uint16 *_town_sort;
544f374ee392 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 835
diff changeset
   133
1260
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   134
extern MemoryPool _town_pool;
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   135
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   136
/**
1330
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   137
 * Check if a Town really exists.
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   138
 */
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   139
static inline bool IsValidTown(Town* town)
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   140
{
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   141
	return town->xy != 0; /* XXX: Replace by INVALID_TILE someday */
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   142
}
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   143
5d76a0522a11 (svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents: 1260
diff changeset
   144
/**
1260
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   145
 * Get the pointer to the town with index 'index'
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   146
 */
919
544f374ee392 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 835
diff changeset
   147
static inline Town *GetTown(uint index)
544f374ee392 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 835
diff changeset
   148
{
1260
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   149
	return (Town*)GetItemFromPool(&_town_pool, index);
919
544f374ee392 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 835
diff changeset
   150
}
544f374ee392 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 835
diff changeset
   151
1260
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   152
/**
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   153
 * Get the current size of the TownPool
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   154
 */
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   155
static inline uint16 GetTownPoolSize(void)
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   156
{
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   157
	return _town_pool.total_items;
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   158
}
919
544f374ee392 (svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents: 835
diff changeset
   159
1260
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   160
#define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1 < GetTownPoolSize()) ? GetTown(t->index + 1) : NULL)
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   161
#define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0)
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   162
632f63689178 (svn r1764) -Add: dynamic towns, you can now have up to 64k towns (let me know when
truelight
parents: 1220
diff changeset
   163
VARDEF uint _total_towns; // For the AI: the amount of towns active
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
VARDEF bool _town_sort_dirty;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   166
VARDEF byte _town_sort_order;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   167
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   168
VARDEF Town *_cleared_town;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
VARDEF int _cleared_town_rating;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
#endif /* TOWN_H */