summaryrefslogtreecommitdiff
path: root/src/town_gui.cpp
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
commitfc35ad9ee9077869ab7b5a06b44327c835df3e5f (patch)
tree6e9667beb04ac4a18b43294a74456ab52a123a5a /src/town_gui.cpp
parent6f233b1f8f18beb1e347c943685f6086d886993e (diff)
downloadopenttd-fc35ad9ee9077869ab7b5a06b44327c835df3e5f.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_gui.cpp')
-rw-r--r--src/town_gui.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 46a7e8890..bf4e63000 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -280,7 +280,9 @@ private:
enum TownViewWidget {
TVW_CAPTION = 1,
TVW_STICKY,
- TVW_CENTERVIEW = 6,
+ TVW_VIEWPORTPANEL,
+ TVW_INFOPANEL = 5,
+ TVW_CENTERVIEW,
TVW_SHOWAUTORITY,
TVW_CHANGENAME,
TVW_EXPAND,
@@ -310,6 +312,11 @@ public:
this->widget[TVW_CHANGENAME].right = this->widget[TVW_STICKY].right;
}
+ /* Space required for showing noise level information */
+ if (_patches.station_noise_level) {
+ ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
+ }
+
this->FindWindowPlacementAndResize(desc);
}
@@ -334,6 +341,13 @@ public:
DrawString(2, 127, STR_200E_MAIL_LAST_MONTH_MAX, TC_FROMSTRING);
this->DrawViewport();
+
+ /* only show the town noise, if the noise option is activated. */
+ if (_patches.station_noise_level) {
+ SetDParam(0, this->town->noise_reached);
+ SetDParam(1, this->town->MaxTownNoise());
+ DrawString(2, 137, STR_NOISE_IN_TOWN, 0);
+ }
}
virtual void OnClick(Point pt, int widget)
@@ -366,6 +380,22 @@ public:
}
}
+ virtual void OnInvalidateData(int data = 0)
+ {
+ /* Called when setting station noise have changed, in order to resize the window */
+ this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
+
+ if (_patches.station_noise_level) { // adjust depending
+ if (this->height == 150) { // window is smaller, needs to be bigger
+ ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
+ }
+ } else {
+ if (this->height != 150) { // window is bigger, needs to be smaller
+ ResizeWindowForWidget(this, TVW_INFOPANEL, 0, -10);
+ }
+ }
+ }
+
virtual void OnQueryTextFinished(char *str)
{
if (!StrEmpty(str)) {
@@ -636,7 +666,6 @@ private:
};
public:
-
ScenarioEditorTownGenerationWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{
this->LowerWidget(_scengen_town_size + TSEW_SMALLTOWN);