From e94e0492774134f171cded42f03ebe4e892122b0 Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 25 Jun 2020 20:21:31 +0930 Subject: functionality: implement loading xml file saved. --- Gate.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Gate.cpp') diff --git a/Gate.cpp b/Gate.cpp index 89a5daa..dab8b7e 100644 --- a/Gate.cpp +++ b/Gate.cpp @@ -17,13 +17,18 @@ int Gate::gate_id_counter = 0; -Gate::Gate(GATE_TYPE type, int x, int y, int width, int height) +Gate::Gate(GATE_TYPE type, int x, int y, int width, int height, int loaded_id) { this->gate_type = type; this->input_gate1 = nullptr; this->input_gate2 = nullptr; //this->output_gate = nullptr; - this->id = Gate::gate_id_counter++; // increment counter after assigning + + /* special handing of id - if the gate is loaded from file the loaded_id will be set and we use that */ + if (loaded_id != -1) + this->id = loaded_id; + else + this->id = Gate::gate_id_counter++; // increment counter after assigning this->x = x; this->y = y; this->w = width; -- cgit v1.2.3