Browse Source

fix chip compiler type.endsWith('ORGate') check that matched XOR gates too

Michael Schubmehl 5 years ago
parent
commit
cab7aba49e
1 changed files with 7 additions and 7 deletions
  1. 7
    7
      src/com/droidquest/chipstuff/ChipCompiler.java

+ 7
- 7
src/com/droidquest/chipstuff/ChipCompiler.java View File

@@ -48,22 +48,22 @@ public ChipCompiler(PrototypeChip pc, SmallChip sc)
48 48
 		    Device device = (Device) item;
49 49
 		    Gate gate=null;
50 50
 		    String type = item.getClass().toString();
51
-		    if (type.endsWith("ANDGate"))
51
+		    if (device instanceof com.droidquest.devices.ANDGate)
52 52
 		      gate = new Gate("AND");
53
-		    if (type.endsWith("ORGate"))
53
+		    if (device instanceof com.droidquest.devices.ORGate)
54 54
 		      gate = new Gate("OR");
55
-		    if (type.endsWith("NOTGate"))
55
+		    if (device instanceof com.droidquest.devices.NOTGate)
56 56
 		      gate = new Gate("NOT");
57
-		    if (type.endsWith("XORGate"))
57
+		    if (device instanceof com.droidquest.devices.XORGate)
58 58
 		      gate = new Gate("XOR");
59
-		    if (type.endsWith("FlipFlop"))
59
+		    if (device instanceof com.droidquest.devices.FlipFlop)
60 60
 		      {
61 61
 			 gate = new Gate("FF");
62 62
 			 gate.state = ((FlipFlop)device).state;
63 63
 		      }
64
-		    if (type.endsWith("Node"))
64
+		    if (device instanceof com.droidquest.devices.Node)
65 65
 		      gate = new Gate("NODE");
66
-		    if (type.endsWith("SmallChip"))
66
+		    if (device instanceof com.droidquest.devices.SmallChip)
67 67
 		      gate = new Gate((SmallChip)device);
68 68
 		    if (gate != null)
69 69
 		      {

Loading…
Cancel
Save