diff --git a/TODO b/TODO index 8039cc5..b4d2b52 100644 --- a/TODO +++ b/TODO @@ -9,9 +9,6 @@ GAME - -* UI: enable remote game joining - -> implement `inform-user` * implement look/walk/attack modes @@ -35,7 +32,7 @@ * `terminate` hangs when a player is still logged in * world thread type error: "The value -1 is not of type unsigned-byte when binding - sb-impl::n" + sb-impl::n" -> if several players log on? -> NON-SEVERE diff --git a/TODO b/TODO index 8039cc5..b4d2b52 100644 --- a/TODO +++ b/TODO @@ -9,9 +9,6 @@ GAME - -* UI: enable remote game joining - -> implement `inform-user` * implement look/walk/attack modes @@ -35,7 +32,7 @@ * `terminate` hangs when a player is still logged in * world thread type error: "The value -1 is not of type unsigned-byte when binding - sb-impl::n" + sb-impl::n" -> if several players log on? -> NON-SEVERE diff --git a/client/crt-ext.lisp b/client/crt-ext.lisp index 077e376..3d64869 100644 --- a/client/crt-ext.lisp +++ b/client/crt-ext.lisp @@ -14,8 +14,8 @@ ;; I found croatoan's field/form to complicated to use (:form-default-keymap ;; doesn't seem to work), so I hacked up my own alternative ;; TODO display additional lines of text - (when cls (croatoan:clear scr)) - (croatoan:refresh scr) + (when cls (croatoan:clear scr) + (croatoan:refresh scr)) (let* ((x0 (- (halve (croatoan:.width scr)) (+ 5 (halve val-width)))) (y0 (- (halve (croatoan:.height scr)) 3)) (inputwin (make-instance 'croatoan:window :position (list y0 x0) @@ -49,16 +49,16 @@ :color-pair '(:blue :black)) (croatoan:refresh inputwin)))))) -(defun user-confirm-p (scr msg &optional (cls NIL)) - "Ask the user to confirm (Yes/No) a message." - (when cls (croatoan:clear scr)) - (croatoan:refresh scr) +(defun short-dialog (scr msg options &optional (cls NIL)) + "Present the user with one line of text and a few options" + (when cls (croatoan:clear scr) + (croatoan:refresh scr)) (let ((dw (make-instance 'croatoan:dialog-window :center t :border t :width (max 20 (+ 4 (length msg))) :max-item-length (max 4 (halve (length msg))) - :input-blocking t :layout '(1 2) + :input-blocking t :layout (list 1 (length options)) :message-height 1 :message-text msg - :items '(" Yes" " No")))) + :items options))) (croatoan:draw-menu dw) (croatoan:event-case (scr event) ((nil) nil) @@ -67,10 +67,13 @@ (croatoan:draw-menu dw)) (#\newline (return-from croatoan:event-case - (zerop (croatoan:.current-item-number dw))))))) + (croatoan:.current-item-number dw)))))) -(defun inform-user (scr msg) +(defun user-confirm-p (scr msg &optional (cls NIL)) + "Ask the user to confirm (Yes/No) a message." + (zerop (short-dialog scr msg '(" Yes" " No") cls))) + +(defun inform-user (scr msg &optional (cls NIL)) "Display an informational message to the user" - ;;TODO - ) + (short-dialog scr msg '(" OK ") cls)) diff --git a/TODO b/TODO index 8039cc5..b4d2b52 100644 --- a/TODO +++ b/TODO @@ -9,9 +9,6 @@ GAME - -* UI: enable remote game joining - -> implement `inform-user` * implement look/walk/attack modes @@ -35,7 +32,7 @@ * `terminate` hangs when a player is still logged in * world thread type error: "The value -1 is not of type unsigned-byte when binding - sb-impl::n" + sb-impl::n" -> if several players log on? -> NON-SEVERE diff --git a/client/crt-ext.lisp b/client/crt-ext.lisp index 077e376..3d64869 100644 --- a/client/crt-ext.lisp +++ b/client/crt-ext.lisp @@ -14,8 +14,8 @@ ;; I found croatoan's field/form to complicated to use (:form-default-keymap ;; doesn't seem to work), so I hacked up my own alternative ;; TODO display additional lines of text - (when cls (croatoan:clear scr)) - (croatoan:refresh scr) + (when cls (croatoan:clear scr) + (croatoan:refresh scr)) (let* ((x0 (- (halve (croatoan:.width scr)) (+ 5 (halve val-width)))) (y0 (- (halve (croatoan:.height scr)) 3)) (inputwin (make-instance 'croatoan:window :position (list y0 x0) @@ -49,16 +49,16 @@ :color-pair '(:blue :black)) (croatoan:refresh inputwin)))))) -(defun user-confirm-p (scr msg &optional (cls NIL)) - "Ask the user to confirm (Yes/No) a message." - (when cls (croatoan:clear scr)) - (croatoan:refresh scr) +(defun short-dialog (scr msg options &optional (cls NIL)) + "Present the user with one line of text and a few options" + (when cls (croatoan:clear scr) + (croatoan:refresh scr)) (let ((dw (make-instance 'croatoan:dialog-window :center t :border t :width (max 20 (+ 4 (length msg))) :max-item-length (max 4 (halve (length msg))) - :input-blocking t :layout '(1 2) + :input-blocking t :layout (list 1 (length options)) :message-height 1 :message-text msg - :items '(" Yes" " No")))) + :items options))) (croatoan:draw-menu dw) (croatoan:event-case (scr event) ((nil) nil) @@ -67,10 +67,13 @@ (croatoan:draw-menu dw)) (#\newline (return-from croatoan:event-case - (zerop (croatoan:.current-item-number dw))))))) + (croatoan:.current-item-number dw)))))) -(defun inform-user (scr msg) +(defun user-confirm-p (scr msg &optional (cls NIL)) + "Ask the user to confirm (Yes/No) a message." + (zerop (short-dialog scr msg '(" Yes" " No") cls))) + +(defun inform-user (scr msg &optional (cls NIL)) "Display an informational message to the user" - ;;TODO - ) + (short-dialog scr msg '(" OK ") cls)) diff --git a/client/user-interface.lisp b/client/user-interface.lisp index 0dcfd95..b779719 100644 --- a/client/user-interface.lisp +++ b/client/user-interface.lisp @@ -126,7 +126,7 @@ (upass (query-user scr "Password:" :cls T)) (reply (query-server "login" uname upass ':ignore-errors))) (cond ((search "bad password" reply) - (inform-user scr "Bad password!") ;;TODO Not yet implemented! + (inform-user scr "Bad password!" T) (start-or-connect-to-server scr)) ((search "nonexistent player" reply) (if (user-confirm-p scr "This player doesn't exist. Create?" T) diff --git a/TODO b/TODO index 8039cc5..b4d2b52 100644 --- a/TODO +++ b/TODO @@ -9,9 +9,6 @@ GAME - -* UI: enable remote game joining - -> implement `inform-user` * implement look/walk/attack modes @@ -35,7 +32,7 @@ * `terminate` hangs when a player is still logged in * world thread type error: "The value -1 is not of type unsigned-byte when binding - sb-impl::n" + sb-impl::n" -> if several players log on? -> NON-SEVERE diff --git a/client/crt-ext.lisp b/client/crt-ext.lisp index 077e376..3d64869 100644 --- a/client/crt-ext.lisp +++ b/client/crt-ext.lisp @@ -14,8 +14,8 @@ ;; I found croatoan's field/form to complicated to use (:form-default-keymap ;; doesn't seem to work), so I hacked up my own alternative ;; TODO display additional lines of text - (when cls (croatoan:clear scr)) - (croatoan:refresh scr) + (when cls (croatoan:clear scr) + (croatoan:refresh scr)) (let* ((x0 (- (halve (croatoan:.width scr)) (+ 5 (halve val-width)))) (y0 (- (halve (croatoan:.height scr)) 3)) (inputwin (make-instance 'croatoan:window :position (list y0 x0) @@ -49,16 +49,16 @@ :color-pair '(:blue :black)) (croatoan:refresh inputwin)))))) -(defun user-confirm-p (scr msg &optional (cls NIL)) - "Ask the user to confirm (Yes/No) a message." - (when cls (croatoan:clear scr)) - (croatoan:refresh scr) +(defun short-dialog (scr msg options &optional (cls NIL)) + "Present the user with one line of text and a few options" + (when cls (croatoan:clear scr) + (croatoan:refresh scr)) (let ((dw (make-instance 'croatoan:dialog-window :center t :border t :width (max 20 (+ 4 (length msg))) :max-item-length (max 4 (halve (length msg))) - :input-blocking t :layout '(1 2) + :input-blocking t :layout (list 1 (length options)) :message-height 1 :message-text msg - :items '(" Yes" " No")))) + :items options))) (croatoan:draw-menu dw) (croatoan:event-case (scr event) ((nil) nil) @@ -67,10 +67,13 @@ (croatoan:draw-menu dw)) (#\newline (return-from croatoan:event-case - (zerop (croatoan:.current-item-number dw))))))) + (croatoan:.current-item-number dw)))))) -(defun inform-user (scr msg) +(defun user-confirm-p (scr msg &optional (cls NIL)) + "Ask the user to confirm (Yes/No) a message." + (zerop (short-dialog scr msg '(" Yes" " No") cls))) + +(defun inform-user (scr msg &optional (cls NIL)) "Display an informational message to the user" - ;;TODO - ) + (short-dialog scr msg '(" OK ") cls)) diff --git a/client/user-interface.lisp b/client/user-interface.lisp index 0dcfd95..b779719 100644 --- a/client/user-interface.lisp +++ b/client/user-interface.lisp @@ -126,7 +126,7 @@ (upass (query-user scr "Password:" :cls T)) (reply (query-server "login" uname upass ':ignore-errors))) (cond ((search "bad password" reply) - (inform-user scr "Bad password!") ;;TODO Not yet implemented! + (inform-user scr "Bad password!" T) (start-or-connect-to-server scr)) ((search "nonexistent player" reply) (if (user-confirm-p scr "This player doesn't exist. Create?" T) diff --git a/params.lisp b/params.lisp index fc36dc7..3b1f3fa 100644 --- a/params.lisp +++ b/params.lisp @@ -28,7 +28,7 @@ (defparameter *framerate* 1000) ;;Localhost defaults -(defparameter *defaulthost* '("127.0.0.1" 21887)) ;default port: 21895 +(defparameter *defaulthost* '("127.0.0.1" 21895)) ;default port: 21895 ;;Host server address to connect to - XXX global variable! (defparameter *host* (first *defaulthost*))