summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-01-23 01:00:56 +0000
committerbjarni <bjarni@openttd.org>2007-01-23 01:00:56 +0000
commit8c3e4ead656b2a7a82fe52b5caeccb3be8e15318 (patch)
tree30d6c0fc047b56608f8691e7ffcd5cf8c42f2087
parent97effdcb9627aca0110f7dae3007188b74897634 (diff)
downloadopenttd-8c3e4ead656b2a7a82fe52b5caeccb3be8e15318.tar.xz
(svn r8364) -Codechange (r8362): added an assert to catch conditions where a request wants to draw more vehicles than the list contains
-rw-r--r--src/build_vehicle_gui.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 57405f47f..ca4a4498d 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -739,7 +739,7 @@ static void DrawVehicleEngine(byte type, int x, int y, EngineID engine, SpriteID
* @param x,y Where should the list start
* @param eng_list What engines to draw
* @param min where to start in the list
- * @param max where in the list to end. MAKE SURE THAT THIS IS NOT LONGER THAN THE ENGINE LIST ITSELF!
+ * @param max where in the list to end
* @param selected_id what engine to highlight as selected, if any
*/
static void DrawEngineList(byte type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id)
@@ -748,6 +748,8 @@ static void DrawEngineList(byte type, int x, int y, const EngineList eng_list, u
byte x_offset = 0;
byte y_offset = 0;
+ assert(max <= EngList_Count(&eng_list));
+
switch (type) {
case VEH_Train:
x++; // train and road vehicles use the same offset, except trains are one more pixel to the right