diff options
-rw-r--r-- | MainWindow.cpp | 10 | ||||
-rw-r--r-- | Object.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/MainWindow.cpp b/MainWindow.cpp index 19012ec..9de495a 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -507,11 +507,12 @@ void MainWindow::update_object_state(Object *object) { object->update_state(); - /* update all gates that are using this gate as an input */ - Gate *object2; - for(auto o = object->get_output_objects()->begin(); o != object->get_output_objects()->end(); ++o) + /* update all objects that are using this object as an input */ + Object *object2; + auto output_objects = object->get_output_objects(); + for(auto o = output_objects->begin(); o != output_objects->end(); ++o) { - object2 = (Gate*)find_object_by_id((*o)); + object2 = find_object_by_id((*o)); if (object2) { update_object_state(object2); @@ -519,6 +520,7 @@ MainWindow::update_object_state(Object *object) } } + void MainWindow::find_selected_input(int x, int y) { @@ -55,7 +55,7 @@ class Object void add_output_object_id(int id_) { this->output_object_ids.push_back(id_); }; - virtual void update_state() {}; // subclasses must implement + virtual void update_state() = 0; // subclasses must implement static void set_object_id_counter(int id_) { object_id_counter = id_; }; static int get_object_id_counter() { return object_id_counter; }; |