Only change location when it isn't the same as current location
authorChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 10 May 2016 04:09:10 +0000 (23:09 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Tue, 10 May 2016 04:09:10 +0000 (23:09 -0500)
mudsync/gameobj.scm

index 9d4a91380a660c04f0106e8dd557d9f669aa871f..9046520bbb9ba7dc396dcfa4bec301117f85f716 100644 (file)
@@ -262,12 +262,13 @@ Assists in its replacement of occupants if necessary and nothing else."
   (format #t "DEBUG: Location set to ~s for ~s\n"
           loc (actor-id-actor gameobj))
 
-  (slot-set! gameobj 'loc loc)
-  ;; Change registation of where we currently are
-  (if loc
-      (<-wait gameobj loc 'add-occupant! #:who (actor-id gameobj)))
-  (if old-loc
-      (<-wait gameobj old-loc 'remove-occupant! #:who (actor-id gameobj))))
+  (when (not (equal? old-loc loc))
+    (slot-set! gameobj 'loc loc)
+    ;; Change registation of where we currently are
+    (if old-loc
+        (<-wait gameobj old-loc 'remove-occupant! #:who (actor-id gameobj)))
+    (if loc
+        (<-wait gameobj loc 'add-occupant! #:who (actor-id gameobj)))))
 
 ;; @@: Should it really be #:id ?  Maybe #:loc-id or #:loc?
 (define-mhandler (gameobj-act-set-loc! actor message loc)