(svn r26640) -Cleanup: Remove some pointless STR_JUST_STRING detours.

This commit is contained in:
frosch 2014-06-10 16:37:25 +00:00
parent 4d2107bd61
commit 1b0929a9f0
5 changed files with 17 additions and 24 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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++;
}