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

This commit is contained in:
Michael Schubmehl 2014-02-08 14:04:23 -06:00
parent b7cbd94232
commit cab7aba49e

View File

@ -48,22 +48,22 @@ public ChipCompiler(PrototypeChip pc, SmallChip sc)
Device device = (Device) item; Device device = (Device) item;
Gate gate=null; Gate gate=null;
String type = item.getClass().toString(); String type = item.getClass().toString();
if (type.endsWith("ANDGate")) if (device instanceof com.droidquest.devices.ANDGate)
gate = new Gate("AND"); gate = new Gate("AND");
if (type.endsWith("ORGate")) if (device instanceof com.droidquest.devices.ORGate)
gate = new Gate("OR"); gate = new Gate("OR");
if (type.endsWith("NOTGate")) if (device instanceof com.droidquest.devices.NOTGate)
gate = new Gate("NOT"); gate = new Gate("NOT");
if (type.endsWith("XORGate")) if (device instanceof com.droidquest.devices.XORGate)
gate = new Gate("XOR"); gate = new Gate("XOR");
if (type.endsWith("FlipFlop")) if (device instanceof com.droidquest.devices.FlipFlop)
{ {
gate = new Gate("FF"); gate = new Gate("FF");
gate.state = ((FlipFlop)device).state; gate.state = ((FlipFlop)device).state;
} }
if (type.endsWith("Node")) if (device instanceof com.droidquest.devices.Node)
gate = new Gate("NODE"); gate = new Gate("NODE");
if (type.endsWith("SmallChip")) if (device instanceof com.droidquest.devices.SmallChip)
gate = new Gate((SmallChip)device); gate = new Gate((SmallChip)device);
if (gate != null) if (gate != null)
{ {