summaryrefslogtreecommitdiff
path: root/Gate.cpp
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-25 20:21:31 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-25 20:21:31 +0930
commite94e0492774134f171cded42f03ebe4e892122b0 (patch)
tree18e18fa06eead723185d6d5cebf1d06a078dfa91 /Gate.cpp
parentc40dfb1f7e12f3d127ff8851dc3c7276840a5b81 (diff)
downloadfoxlogicgates-e94e0492774134f171cded42f03ebe4e892122b0.tar.gz
foxlogicgates-e94e0492774134f171cded42f03ebe4e892122b0.zip
functionality: implement loading xml file saved.
Diffstat (limited to 'Gate.cpp')
-rw-r--r--Gate.cpp9
1 files changed, 7 insertions, 2 deletions
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;