diff options
author | alberth <alberth@openttd.org> | 2009-09-05 11:27:28 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-09-05 11:27:28 +0000 |
commit | 9fd22f727f813fc72fd4d2022ca3b8d517bf23eb (patch) | |
tree | f80aca71c5166ef147b1e4605df9c7c4ae5b9b90 /src | |
parent | 8bac3af04991c5bdee37f1c5d30f30380c3c5fa8 (diff) | |
download | openttd-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')
-rw-r--r-- | src/industry_gui.cpp | 6 | ||||
-rw-r--r-- | src/lang/english.txt | 2 | ||||
-rw-r--r-- | src/town_gui.cpp | 7 |
3 files changed, 13 insertions, 2 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]))); } diff --git a/src/lang/english.txt b/src/lang/english.txt index 682bab0a8..c91f339e1 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2356,6 +2356,7 @@ STR_EDIT_SIGN_SIGN_OSKTITLE :{BLACK}Enter a # Town directory window STR_TOWN_DIRECTORY_CAPTION :{WHITE}Towns +STR_TOWN_DIRECTORY_NONE :{ORANGE}- None - STR_TOWN_DIRECTORY_TOWN :{ORANGE}{TOWN}{BLACK} ({COMMA}) STR_TOWN_DIRECTORY_LIST_TOOLTIP :{BLACK}Town names - click on name to centre view on town. Ctrl+Click opens a new viewport on town location STR_TOWN_POPULATION :{BLACK}World population: {COMMA} @@ -2544,6 +2545,7 @@ STR_BUY_COMPANY_MESSAGE :{WHITE}We are l # Industry directory STR_INDUSTRY_DIRECTORY_CAPTION :{WHITE}Industries +STR_INDUSTRY_DIRECTORY_NONE :{ORANGE}- None - STR_INDUSTRY_DIRECTORY_ITEM :{ORANGE}{INDUSTRY}{BLACK} ({CARGO}{STRING}){YELLOW} ({COMMA}% transported) STR_INDUSTRY_DIRECTORY_ITEM_TWO :{ORANGE}{INDUSTRY}{BLACK} ({CARGO}{STRING}/{CARGO}{STRING}){YELLOW} ({COMMA}%/{COMMA}% transported) STR_INDUSTRY_DIRECTORY_ITEM_NOPROD :{ORANGE}{INDUSTRY} diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 1a090f10e..74e5bc4a6 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -635,6 +635,11 @@ public: case TDW_CENTERTOWN: { int n = 0; int y = r.top + WD_FRAMERECT_TOP; + if (this->towns.Length() == 0) { // No towns available. + DrawString(r.left + WD_FRAMERECT_LEFT, r.right, y, STR_TOWN_DIRECTORY_NONE); + break; + } + /* At least one town available. */ for (uint i = this->vscroll.GetPosition(); i < this->towns.Length(); i++) { const Town *t = this->towns[i]; @@ -663,7 +668,7 @@ public: break; } case TDW_CENTERTOWN: { - Dimension d = {0, 0}; + Dimension d = GetStringBoundingBox(STR_TOWN_DIRECTORY_NONE); for (uint i = 0; i < this->towns.Length(); i++) { const Town *t = this->towns[i]; |