summaryrefslogtreecommitdiff
path: root/src/industry_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-09-05 11:27:28 +0000
committeralberth <alberth@openttd.org>2009-09-05 11:27:28 +0000
commit9fd22f727f813fc72fd4d2022ca3b8d517bf23eb (patch)
treef80aca71c5166ef147b1e4605df9c7c4ae5b9b90 /src/industry_gui.cpp
parent8bac3af04991c5bdee37f1c5d30f30380c3c5fa8 (diff)
downloadopenttd-9fd22f727f813fc72fd4d2022ca3b8d517bf23eb.tar.xz
(svn r17423) -Fix [FS#3174]: Show '- None -' with empty town or industry list, and use that text in the size computation as well.
Diffstat (limited to 'src/industry_gui.cpp')
-rw-r--r--src/industry_gui.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 8cfd50cf7..e18a52d1d 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -961,6 +961,10 @@ public:
case IDW_INDUSTRY_LIST: {
int n = 0;
int y = r.top + WD_FRAMERECT_TOP;
+ if (this->industries.Length() == 0) {
+ DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_DIRECTORY_NONE);
+ break;
+ }
for (uint i = this->vscroll.GetPosition(); i < this->industries.Length(); i++) {
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, this->GetIndustryString(this->industries[i]));
@@ -994,7 +998,7 @@ public:
}
case IDW_INDUSTRY_LIST: {
- Dimension d = {0, 0};
+ Dimension d = GetStringBoundingBox(STR_INDUSTRY_DIRECTORY_NONE);
for (uint i = 0; i < this->industries.Length(); i++) {
d = maxdim(d, GetStringBoundingBox(this->GetIndustryString(this->industries[i])));
}