summaryrefslogtreecommitdiff
path: root/Gate.cpp
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-24 21:24:22 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-24 21:24:22 +0930
commit91aff1783d364f3f2c814a90ec292cb89d5deb88 (patch)
tree464d2c2adcf8977c1e3a355783194a50fca7d136 /Gate.cpp
parent19c61272bde25dbf1991bcb3ad31d173cda92df2 (diff)
downloadfoxlogicgates-91aff1783d364f3f2c814a90ec292cb89d5deb88.tar.gz
foxlogicgates-91aff1783d364f3f2c814a90ec292cb89d5deb88.zip
functionality: implemented deleting selected gate with the delete key.
Diffstat (limited to 'Gate.cpp')
-rw-r--r--Gate.cpp17
1 files changed, 16 insertions, 1 deletions
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)