summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-10-18 13:40:11 +0000
committeralberth <alberth@openttd.org>2009-10-18 13:40:11 +0000
commit29028b3f8ad56559648ec231eca4fbbc8344033a (patch)
treef519e1d55db414de71858d042181b7e39fd80d36
parent2e766884f65812b2eca1580e8dbd1d58298263b6 (diff)
downloadopenttd-29028b3f8ad56559648ec231eca4fbbc8344033a.tar.xz
(svn r17796) -Codechange: Move drawing of the industry info to its own function.
-rw-r--r--src/industry_gui.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 365e2da8e..cb9b2b599 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -495,7 +495,13 @@ public:
this->FindWindowPlacementAndResize(desc);
}
- virtual void OnPaint()
+ /** Draw the text in the #IVW_INFO panel.
+ * @param left Left edge of the panel.
+ * @param right Right edge of the panel.
+ * @param top Top edge of the panel.
+ * @return Expected position of the bottom edge of the panel.
+ */
+ int DrawInfo(uint left, uint right, uint top)
{
Industry *i = Industry::Get(this->window_number);
const IndustrySpec *ind = GetIndustrySpec(i->type);
@@ -503,9 +509,6 @@ public:
bool first = true;
bool has_accept = false;
- SetDParam(0, this->window_number);
- this->DrawWidgets();
-
if (HasBit(ind->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_mask, CBM_IND_PRODUCTION_256_TICKS)) {
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
if (i->accepts_cargo[j] == CT_INVALID) continue;
@@ -581,6 +584,15 @@ public:
}
}
}
+ return y;
+ }
+
+ virtual void OnPaint()
+ {
+ SetDParam(0, this->window_number);
+ this->DrawWidgets();
+
+ int y = this->DrawInfo(this->widget[IVW_INFO].left, this->widget[IVW_INFO].right, this->widget[IVW_INFO].top);
if (y > this->widget[IVW_INFO].bottom) {
this->SetDirty();