mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r17855) -Codechange: Remove or move var declarations in DrawVehicleRefitWindow().
This commit is contained in:
parent
11e1d3b47c
commit
af60e61b20
@ -247,27 +247,25 @@ static RefitList *BuildRefitList(const Vehicle *v)
|
|||||||
*/
|
*/
|
||||||
static RefitOption *DrawVehicleRefitWindow(const RefitList *list, int sel, uint pos, uint rows, uint delta, uint right)
|
static RefitOption *DrawVehicleRefitWindow(const RefitList *list, int sel, uint pos, uint rows, uint delta, uint right)
|
||||||
{
|
{
|
||||||
RefitOption *refit = list->items;
|
|
||||||
RefitOption *selected = NULL;
|
RefitOption *selected = NULL;
|
||||||
uint num_lines = list->num_lines;
|
|
||||||
uint y = 31;
|
uint y = 31;
|
||||||
uint i;
|
|
||||||
|
|
||||||
/* Draw the list, and find the selected cargo (by its position in list) */
|
/* Draw the list, and find the selected cargo (by its position in list) */
|
||||||
for (i = 0; i < num_lines; i++) {
|
for (uint i = 0; i < list->num_lines; i++) {
|
||||||
TextColour colour = TC_BLACK;
|
TextColour colour = TC_BLACK;
|
||||||
|
RefitOption *refit = &list->items[i];
|
||||||
if (sel == 0) {
|
if (sel == 0) {
|
||||||
selected = &refit[i];
|
selected = refit;
|
||||||
colour = TC_WHITE;
|
colour = TC_WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= pos && i < pos + rows) {
|
if (i >= pos && i < pos + rows) {
|
||||||
/* Draw the cargo name */
|
/* Draw the cargo name */
|
||||||
int last_x = DrawString(2, right, y, CargoSpec::Get(refit[i].cargo)->name, colour);
|
int last_x = DrawString(2, right, y, CargoSpec::Get(refit->cargo)->name, colour);
|
||||||
|
|
||||||
/* If the callback succeeded, draw the cargo suffix */
|
/* If the callback succeeded, draw the cargo suffix */
|
||||||
if (refit[i].value != CALLBACK_FAILED) {
|
if (refit->value != CALLBACK_FAILED) {
|
||||||
DrawString(last_x + 1, right, y, GetGRFStringID(GetEngineGRFID(refit[i].engine), 0xD000 + refit[i].value), colour);
|
DrawString(last_x + 1, right, y, GetGRFStringID(GetEngineGRFID(refit->engine), 0xD000 + refit->value), colour);
|
||||||
}
|
}
|
||||||
y += delta;
|
y += delta;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user