From 91aff1783d364f3f2c814a90ec292cb89d5deb88 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Wed, 24 Jun 2020 21:24:22 +0930 Subject: functionality: implemented deleting selected gate with the delete key. --- Gate.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'Gate.cpp') diff --git a/Gate.cpp b/Gate.cpp index 70e55fe..89a5daa 100644 --- a/Gate.cpp +++ b/Gate.cpp @@ -40,7 +40,6 @@ Gate::remove_output_gate_id(int id) { if (id == (*g)) { - printf("%id = %d\n", id, *g); output_gate_ids.erase(output_gate_ids.begin() + pos); break; } @@ -48,6 +47,22 @@ Gate::remove_output_gate_id(int id) } } +void +Gate::remove_input_gate(int id) +{ + if (input_gate1) + { + if (input_gate1->get_id() == id) + input_gate1 = nullptr; + } + + if (input_gate2) + { + if (input_gate2->get_id() == id) + input_gate2 = nullptr; + } +} + void Gate::update_state() { switch (this->gate_type) -- cgit v1.2.3