summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jones <admin@danieljon.es>2020-06-26 23:25:28 +0930
committerDaniel Jones <admin@danieljon.es>2020-06-26 23:25:28 +0930
commit2dcc781681c73732fda1f9b4fb1bfefa833af58e (patch)
tree328460029c27271917c8842861400d92888b6f7b
parent046f19bc46bfd76de83c7a85d7651e07936ef1e4 (diff)
downloadfoxlogicgates-2dcc781681c73732fda1f9b4fb1bfefa833af58e.tar.gz
foxlogicgates-2dcc781681c73732fda1f9b4fb1bfefa833af58e.zip
Logic: inputs can no longer be connected to inputs
-rw-r--r--MainWindow.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/MainWindow.cpp b/MainWindow.cpp
index 40bb384..01d14ef 100644
--- a/MainWindow.cpp
+++ b/MainWindow.cpp
@@ -732,14 +732,14 @@ MainWindow::on_left_mouse_up(FXObject*, FXSelector, void *ptr)
gate = find_gate_at(ev->last_x, ev->last_y);
if (gate == selected_gate) /* gates cannot connect to themselves, probably */
return 1;
- if (gate)
+ if (gate && gate->get_gate_type() != Gate::INPUT)
{
int input = -1;
if (ev->last_y-gate->get_y() <= gate->get_height()/2)
input = 1;
else
input = 2;
- if (gate->get_gate_type() != Gate::NOT && gate->get_gate_type() && gate->get_gate_type() != Gate::OUTPUT)
+ if (gate->get_gate_type() != Gate::NOT && gate->get_gate_type() != Gate::OUTPUT)
{
printf("connecting gate %d with gate %d at input #%d\n", selected_gate->get_id(), gate->get_id(), input);
if (input == 1)