diff options
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; |