summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-10-24 07:10:37 +0000
committerpeter1138 <peter1138@openttd.org>2006-10-24 07:10:37 +0000
commite965ac67b3175c74579e6c821505e5030c1762bc (patch)
tree71d6837c7c53b293dc08fc48732a21fcedb35e48
parent6b3abe6508a12a4673a4e0055690837174d5103f (diff)
downloadopenttd-e965ac67b3175c74579e6c821505e5030c1762bc.tar.xz
(svn r6920) - Codechange: Ignore refit options of an engine if it has no capacity.
-rw-r--r--train_gui.c2
-rw-r--r--vehicle_gui.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/train_gui.c b/train_gui.c
index 3b36d82dd..5aede8d97 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -293,7 +293,7 @@ void DrawTrainEnginePurchaseInfo(int x, int y, uint w, EngineID engine_number)
/* Additional text from NewGRF */
y += ShowAdditionalText(x, y, w, engine_number);
- y += ShowRefitOptionsList(x, y, w, engine_number);
+ if (rvi->capacity > 0) y += ShowRefitOptionsList(x, y, w, engine_number);
}
/**
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 5c9888134..b8c0e9da4 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -210,6 +210,9 @@ static RefitList *BuildRefitList(const Vehicle *v)
uint32 cmask = EngInfo(u->engine_type)->refit_mask;
byte callbackmask = EngInfo(u->engine_type)->callbackmask;
+ /* Skip this engine if it has no capacity */
+ if (u->cargo_cap == 0) continue;
+
/* Loop through all cargos in the refit mask */
for (cid = 0; cmask != 0 && num_lines < max_lines; cmask >>= 1, cid++) {
CargoID lcid;
@@ -274,8 +277,7 @@ static RefitList *BuildRefitList(const Vehicle *v)
}
}
}
- u = u->next;
- } while (v->type == VEH_Train && u != NULL && num_lines < max_lines);
+ } while (v->type == VEH_Train && (u = u->next) != NULL && num_lines < max_lines);
list->num_lines = num_lines;
list->items = refit;