summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-10-24 18:27:21 +0000
committeralberth <alberth@openttd.org>2009-10-24 18:27:21 +0000
commitaf60e61b20447732804881c97f73c276d09dc96d (patch)
tree5d4625718f8e2e6c015850423f7d66bdbfa45d89 /src
parent11e1d3b47c653f3ab2663d9b652b2254d27201fb (diff)
downloadopenttd-af60e61b20447732804881c97f73c276d09dc96d.tar.xz
(svn r17855) -Codechange: Remove or move var declarations in DrawVehicleRefitWindow().
Diffstat (limited to 'src')
-rw-r--r--src/vehicle_gui.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 0e595ba5f..dd12a4cc7 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -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)
{
- RefitOption *refit = list->items;
RefitOption *selected = NULL;
- uint num_lines = list->num_lines;
uint y = 31;
- uint i;
/* 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;
+ RefitOption *refit = &list->items[i];
if (sel == 0) {
- selected = &refit[i];
+ selected = refit;
colour = TC_WHITE;
}
if (i >= pos && i < pos + rows) {
/* 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 (refit[i].value != CALLBACK_FAILED) {
- DrawString(last_x + 1, right, y, GetGRFStringID(GetEngineGRFID(refit[i].engine), 0xD000 + refit[i].value), colour);
+ if (refit->value != CALLBACK_FAILED) {
+ DrawString(last_x + 1, right, y, GetGRFStringID(GetEngineGRFID(refit->engine), 0xD000 + refit->value), colour);
}
y += delta;
}