summaryrefslogtreecommitdiff
path: root/Gate.cpp
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-24 13:00:30 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-24 13:00:30 +0930
commitf81202d509bebf98a986113c1b7a087cd32c43d8 (patch)
tree2c444ea686cae6b641f79807b0f3a4d4f0f6652b /Gate.cpp
parent167e63926ec8b06511bc03a897731c17e4564719 (diff)
downloadfoxlogicgates-f81202d509bebf98a986113c1b7a087cd32c43d8.tar.gz
foxlogicgates-f81202d509bebf98a986113c1b7a087cd32c43d8.zip
logic: now recursively updates gates when a change is made by keeping track of all connected gates
Diffstat (limited to 'Gate.cpp')
-rw-r--r--Gate.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/Gate.cpp b/Gate.cpp
index 9ffa50d..a0ac6ea 100644
--- a/Gate.cpp
+++ b/Gate.cpp
@@ -32,6 +32,20 @@ Gate::Gate(GATE_TYPE type, int x, int y, int width, int height)
Gate::~Gate() {}
+void
+Gate::remove_output_gate_id(int id)
+{
+ int pos = 0;
+ for(auto g = output_gate_ids.begin(); g != output_gate_ids.end(); ++g)
+ {
+ if (id == (*g))
+ {
+ output_gate_ids.erase(output_gate_ids.begin() + pos);
+ }
+ pos++;
+ }
+}
+
void Gate::update_state()
{
switch (this->gate_type)
@@ -116,6 +130,7 @@ void Gate::update_state()
break;
}
}
+
std::string
Gate::get_output_type_text()
{
@@ -176,7 +191,6 @@ Gate::get_output_type_text()
default:
return "?";
}
-
}