diff options
author | KUDr <KUDr@openttd.org> | 2006-11-16 13:59:26 +0000 |
---|---|---|
committer | KUDr <KUDr@openttd.org> | 2006-11-16 13:59:26 +0000 |
commit | 6587db1c98fbf2ab3834f62dc909e8bcf9db878d (patch) | |
tree | a4ad72916202290870b7db0e6963fe8f24de1d37 | |
parent | c32ba85700b221bff8b0646f1cdefc21dc12afbf (diff) | |
download | openttd-6587db1c98fbf2ab3834f62dc909e8bcf9db878d.tar.xz |
(svn r7167) -Fix: [FS#367] Crash: engine.h:194: RailVehInfo: Assertion (reported by skidd13)
-rw-r--r-- | train_gui.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/train_gui.c b/train_gui.c index 3f30d61b2..bd7956901 100644 --- a/train_gui.c +++ b/train_gui.c @@ -578,7 +578,9 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e) case BUILD_TRAIN_WIDGET_LIST: { uint i = ((e->we.click.pt.y - 26) / 14) + w->vscroll.pos; - if (i < (uint)(WP(w, buildvehicle_d).list_a_length + WP(w, buildvehicle_d).list_b_length)) { + uint num_items = (HASBIT(WP(w,buildvehicle_d).show_engine_button, 0) ? WP(w, buildvehicle_d).list_a_length : 0) + + (HASBIT(WP(w,buildvehicle_d).show_engine_button, 1) ? WP(w, buildvehicle_d).list_b_length : 0); + if (i < num_items) { if (i < WP(w, buildvehicle_d).list_a_length && HASBIT(WP(w,buildvehicle_d).show_engine_button, 0)) { WP(w,buildvehicle_d).sel_engine = WP(w, buildvehicle_d).list_a[i]; } else { |