summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-01-15 12:36:24 +0000
committerpeter1138 <peter1138@openttd.org>2009-01-15 12:36:24 +0000
commit9b9a0fed8d6ac5faa0090e87ee74e56395f699dc (patch)
treec5217afc48cf64deee346e1c9243f1ec77db4fee /src
parent1e1cdd01b45c30038107bdf5242cd2f62684679a (diff)
downloadopenttd-9b9a0fed8d6ac5faa0090e87ee74e56395f699dc.tar.xz
(svn r15087) -Codechange: Less hardcoding of y positions in town authority window.
Diffstat (limited to 'src')
-rw-r--r--src/town_gui.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index cc6a61724..db70a5984 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -176,11 +176,12 @@ public:
SetDParam(0, this->window_number);
this->DrawWidgets();
- DrawString(2, 15, STR_2023_TRANSPORT_COMPANY_RATINGS, TC_FROMSTRING);
+ int y = this->widget[TWA_RATING_INFO].top + 1;
- /* Draw list of companies */
- int y = 25;
+ DrawString(2, y, STR_2023_TRANSPORT_COMPANY_RATINGS, TC_FROMSTRING);
+ y += 10;
+ /* Draw list of companies */
const Company *c;
FOR_ALL_COMPANIES(c) {
if ((HasBit(this->town->have_ratings, c->index) || this->town->exclusivity == c->index)) {
@@ -209,7 +210,7 @@ public:
y += 10;
}
}
- y = 107;
+ y = this->widget[TWA_COMMAND_LIST].top + 1;
int pos = this->vscroll.pos;
if (--pos < 0) {
@@ -229,7 +230,7 @@ public:
if (this->sel_index != -1) {
SetDParam(1, (_price.build_industry >> 8) * _town_action_costs[this->sel_index]);
SetDParam(0, STR_2046_SMALL_ADVERTISING_CAMPAIGN + this->sel_index);
- DrawStringMultiLine(2, 159, STR_204D_INITIATE_A_SMALL_LOCAL + this->sel_index, 313);
+ DrawStringMultiLine(2, this->widget[TWA_ACTION_INFO].top + 1, STR_204D_INITIATE_A_SMALL_LOCAL + this->sel_index, 313);
}
}
@@ -240,7 +241,7 @@ public:
{
switch (widget) {
case TWA_COMMAND_LIST: {
- int y = (pt.y - 0x6B) / 10;
+ int y = (pt.y - this->widget[TWA_COMMAND_LIST].top - 1) / 10;
if (!IsInsideMM(y, 0, 5)) return;