]> git.pond.sub.org Git - eow/blobdiff - empire.lisp
Comment class stub
[eow] / empire.lisp
index fba1e028887e52b21e0c3ca918d4efe54cb83de1..2f3452e3af8113b120fd87fd0a6873c70231ae7e 100644 (file)
       (cons (let ((message (car next-event))
                  (mode (cdr next-event)))
              (send-message-one c message)
       (cons (let ((message (car next-event))
                  (mode (cdr next-event)))
              (send-message-one c message)
-             (set-new-mode c mode))))))
+             (set-new-mode (connection-mode c) mode))))))
+
+(defun read-no-eval (stream)
+  (let ((*read-eval* nil))
+    (read stream)))
 
 (defmethod handle-prompt ((m play-mode) message)
   (let* ((c (connection m)))
     (with-input-from-string (s message)
 
 (defmethod handle-prompt ((m play-mode) message)
   (let* ((c (connection m)))
     (with-input-from-string (s message)
-      (let* ((minutes (read s)) ;;FIXME DANGEROUS
-            (btus (read s)))
+      (let* ((minutes (read-no-eval s))
+            (btus (read-no-eval s)))
        (empire-web:prompt (session c)
                           (format nil "[~a,~a]: " minutes btus))))
     (send-next-line c)))
        (empire-web:prompt (session c)
                           (format nil "[~a,~a]: " minutes btus))))
     (send-next-line c)))
   (and (> (length line) 0)
        (char= +special-command-char+ (aref line 0))))
 
   (and (> (length line) 0)
        (char= +special-command-char+ (aref line 0))))
 
+(defclass xdump-mode (play-mode)
+  ((table-buffer
+    :initform nil
+    :accessor table-buffer
+    :documentation "Intermediate storage for incomplete table dump.")))
+
+(defmethod handle-data ((m xdump-mode) message)
+  (with-slots (connection table-buffer) m
+    (if (char= #\/ (aref message 0))
+       (progn
+         (format t "table: ~a~%" table-buffer)
+         (set-new-mode m 'play-mode)))
+                                       ;XXX check table size
+    (with-input-from-string (s (format nil "(~a)" message))
+      (setf table-buffer (cons (read s) table-buffer)))))
+
 (defmethod special-xup ((c connection))
 (defmethod special-xup ((c connection))
-  t)
+  (send-message c "xdump meta meta" :next-mode 'xdump-mode))
 
 (defmethod special-command ((c connection) line)
   (cond ((string= line "xup") (special-xup c))
 
 (defmethod special-command ((c connection) line)
   (cond ((string= line "xup") (special-xup c))