summaryrefslogtreecommitdiff
path: root/src/town.h
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2008-05-24 02:54:47 +0000
committerbelugas <belugas@openttd.org>2008-05-24 02:54:47 +0000
commit08671d2e78d3277511d57236eaa74c0d6cb49fa0 (patch)
tree6e9667beb04ac4a18b43294a74456ab52a123a5a /src/town.h
parentcfc45e97ab94c6d96f32b3397201c003b61ccd75 (diff)
downloadopenttd-08671d2e78d3277511d57236eaa74c0d6cb49fa0.tar.xz
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
Initial concept : TTDPatch (moreairpots), Initial code : Pasky Thanks to BigBB (help coding), Smatz Skidd13 and frosch for bugcatches and advices
Diffstat (limited to 'src/town.h')
-rw-r--r--src/town.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/town.h b/src/town.h
index 03d0cc112..8bf21dbd4 100644
--- a/src/town.h
+++ b/src/town.h
@@ -116,6 +116,9 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> {
* bit 2 = STADIUM */
byte flags12;
+ /* level of noise that all the airports are generating */
+ uint16 noise_reached;
+
/* Which players have a statue? */
byte statues;
@@ -184,6 +187,18 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> {
void InitializeLayout();
inline TownLayout GetActiveLayout() const;
+
+ /** Calculate the max town noise
+ * The value is counted using the population divided by the content of the
+ * entry in town_noise_population corespondig to the town's tolerance.
+ * To this result, we add 3, which is the noise of the lowest airport.
+ * So user can at least buld that airport
+ * @return the maximum noise level the town will tolerate */
+ inline uint16 MaxTownNoise() const {
+ if (this->population == 0) return 0; // no population? no noise
+
+ return ((this->population / _patches.town_noise_population[_opt.diff.town_council_tolerance]) + 3);
+ }
};
/**