Move location onto game-actor
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 30 Apr 2016 22:34:54 +0000 (17:34 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 30 Apr 2016 22:34:54 +0000 (17:34 -0500)
mudsync.scm

index cdc03fd3d408f7dc1dc2e164adbba1e46b50fea2..05276a7987c186422a010d60f7ea6e9bfa9c4e85 100644 (file)
@@ -378,6 +378,10 @@ with an anonymous persona"
 ;;; And all of them need a GM!
 
 (define-class <game-actor> (<actor>)
+  ;; location id
+  (loc #:init-value #f
+       #:accessor game-actor-loc)
+  ;; game master id
   (gm #:init-keyword #:gm
       #:getter game-actor-gm))
 
@@ -476,9 +480,6 @@ claim to point to."
 (define-class <player> (<game-actor>)
   (username #:init-keyword #:username
             #:accessor player-username)
-  ;; location id
-  (loc #:init-value #f
-       #:accessor player-loc)
   ;; Connection id
   (client #:accessor player-client)
 
@@ -491,9 +492,9 @@ claim to point to."
 ;;; player message handlers
 
 (define-mhandler (player-set-loc! player message id)
-  (format #t "DEBUG: Location set to ~s for player ~s"
+  (format #t "DEBUG: Location set to ~s for player ~s\n"
           id (actor-id-actor player))
-  (set! (player-loc player) id))
+  (set! (game-actor-loc player) id))
 
 (define-mhandler (player-init! player message)
   (player-look-around player))
@@ -503,11 +504,11 @@ claim to point to."
 (define (player-look-around player)
   (define room-name
     (message-ref
-     (<-wait player (player-loc player) 'get-name)
+     (<-wait player (game-actor-loc player) 'get-name)
      'val))
   (define room-desc
     (message-ref
-     (<-wait player (player-loc player) 'get-desc)
+     (<-wait player (game-actor-loc player) 'get-desc)
      'val))
   (define message-text
     (format #f "**~a**\n~a\n" room-name room-desc))