Fixes bug in moving game objects

Chris Pollett [2023-01-30 06:Jan:th]
Fixes bug in moving game objects
Filename
js/game.js
diff --git a/js/game.js b/js/game.js
index eac738d..3bbeee0 100644
--- a/js/game.js
+++ b/js/game.js
@@ -1336,8 +1336,8 @@ class Game
         if (move_object.hasOwnProperty("position")) {
             let old_position = move_object.position;
             let old_location = this.locations[old_position];
-            old_location.items.filter((value) => {
-                value != object_id;
+            old_location.items = old_location.items.filter((value) => {
+                return value != object_id;
             });
         }
         move_object.position = destination_id;
@@ -1387,6 +1387,10 @@ class Game
             this.nextHistory();
             return false;
         }
+        let mc = obj('main-character');
+        if (mc.position != mc.destination) {
+            mc.old_position = mc.position;
+        }
         this.moveObject('main-character', destination);
         return true;
     }
ViewGit