|
@@ -242,25 +242,25 @@ static RefitOption *DrawVehicleRefitWind
|
|
|
uint i;
|
|
|
|
|
|
/* Draw the list, and find the selected cargo (by its position in list) */
|
|
|
for (i = 0; i < num_lines; i++) {
|
|
|
TextColour colour = TC_BLACK;
|
|
|
if (sel == 0) {
|
|
|
selected = &refit[i];
|
|
|
colour = TC_WHITE;
|
|
|
}
|
|
|
|
|
|
if (i >= pos && i < pos + rows) {
|
|
|
/* Draw the cargo name */
|
|
|
int last_x = DrawString(2, right, y, GetCargo(refit[i].cargo)->name, colour);
|
|
|
int last_x = DrawString(2, right, y, CargoSpec::Get(refit[i].cargo)->name, colour);
|
|
|
|
|
|
/* If the callback succeeded, draw the cargo suffix */
|
|
|
if (refit[i].value != CALLBACK_FAILED) {
|
|
|
DrawString(last_x + 1, right, y, GetGRFStringID(GetEngineGRFID(refit[i].engine), 0xD000 + refit[i].value), colour);
|
|
|
}
|
|
|
y += delta;
|
|
|
}
|
|
|
|
|
|
sel--;
|
|
|
}
|
|
|
|
|
|
return selected;
|
|
@@ -494,25 +494,25 @@ uint ShowRefitOptionsList(int left, int
|
|
|
|
|
|
bool first = true;
|
|
|
|
|
|
/* Add each cargo type to the list */
|
|
|
for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
|
|
|
if (!HasBit(cmask, cid)) continue;
|
|
|
|
|
|
if (b >= lastof(string) - (2 + 2 * 4)) break; // ", " and two calls to Utf8Encode()
|
|
|
|
|
|
if (!first) b = strecpy(b, ", ", lastof(string));
|
|
|
first = false;
|
|
|
|
|
|
b = InlineString(b, GetCargo(cid)->name);
|
|
|
b = InlineString(b, CargoSpec::Get(cid)->name);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Terminate and display the completed string */
|
|
|
*b = '\0';
|
|
|
|
|
|
/* Make sure we detect any buffer overflow */
|
|
|
assert(b < endof(string));
|
|
|
|
|
|
SetDParamStr(0, string);
|
|
|
return DrawStringMultiLine(left, right, y, INT32_MAX, STR_JUST_RAW_STRING);
|
|
|
}
|