diff options
author | frosch <frosch@openttd.org> | 2014-06-10 16:37:25 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2014-06-10 16:37:25 +0000 |
commit | 1b0929a9f04d94d40962cf49a682f1e3f8f800fd (patch) | |
tree | c959248f6820bc4946b8eea8b2173e72478652bc | |
parent | 4d2107bd618ea56e5ee0ac1e7db1aa0b88b6551d (diff) | |
download | openttd-1b0929a9f04d94d40962cf49a682f1e3f8f800fd.tar.xz |
(svn r26640) -Cleanup: Remove some pointless STR_JUST_STRING detours.
-rw-r--r-- | src/autoreplace_gui.cpp | 17 | ||||
-rw-r--r-- | src/industry_gui.cpp | 9 | ||||
-rw-r--r-- | src/newgrf_gui.cpp | 5 | ||||
-rw-r--r-- | src/object_gui.cpp | 3 | ||||
-rw-r--r-- | src/rail_gui.cpp | 7 |
5 files changed, 17 insertions, 24 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index c53df993f..e6ce64cfa 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -278,10 +278,8 @@ public: } case WID_RV_INFO_TAB: { - SetDParam(0, STR_REPLACE_NOT_REPLACING); - Dimension d = GetStringBoundingBox(STR_BLACK_STRING); - SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED); - d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING)); + Dimension d = GetStringBoundingBox(STR_REPLACE_NOT_REPLACING); + d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED)); d.width += WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT; d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; *size = maxdim(*size, d); @@ -353,20 +351,21 @@ public: switch (widget) { case WID_RV_INFO_TAB: { const Company *c = Company::Get(_local_company); + StringID str; if (this->sel_engine[0] != INVALID_ENGINE) { if (!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)) { - SetDParam(0, STR_REPLACE_NOT_REPLACING); + str = STR_REPLACE_NOT_REPLACING; } else { bool when_old = false; EngineID e = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group, &when_old); - SetDParam(0, when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME); - SetDParam(1, e); + str = when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME; + SetDParam(0, e); } } else { - SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED); + str = STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED; } - DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_BLACK_STRING, TC_FROMSTRING, SA_HOR_CENTER); + DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_BLACK, SA_HOR_CENTER); break; } diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index bcda8bd5c..88cb29c74 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -119,12 +119,10 @@ static int CDECL IndustryTypeNameSorter(const IndustryType *a, const IndustryTyp static char industry_name[2][64]; const IndustrySpec *indsp1 = GetIndustrySpec(*a); - SetDParam(0, indsp1->name); - GetString(industry_name[0], STR_JUST_STRING, lastof(industry_name[0])); + GetString(industry_name[0], indsp1->name, lastof(industry_name[0])); const IndustrySpec *indsp2 = GetIndustrySpec(*b); - SetDParam(0, indsp2->name); - GetString(industry_name[1], STR_JUST_STRING, lastof(industry_name[1])); + GetString(industry_name[1], indsp2->name, lastof(industry_name[1])); int r = strnatcmp(industry_name[0], industry_name[1]); // Sort by name (natural sorting). @@ -1671,8 +1669,7 @@ struct CargoesField { ypos += (normal_height - FONT_HEIGHT_NORMAL) / 2; if (this->u.industry.ind_type < NUM_INDUSTRYTYPES) { const IndustrySpec *indsp = GetIndustrySpec(this->u.industry.ind_type); - SetDParam(0, indsp->name); - DrawString(xpos, xpos2, ypos, STR_JUST_STRING, TC_WHITE, SA_HOR_CENTER); + DrawString(xpos, xpos2, ypos, indsp->name, TC_WHITE, SA_HOR_CENTER); /* Draw the industry legend. */ int blob_left, blob_right; diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 7c6d6ab9e..b211c1cb4 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -137,9 +137,8 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint right, uint /* Draw GRF info if it exists */ if (!StrEmpty(c->GetDescription())) { - SetDParam(0, STR_JUST_RAW_STRING); - SetDParamStr(1, c->GetDescription()); - y = DrawStringMultiLine(x, right, y, bottom, STR_BLACK_STRING); + SetDParamStr(0, c->GetDescription()); + y = DrawStringMultiLine(x, right, y, bottom, STR_BLACK_RAW_STRING); } else { y = DrawStringMultiLine(x, right, y, bottom, STR_NEWGRF_SETTINGS_NO_INFO); } diff --git a/src/object_gui.cpp b/src/object_gui.cpp index f0dbd0dc2..c55041886 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -211,8 +211,7 @@ public: ObjectClass *objclass = ObjectClass::Get((ObjectClassID)i); if (objclass->GetUISpecCount() == 0) continue; if (!this->vscroll->IsVisible(pos++)) continue; - SetDParam(0, objclass->name); - DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, STR_JUST_STRING, + DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, y + WD_MATRIX_TOP, objclass->name, ((int)i == _selected_object_class) ? TC_WHITE : TC_BLACK); y += this->line_height; } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index d07bb5520..1907c6617 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1040,8 +1040,7 @@ public: Dimension d = {0, 0}; for (uint i = 0; i < StationClass::GetClassCount(); i++) { if (i == STAT_CLASS_WAYP) continue; - SetDParam(0, StationClass::Get((StationClassID)i)->name); - d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING)); + d = maxdim(d, GetStringBoundingBox(StationClass::Get((StationClassID)i)->name)); } size->width = max(size->width, d.width + padding.width); this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; @@ -1119,8 +1118,8 @@ public: for (uint i = 0; i < StationClass::GetClassCount(); i++) { if (i == STAT_CLASS_WAYP) continue; if (this->vscroll->IsVisible(statclass)) { - SetDParam(0, StationClass::Get((StationClassID)i)->name); - DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, row * this->line_height + r.top + WD_MATRIX_TOP, STR_JUST_STRING, + DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_RIGHT, row * this->line_height + r.top + WD_MATRIX_TOP, + StationClass::Get((StationClassID)i)->name, (StationClassID)i == _railstation.station_class ? TC_WHITE : TC_BLACK); row++; } |