(svn r5399) Simplify a conditional expression: (a && b) || (!a && !b) -> a == b
authortron
Wed, 28 Jun 2006 06:21:03 +0000
changeset 4084 318905f3d768
parent 4083 09ca2e8a41ea
child 4085 83aeb382423e
(svn r5399) Simplify a conditional expression: (a && b) || (!a && !b) -> a == b
vehicle_gui.c
--- a/vehicle_gui.c	Wed Jun 28 06:17:41 2006 +0000
+++ b/vehicle_gui.c	Wed Jun 28 06:21:03 2006 +0000
@@ -538,9 +538,8 @@
 				const EngineInfo* info = EngInfo(eid);
 
 				// left window contains compatible engines while right window only contains engines of the selected type
-				if (ENGINE_AVAILABLE && (
-							(RailVehInfo(eid)->power != 0 && WP(w, replaceveh_d).wagon_btnstate) ||
-							(RailVehInfo(eid)->power == 0 && !WP(w, replaceveh_d).wagon_btnstate))) {
+				if (ENGINE_AVAILABLE &&
+						(RailVehInfo(eid)->power != 0) == (WP(w, replaceveh_d).wagon_btnstate != 0)) {
 					if (IsCompatibleRail(e->railtype, railtype) && (_player_num_engines[eid] > 0 || EngineHasReplacementForPlayer(p, eid))) {
 						if (sel[0] == count) selected_id[0] = eid;
 						count++;