picking up exhibits works again with the slot mechanism
authorJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 17 Jan 2018 14:42:03 +0000 (16:42 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Wed, 17 Jan 2018 14:42:03 +0000 (16:42 +0200)
src/app.cc

index 8865012..d4b516e 100644 (file)
@@ -648,17 +648,19 @@ void app_mouse_button(int bn, bool pressed, int x, int y)
                } else {
                        if(exsel_grab_mouse) {
                                // cancel grab on mouse release
-                               debug_log("releasing...\n");
                                Exhibit *ex = exsel_grab_mouse.ex;
                                Vec3 pos = exslot_mouse.node.get_position();
-                               debug_log("release location: %g %g %g\n", pos.x, pos.y, pos.z);
 
-                               ExhibitSlot *slot = exman->nearest_empty_slot(pos);
+                               debug_log("releasing at %g %g %g ...\n", pos.x, pos.y, pos.z);
+
+                               exslot_mouse.detach_exhibit();
+
+                               ExhibitSlot *slot = exman->nearest_empty_slot(pos, 100);
                                if(!slot) {
-                                       debug_log("no nearby slot\n");
+                                       debug_log("no empty slot nearby\n");
                                        if(ex->prev_slot && ex->prev_slot->empty()) {
                                                slot = ex->prev_slot;
-                                               debug_log("previous slot available though\n");
+                                               debug_log("using previous slot");
                                        }
                                }