From 901f16ca8dccc6d4e4037ae68dc0b7171b43478c Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 9 May 2016 23:09:10 -0500 Subject: [PATCH] Only change location when it isn't the same as current location --- mudsync/gameobj.scm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mudsync/gameobj.scm b/mudsync/gameobj.scm index 9d4a913..9046520 100644 --- a/mudsync/gameobj.scm +++ b/mudsync/gameobj.scm @@ -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) -- 2.31.1