Move game-master methods beneath it, use wrap-apply on them
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 30 Apr 2016 02:44:54 +0000 (21:44 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sat, 30 Apr 2016 02:44:54 +0000 (21:44 -0500)
mudsync.scm

index 544dc3a426b993c9d1df9aeace96d9bebc441307..fca151a60aabcef226a5e80146b6d0f4c5c66ed9 100644 (file)
 ;; (define-method (nm-close-port (nm <network-manager>)))
 
 
+\f
 ;;; The game master!  Runs the world.
 ;;; =================================
 
 ;; @@: We could call this a "world builder" instead...
 ;;   I kinda like calling it a GM though.
 
+(define-class <game-master> (<actor>)
+  ;; The directory is a "namespaced" directory of all "special" content
+  ;; in the game, identifiable by some special key.
+  ;; (The namespace is simply a cons of (namespace . special-symbol))
+  (directory #:init-thunk make-hash-table)
+  ;; A mapping of client ids to in-game actors
+  (client-to-actor #:init-thunk make-hash-table)
+  ;; Network manager
+  (network-manager #:accessor gm-network-manager
+                   #:init-val #f)
+
+  (message-handler
+   #:init-value
+   (make-action-dispatch
+    (init-world (wrap-apply gm-init-world))
+    (client-input (wrap-apply gm-handle-client-input)))))
+
+
 (define (gm-init-world gm message)
   ;; Load database
   ;;  TODO
       #:client client-id
       #:data "Thanks, we got it!\n"))
 
-(define-class <game-master> (<actor>)
-  ;; The directory is a "namespaced" directory of all "special" content
-  ;; in the game, identifiable by some special key.
-  ;; (The namespace is simply a cons of (namespace . special-symbol))
-  (directory #:init-thunk make-hash-table)
-  ;; A mapping of client ids to in-game actors
-  (client-to-actor #:init-thunk make-hash-table)
-  ;; Network manager
-  (network-manager #:accessor gm-network-manager
-                   #:init-val #f)
-
-  (message-handler
-   #:init-value
-   (make-action-dispatch
-    (init-world gm-init-world)
-    (client-input gm-handle-client-input))))
-
-
 (define-method (gm-setup-database (gm <game-master>))
   'TODO)