Changeset - r2556:182249972e8b
[Not reviewed]
master
0 1 0
peter1138 - 18 years ago 2005-10-25 19:52:25
peter1138@openttd.org
(svn r3089) Fix possible issue with out-of-bounds array access in replace vehicle gui, and add brief commenting.
1 file changed with 12 insertions and 3 deletions:
0 comments (0 inline, 0 general)
vehicle_gui.c
Show inline comments
 
@@ -821,13 +821,22 @@ static void ReplaceVehicleWndProc(Window
 
					}
 
				}
 

	
 
				if ( selected_id[0] == selected_id[1] || p->engine_replacement[selected_id[0]] == selected_id[1]
 
					|| selected_id[0] == -1 || selected_id[1] == -1 )
 
				// Disable the "Start Replacing" button if:
 
				//    Either list is empty
 
				// or Both lists have the same vehicle selected
 
				// or The right list (new replacement) has the existing replacement vehicle selected
 
				if (selected_id[0] == -1 || selected_id[1] == -1 ||
 
						selected_id[0] == selected_id[1] ||
 
						p->engine_replacement[selected_id[0]] == selected_id[1])
 
					SETBIT(w->disabled_state, 4);
 
				else
 
					CLRBIT(w->disabled_state, 4);
 

	
 
				if (p->engine_replacement[selected_id[0]] == INVALID_ENGINE || selected_id[0] == -1)
 
				// Disable the "Stop Replacing" button if:
 
				//    The left list (existing vehicle) is empty
 
				// or The selected vehicle has no replacement set up
 
				if (selected_id[0] == -1 ||
 
						p->engine_replacement[selected_id[0]] == INVALID_ENGINE)
 
					SETBIT(w->disabled_state, 6);
 
				else
 
					CLRBIT(w->disabled_state, 6);
0 comments (0 inline, 0 general)