From f81202d509bebf98a986113c1b7a087cd32c43d8 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Wed, 24 Jun 2020 13:00:30 +0930 Subject: logic: now recursively updates gates when a change is made by keeping track of all connected gates --- Gate.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Gate.cpp') 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 "?"; } - } -- cgit v1.2.3