diff options
author | Daniel Jones <admin@danieljon.es> | 2020-06-25 20:21:31 +0930 |
---|---|---|
committer | Daniel Jones <admin@danieljon.es> | 2020-06-25 20:21:31 +0930 |
commit | e94e0492774134f171cded42f03ebe4e892122b0 (patch) | |
tree | 18e18fa06eead723185d6d5cebf1d06a078dfa91 /Gate.cpp | |
parent | c40dfb1f7e12f3d127ff8851dc3c7276840a5b81 (diff) | |
download | foxlogicgates-e94e0492774134f171cded42f03ebe4e892122b0.tar.gz foxlogicgates-e94e0492774134f171cded42f03ebe4e892122b0.zip |
functionality: implement loading xml file saved.
Diffstat (limited to 'Gate.cpp')
-rw-r--r-- | Gate.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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; |