Files
@ r4681:f719e26018b5
Branch filter:
Location: cpp/openttd-patchpack/source/town.h - annotation
r4681:f719e26018b5
5.6 KiB
text/x-c
(svn r6586) -Feature: [depot window] added a vehicle list window with all vehicles having a certain depot in their orders
It got one known issue though. The top bar got a plural issue so expect to see stuff like "1 trains" until we figure out why it behaves this way
Added the button to the depot windows. Made the autoreplace button bigger while I was moving some widgets anyway
Made road vehicle depot windows start with one more row to make room for the buttons
It got one known issue though. The top bar got a plural issue so expect to see stuff like "1 trains" until we figure out why it behaves this way
Added the button to the depot windows. Made the autoreplace button bigger while I was moving some widgets anyway
Made road vehicle depot windows start with one more row to make room for the buttons
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | r2186:5ee653b1b5e1 r2186:5ee653b1b5e1 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1260:990ce96b0df6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r193:6aa65dc5a4b4 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r2498:8dfa040ed505 r121:ae177290c657 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r1377:61ffe715e00e r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r4:44fa2d88cb6a r0:d63b455452f6 r4:44fa2d88cb6a r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r193:6aa65dc5a4b4 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r3346:134319cc6f99 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1093:18f56ef2d029 r0:d63b455452f6 r835:d8d661a0d2ad r1093:18f56ef2d029 r3346:134319cc6f99 r0:d63b455452f6 r3674:56cf5da2c144 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r1005:0796061bc2a6 r1005:0796061bc2a6 r1005:0796061bc2a6 r3432:2032d27d90cf r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r1005:0796061bc2a6 r1005:0796061bc2a6 r1005:0796061bc2a6 r1005:0796061bc2a6 r1005:0796061bc2a6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r1005:0796061bc2a6 r1005:0796061bc2a6 r4344:bff007ae1fd1 r1005:0796061bc2a6 r1005:0796061bc2a6 r4344:bff007ae1fd1 r1005:0796061bc2a6 r1005:0796061bc2a6 r4344:bff007ae1fd1 r4344:bff007ae1fd1 r1005:0796061bc2a6 r1005:0796061bc2a6 r1005:0796061bc2a6 r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r4344:bff007ae1fd1 r3432:2032d27d90cf r4344:bff007ae1fd1 r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r3432:2032d27d90cf r1005:0796061bc2a6 r1005:0796061bc2a6 r2958:7c0285bafd42 r0:d63b455452f6 r4277:fd4235a66bc9 r0:d63b455452f6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1330:62eaa061ec97 r1330:62eaa061ec97 r2436:963efe8b84cc r1330:62eaa061ec97 r4346:fa4ac6b6f852 r1330:62eaa061ec97 r1330:62eaa061ec97 r1330:62eaa061ec97 r1260:990ce96b0df6 r1260:990ce96b0df6 r919:57ef81f1ba8e r919:57ef81f1ba8e r1260:990ce96b0df6 r919:57ef81f1ba8e r919:57ef81f1ba8e r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r1260:990ce96b0df6 r919:57ef81f1ba8e r4354:95cd3ce6deea r4354:95cd3ce6deea r4354:95cd3ce6deea r4354:95cd3ce6deea r4354:95cd3ce6deea r4354:95cd3ce6deea r4354:95cd3ce6deea r4354:95cd3ce6deea r4354:95cd3ce6deea r4357:4a0463b63644 r4354:95cd3ce6deea r4354:95cd3ce6deea r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4356:03f88658c85b r4352:460a517b040f r1784:15b805156766 r4352:460a517b040f r1784:15b805156766 r1784:15b805156766 r4396:de3f13de914f r4396:de3f13de914f r4396:de3f13de914f r4396:de3f13de914f r4396:de3f13de914f r4396:de3f13de914f r4396:de3f13de914f r4396:de3f13de914f r4346:fa4ac6b6f852 r1260:990ce96b0df6 r1260:990ce96b0df6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 r0:d63b455452f6 | /* $Id$ */
#ifndef TOWN_H
#define TOWN_H
#include "pool.h"
#include "player.h"
struct Town {
TileIndex xy;
// Current population of people and amount of houses.
uint16 num_houses;
uint32 population;
// Town name
uint16 townnametype;
uint32 townnameparts;
// NOSAVE: Location of name sign, UpdateTownVirtCoord updates this.
ViewportSign sign;
// Makes sure we don't build certain house types twice.
// bit 0 = Building funds received
// bit 1 = CHURCH
// bit 2 = STADIUM
byte flags12;
// Which players have a statue?
byte statues;
// 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)
PlayerID exclusivity; // which player has exslusivity
uint8 exclusive_counter; // months till the exclusivity expires
int16 ratings[MAX_PLAYERS];
// Maximum amount of passengers and mail that can be transported.
uint32 max_pass;
uint32 max_mail;
uint32 new_max_pass;
uint32 new_max_mail;
uint32 act_pass;
uint32 act_mail;
uint32 new_act_pass;
uint32 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;
uint16 act_water;
uint16 new_act_food;
uint16 new_act_water;
// Time until we rebuild a house.
byte time_until_rebuild;
// When to grow town next time.
byte grow_counter;
byte growth_rate;
// Fund buildings program in action?
byte fund_buildings_months;
// Fund road reconstruction in action?
byte road_build_months;
// Index in town array
TownID index;
// NOSAVE: UpdateTownRadius updates this given the house count.
uint16 radius[5];
};
uint32 GetWorldPopulation(void);
void UpdateTownVirtCoord(Town *t);
void InitializeTown(void);
void ShowTownViewWindow(TownID town);
void ExpandTown(Town *t);
Town *CreateRandomTown(uint attempts, uint size_mode);
enum {
ROAD_REMOVE = 0,
UNMOVEABLE_REMOVE = 1,
TUNNELBRIDGE_REMOVE = 1,
INDUSTRY_REMOVE = 2
};
enum {
// These refer to the maximums, so Appalling is -1000 to -400
// MAXIMUM RATINGS BOUNDARIES
RATING_MINIMUM = -1000,
RATING_APPALLING = -400,
RATING_VERYPOOR = -200,
RATING_POOR = 0,
RATING_MEDIOCRE = 200,
RATING_GOOD = 400,
RATING_VERYGOOD = 600,
RATING_EXCELLENT = 800,
RATING_OUTSTANDING = 1000, // OUTSTANDING
RATING_MAXIMUM = RATING_OUTSTANDING,
// RATINGS AFFECTING NUMBERS
RATING_TREE_DOWN_STEP = -35,
RATING_TREE_MINIMUM = RATING_MINIMUM,
RATING_TREE_UP_STEP = 7,
RATING_TREE_MAXIMUM = 220,
RATING_TUNNEL_BRIDGE_DOWN_STEP = -250,
RATING_TUNNEL_BRIDGE_MINIMUM = 0,
RATING_INDUSTRY_DOWN_STEP = -1500,
RATING_INDUSTRY_MINIMUM = RATING_MINIMUM,
RATING_ROAD_DOWN_STEP = -50,
RATING_ROAD_MINIMUM = -100,
RATING_HOUSE_MINIMUM = RATING_MINIMUM,
RATING_BRIBE_UP_STEP = 200,
RATING_BRIBE_MAXIMUM = 800,
RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER?
};
enum {
/* This is the base "normal" number of towns on the 8x8 map, when
* one town should get grown per tick. The other numbers of towns
* are then scaled based on that. */
TOWN_GROWTH_FREQUENCY = 23,
/* Simple value that indicates the house has reached final stage of construction*/
TOWN_HOUSE_COMPLETED = 3,
};
/* This enum is used in conjonction with town->flags12.
* IT simply states what bit is used for.
* It is pretty unrealistic (IMHO) to only have one church/stadium
* per town, NO MATTER the population of it.
* And there are 5 more bits available on flags12...
*/
enum {
TOWN_IS_FUNDED = 0, // Town has received some funds for
TOWN_HAS_CHURCH = 1, // There can be only one church by town.
TOWN_HAS_STADIUM = 2 // There can be only one stadium by town.
};
bool CheckforTownRating(uint32 flags, Town *t, byte type);
VARDEF const Town** _town_sort;
extern MemoryPool _town_pool;
/**
* Check if a Town really exists.
*/
static inline bool IsValidTown(const Town* town)
{
return town->xy != 0;
}
/**
* Get the pointer to the town with index 'index'
*/
static inline Town *GetTown(uint index)
{
return (Town*)GetItemFromPool(&_town_pool, index);
}
/**
* Get the current size of the TownPool
*/
static inline uint16 GetTownPoolSize(void)
{
return _town_pool.total_items;
}
VARDEF uint _total_towns;
static inline TownID GetTownArraySize(void)
{
/* TODO - This isn't the real content of the function, but
* with the new pool-system this will be replaced with one that
* _really_ returns the highest index + 1. Now it just returns
* the next safe value we are sure about everything is below.
*/
return _total_towns;
}
/**
* Return a random valid town.
*/
static inline Town *GetRandomTown(void)
{
uint num = RandomRange(GetTownArraySize());
uint index = 0;
while (num > 0) {
num--;
index++;
/* Make sure we have a valid industry */
while (GetTown(index) == NULL) {
index++;
if (index == GetTownArraySize()) index = 0;
}
}
return GetTown(index);
}
static inline bool IsValidTownID(uint index)
{
return index < GetTownPoolSize() && IsValidTown(GetTown(index));
}
void DestroyTown(Town *t);
static inline void DeleteTown(Town *t)
{
DestroyTown(t);
t->xy = 0;
}
#define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1 < GetTownPoolSize()) ? GetTown(t->index + 1) : NULL) if (IsValidTown(t))
#define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0)
VARDEF bool _town_sort_dirty;
VARDEF byte _town_sort_order;
VARDEF Town *_cleared_town;
VARDEF int _cleared_town_rating;
#endif /* TOWN_H */
|