(svn r6920) - Codechange: Ignore refit options of an engine if it has no capacity.
authorpeter1138
Tue, 24 Oct 2006 07:10:37 +0000
changeset 4933 106e2a14ab3c
parent 4932 3567a3ec9d80
child 4934 5f937d83f3eb
(svn r6920) - Codechange: Ignore refit options of an engine if it has no capacity.
train_gui.c
vehicle_gui.c
--- a/train_gui.c	Mon Oct 23 21:39:15 2006 +0000
+++ b/train_gui.c	Tue Oct 24 07:10:37 2006 +0000
@@ -293,7 +293,7 @@
 
 	/* 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);
 }
 
 /**
--- a/vehicle_gui.c	Mon Oct 23 21:39:15 2006 +0000
+++ b/vehicle_gui.c	Tue Oct 24 07:10:37 2006 +0000
@@ -210,6 +210,9 @@
 		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 @@
 				}
 			}
 		}
-		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;