(svn r26653) [1.4] -Backport from trunk:

- Fix: Incorrect usage of string commands in the base language [FS#6037] (r26642, r26640, r26639, r26632)
This commit is contained in:
frosch 2014-06-17 19:14:59 +00:00
parent 324e17d827
commit 1708243e51
7 changed files with 29 additions and 46 deletions

View File

@ -276,10 +276,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);
@ -351,20 +349,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

@ -117,12 +117,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).
@ -1669,8 +1667,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

@ -1218,7 +1218,7 @@ STR_CONFIG_SETTING_PLANE_CRASHES_HELPTEXT :Set the chance
STR_CONFIG_SETTING_PLANE_CRASHES_NONE :None
STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :Reduced
STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :Normal
STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Allow drive-through road stops on town owned roads: {STRING}
STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Allow drive-through road stops on town owned roads: {STRING2}
STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Allow construction of drive-through road stops on town-owned roads
STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD :Allow drive-through road stops on roads owned by competitors: {STRING2}
STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT :Allow construction of drive-through road stops on roads owned by other companies
@ -3762,7 +3762,7 @@ STR_ORDER_REFIT_ORDER :(Refit to {STRI
STR_ORDER_REFIT_STOP_ORDER :(Refit to {STRING} and stop)
STR_ORDER_STOP_ORDER :(Stop)
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING}
STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING1}
STR_ORDER_IMPLICIT :(Implicit)
@ -3986,9 +3986,9 @@ STR_MESSAGE_ESTIMATED_INCOME :{WHITE}Estimate
STR_ERROR_SAVE_STILL_IN_PROGRESS :{WHITE}Saving still in progress,{}please wait until it is finished!
STR_ERROR_AUTOSAVE_FAILED :{WHITE}Autosave failed
STR_ERROR_UNABLE_TO_READ_DRIVE :{BLACK}Unable to read drive
STR_ERROR_GAME_SAVE_FAILED :{WHITE}Game Save Failed{}{STRING}
STR_ERROR_GAME_SAVE_FAILED :{WHITE}Game Save Failed{}{STRING1}
STR_ERROR_UNABLE_TO_DELETE_FILE :{WHITE}Unable to delete file
STR_ERROR_GAME_LOAD_FAILED :{WHITE}Game Load Failed{}{STRING}
STR_ERROR_GAME_LOAD_FAILED :{WHITE}Game Load Failed{}{STRING1}
STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR :Internal error: {RAW_STRING}
STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME :Broken savegame - {RAW_STRING}
STR_GAME_SAVELOAD_ERROR_TOO_NEW_SAVEGAME :Savegame is made with newer version

View File

@ -134,9 +134,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

@ -209,8 +209,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

@ -1038,8 +1038,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;
@ -1117,8 +1116,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++;
}

View File

@ -53,18 +53,6 @@ void SetTimetableParams(int param1, int param2, Ticks ticks)
}
}
/**
* Sets the arrival or departure string and parameters.
* @param param1 the first DParam to fill
* @param param2 the second DParam to fill
* @param ticks the number of ticks to 'draw'
*/
static void SetArrivalDepartParams(int param1, int param2, Ticks ticks)
{
SetDParam(param1, STR_JUST_DATE_TINY);
SetDParam(param2, _date + (ticks / DAY_TICKS));
}
/**
* Check whether it is possible to determine how long the order takes.
* @param order the order to check.
@ -447,18 +435,20 @@ struct TimetableWindow : Window {
if (arr_dep[i / 2].arrival != INVALID_TICKS) {
DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_ARRIVAL_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK);
if (this->show_expected && i / 2 == earlyID) {
SetArrivalDepartParams(0, 1, arr_dep[i / 2].arrival);
DrawString(time_left, time_right, y, STR_GREEN_STRING, i == selected ? TC_WHITE : TC_BLACK);
SetDParam(0, _date + arr_dep[i / 2].arrival / DAY_TICKS);
DrawString(time_left, time_right, y, STR_JUST_DATE_TINY, TC_GREEN);
} else {
SetArrivalDepartParams(0, 1, arr_dep[i / 2].arrival + offset);
DrawString(time_left, time_right, y, show_late ? STR_RED_STRING : STR_JUST_STRING, i == selected ? TC_WHITE : TC_BLACK);
SetDParam(0, _date + (arr_dep[i / 2].arrival + offset) / DAY_TICKS);
DrawString(time_left, time_right, y, STR_JUST_DATE_TINY,
show_late ? TC_RED : i == selected ? TC_WHITE : TC_BLACK);
}
}
} else {
if (arr_dep[i / 2].departure != INVALID_TICKS) {
DrawString(abbr_left, abbr_right, y, STR_TIMETABLE_DEPARTURE_ABBREVIATION, i == selected ? TC_WHITE : TC_BLACK);
SetArrivalDepartParams(0, 1, arr_dep[i/2].departure + offset);
DrawString(time_left, time_right, y, show_late ? STR_RED_STRING : STR_JUST_STRING, i == selected ? TC_WHITE : TC_BLACK);
SetDParam(0, _date + (arr_dep[i/2].departure + offset) / DAY_TICKS);
DrawString(time_left, time_right, y, STR_JUST_DATE_TINY,
show_late ? TC_RED : i == selected ? TC_WHITE : TC_BLACK);
}
}
y += FONT_HEIGHT_NORMAL;