# HG changeset patch # User bjarni # Date 1169514056 0 # Node ID bec24ee21ccb62d879bf4f3af2eb08f96d9a4b69 # Parent 3dc4c609852c3d7e3ae18a2c8cd1512a46db1b31 (svn r8364) -Codechange (r8362): added an assert to catch conditions where a request wants to draw more vehicles than the list contains diff -r 3dc4c609852c -r bec24ee21ccb src/build_vehicle_gui.cpp --- a/src/build_vehicle_gui.cpp Tue Jan 23 00:04:17 2007 +0000 +++ b/src/build_vehicle_gui.cpp Tue Jan 23 01:00:56 2007 +0000 @@ -739,7 +739,7 @@ * @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 @@ 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