(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
This commit is contained in:
belugas
2008-05-24 02:54:47 +00:00
parent cfc45e97ab
commit 08671d2e78
16 changed files with 279 additions and 26 deletions

View File

@@ -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);