(svn r1358) Assert bounds of depot list when searching for a depot
authortron
Mon, 03 Jan 2005 22:07:40 +0000
changeset 877 a0849f41e748
parent 876 d275d6d2aa65
child 878 8f4f2ef6f674
(svn r1358) Assert bounds of depot list when searching for a depot
roadveh_gui.c
ship_gui.c
train_gui.c
--- a/roadveh_gui.c	Mon Jan 03 22:04:34 2005 +0000
+++ b/roadveh_gui.c	Mon Jan 03 22:07:40 2005 +0000
@@ -512,7 +512,9 @@
 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
 
 	/* locate the depot struct */
-	for(d=_depots; d->xy != (TileIndex)tile; d++) {}
+	for (d = _depots; d->xy != (TileIndex)tile; d++) {
+		assert(d < endof(_depots);
+	}
 
 	SetDParam(0, d->town_index);
 	DrawWindowWidgets(w);
--- a/ship_gui.c	Mon Jan 03 22:04:34 2005 +0000
+++ b/ship_gui.c	Mon Jan 03 22:07:40 2005 +0000
@@ -646,7 +646,9 @@
 	SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap);
 
 	/* locate the depot struct */
-	for(d=_depots; d->xy != (TileIndex)tile; d++) {}
+	for (d = _depots; d->xy != (TileIndex)tile; d++) {
+		assert(d < endof(_depots);
+	}
 
 	SetDParam(0, d->town_index);
 	DrawWindowWidgets(w);
--- a/train_gui.c	Mon Jan 03 22:04:34 2005 +0000
+++ b/train_gui.c	Mon Jan 03 22:07:40 2005 +0000
@@ -333,7 +333,9 @@
 	SetHScrollCount(w, hnum);
 
 	/* locate the depot struct */
-	for(d=_depots; d->xy != (TileIndex)tile; d++) {}
+	for (d = _depots; d->xy != (TileIndex)tile; d++) {
+		assert(d < endof(_depots);
+	}
 
 	SetDParam(0, d->town_index);
 	DrawWindowWidgets(w);