diff --git a/doc/TODO b/doc/TODO index 33cb6d5..de9b7ec 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,8 @@ LISP * fix (string-from-list) bug -* adjust main menu to accomodate many users - +* update manual to reflect new main menu + ATL * make instructions more explicit * add track/foot prints leading to CR diff --git a/doc/TODO b/doc/TODO index 33cb6d5..de9b7ec 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,8 @@ LISP * fix (string-from-list) bug -* adjust main menu to accomodate many users - +* update manual to reflect new main menu + ATL * make instructions more explicit * add track/foot prints leading to CR diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 86f94a7..04d0543 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -7,7 +7,7 @@ ;;; date: 09/05/2015 ;;; -(defconstant ATLANTIS-VERSION '(0 2 5)) +(defconstant ATLANTIS-VERSION '(0 2 6)) (load "util.lisp") (load "game-objects.lisp") @@ -28,29 +28,30 @@ (first ATLANTIS-VERSION) (second ATLANTIS-VERSION) (third ATLANTIS-VERSION)) - (format t "~&Copyright (c) 2015-2017 Daniel Vedder") + (format t "~&Copyright (c) 2015-2018 Daniel Vedder") (format t "~&Licensed under the terms of the GNU GPLv3.") (format t "~&www.github.com/atlantis~%")) (defun start-menu () "Show the start menu and take a choice from the user" (clear-screen) + ;; Display the Atlantis ASCII-banner and a message of the day + ;; (the latter is optional and intended for use on the server) (print-text-file "banner.txt") - (format t "~&~%Welcome! What do you want to do?") - (setf options '("Start a new game" "Load a saved game" - "Help" "About" "Exit")) - (case (choose-number-option options) - (0 (new-game)) - (1 (format t "~&What game file do you want to load?") - ;; choose a previously saved game - (let ((game (choose-option (append (mapcar #'pathname-name - (directory "../saves/*")) - '("Back"))))) - (if (equalp game "Back") (start-menu) - (progn (setf game (concatenate 'string "../saves/" - game ".world")) - (load-game game) - (play-game))))) + (print-text-file "../motd.txt") + ;; The actual menu + (format t "~&~%Greetings! Please choose an option:") + (case (choose-number-option '("Start playing" "Show player list" + "Read the help file" + "About Atlantis" "Exit")) + (0 (start-playing)) + (1 (let ((users (mapcar #'pathname-name (directory "../saves/*")))) + (format t "~&~A" (string-from-list users :sep #\Newline)) + (format t "~&~%Currently, there are ~S players." + (length users))) + (format t "~&~%Please press ENTER") + (read-line) + (start-menu)) (2 (clear-screen) (pager "../doc/PLAYING" T) (start-menu)) @@ -61,21 +62,30 @@ (4 (format t "~&Goodbye!") (quit)))) -(defun new-game () - "Set up a new game." - ;; ask the player for his/her name +(defun start-playing () + "Ask the player for his name, then start a new game or load a saved game." (setf player-name "") (while (zerop (length player-name)) (format t "~&What is your name? ") (setf player-name (read-line))) - (if (and (member player-name - (mapcar #'pathname-name (directory "../saves/*")) - :test #'equalp) - (not (yes-or-no-p "A game by this player already exists. Replace it?"))) - (start-menu) - (setf (world-player-name *world*) player-name)) + (setf (world-player-name *world*) player-name) + (if (member player-name (mapcar #'pathname-name (directory "../saves/*")) + :test #'equalp) + (progn (format t "~&Welcome back, ~A! What do you want to do?" player-name) + (case (choose-number-option + '("Load your previous game" "Start a new game" "Go back")) + (0 (load-game player-name) + (play-game)) + (1 (new-game player-name T)) + (2 (start-menu)))) + (new-game player-name))) + +(defun new-game (player-name &optional no-greet) + "Set up a new game." ;; let the player choose one of the game worlds - (format t "~&Which world do you want to play?") + (if no-greet + (format t "~&Which world do you want to play?") + (format t "~&Welcome, ~A! Which world do you want to play?" player-name)) (let ((world (choose-option (append (keys *games*) '("Back"))))) (if (equalp world "Back") (start-menu) (setf world-file (cassoc world *games*))) diff --git a/doc/TODO b/doc/TODO index 33cb6d5..de9b7ec 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,8 @@ LISP * fix (string-from-list) bug -* adjust main menu to accomodate many users - +* update manual to reflect new main menu + ATL * make instructions more explicit * add track/foot prints leading to CR diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 86f94a7..04d0543 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -7,7 +7,7 @@ ;;; date: 09/05/2015 ;;; -(defconstant ATLANTIS-VERSION '(0 2 5)) +(defconstant ATLANTIS-VERSION '(0 2 6)) (load "util.lisp") (load "game-objects.lisp") @@ -28,29 +28,30 @@ (first ATLANTIS-VERSION) (second ATLANTIS-VERSION) (third ATLANTIS-VERSION)) - (format t "~&Copyright (c) 2015-2017 Daniel Vedder") + (format t "~&Copyright (c) 2015-2018 Daniel Vedder") (format t "~&Licensed under the terms of the GNU GPLv3.") (format t "~&www.github.com/atlantis~%")) (defun start-menu () "Show the start menu and take a choice from the user" (clear-screen) + ;; Display the Atlantis ASCII-banner and a message of the day + ;; (the latter is optional and intended for use on the server) (print-text-file "banner.txt") - (format t "~&~%Welcome! What do you want to do?") - (setf options '("Start a new game" "Load a saved game" - "Help" "About" "Exit")) - (case (choose-number-option options) - (0 (new-game)) - (1 (format t "~&What game file do you want to load?") - ;; choose a previously saved game - (let ((game (choose-option (append (mapcar #'pathname-name - (directory "../saves/*")) - '("Back"))))) - (if (equalp game "Back") (start-menu) - (progn (setf game (concatenate 'string "../saves/" - game ".world")) - (load-game game) - (play-game))))) + (print-text-file "../motd.txt") + ;; The actual menu + (format t "~&~%Greetings! Please choose an option:") + (case (choose-number-option '("Start playing" "Show player list" + "Read the help file" + "About Atlantis" "Exit")) + (0 (start-playing)) + (1 (let ((users (mapcar #'pathname-name (directory "../saves/*")))) + (format t "~&~A" (string-from-list users :sep #\Newline)) + (format t "~&~%Currently, there are ~S players." + (length users))) + (format t "~&~%Please press ENTER") + (read-line) + (start-menu)) (2 (clear-screen) (pager "../doc/PLAYING" T) (start-menu)) @@ -61,21 +62,30 @@ (4 (format t "~&Goodbye!") (quit)))) -(defun new-game () - "Set up a new game." - ;; ask the player for his/her name +(defun start-playing () + "Ask the player for his name, then start a new game or load a saved game." (setf player-name "") (while (zerop (length player-name)) (format t "~&What is your name? ") (setf player-name (read-line))) - (if (and (member player-name - (mapcar #'pathname-name (directory "../saves/*")) - :test #'equalp) - (not (yes-or-no-p "A game by this player already exists. Replace it?"))) - (start-menu) - (setf (world-player-name *world*) player-name)) + (setf (world-player-name *world*) player-name) + (if (member player-name (mapcar #'pathname-name (directory "../saves/*")) + :test #'equalp) + (progn (format t "~&Welcome back, ~A! What do you want to do?" player-name) + (case (choose-number-option + '("Load your previous game" "Start a new game" "Go back")) + (0 (load-game player-name) + (play-game)) + (1 (new-game player-name T)) + (2 (start-menu)))) + (new-game player-name))) + +(defun new-game (player-name &optional no-greet) + "Set up a new game." ;; let the player choose one of the game worlds - (format t "~&Which world do you want to play?") + (if no-greet + (format t "~&Which world do you want to play?") + (format t "~&Welcome, ~A! Which world do you want to play?" player-name)) (let ((world (choose-option (append (keys *games*) '("Back"))))) (if (equalp world "Back") (start-menu) (setf world-file (cassoc world *games*))) diff --git a/lisp/banner.txt b/lisp/banner.txt index 3c4a9f5..97a846f 100644 --- a/lisp/banner.txt +++ b/lisp/banner.txt @@ -5,6 +5,6 @@ || |*| |*| Lost worlds await || || ~~~~~~| | A | |~~~~ || || ~~~~~###########~~~ || -|| ~~~~#############~~ (c) 2015-2017 Daniel Vedder || +|| ~~~~#############~~ (c) 2015-2018 Daniel Vedder || || ~~~~~~~~~~~~~~~~~~~ || ======================================================== diff --git a/doc/TODO b/doc/TODO index 33cb6d5..de9b7ec 100644 --- a/doc/TODO +++ b/doc/TODO @@ -4,8 +4,8 @@ LISP * fix (string-from-list) bug -* adjust main menu to accomodate many users - +* update manual to reflect new main menu + ATL * make instructions more explicit * add track/foot prints leading to CR diff --git a/lisp/atlantis.lisp b/lisp/atlantis.lisp index 86f94a7..04d0543 100644 --- a/lisp/atlantis.lisp +++ b/lisp/atlantis.lisp @@ -7,7 +7,7 @@ ;;; date: 09/05/2015 ;;; -(defconstant ATLANTIS-VERSION '(0 2 5)) +(defconstant ATLANTIS-VERSION '(0 2 6)) (load "util.lisp") (load "game-objects.lisp") @@ -28,29 +28,30 @@ (first ATLANTIS-VERSION) (second ATLANTIS-VERSION) (third ATLANTIS-VERSION)) - (format t "~&Copyright (c) 2015-2017 Daniel Vedder") + (format t "~&Copyright (c) 2015-2018 Daniel Vedder") (format t "~&Licensed under the terms of the GNU GPLv3.") (format t "~&www.github.com/atlantis~%")) (defun start-menu () "Show the start menu and take a choice from the user" (clear-screen) + ;; Display the Atlantis ASCII-banner and a message of the day + ;; (the latter is optional and intended for use on the server) (print-text-file "banner.txt") - (format t "~&~%Welcome! What do you want to do?") - (setf options '("Start a new game" "Load a saved game" - "Help" "About" "Exit")) - (case (choose-number-option options) - (0 (new-game)) - (1 (format t "~&What game file do you want to load?") - ;; choose a previously saved game - (let ((game (choose-option (append (mapcar #'pathname-name - (directory "../saves/*")) - '("Back"))))) - (if (equalp game "Back") (start-menu) - (progn (setf game (concatenate 'string "../saves/" - game ".world")) - (load-game game) - (play-game))))) + (print-text-file "../motd.txt") + ;; The actual menu + (format t "~&~%Greetings! Please choose an option:") + (case (choose-number-option '("Start playing" "Show player list" + "Read the help file" + "About Atlantis" "Exit")) + (0 (start-playing)) + (1 (let ((users (mapcar #'pathname-name (directory "../saves/*")))) + (format t "~&~A" (string-from-list users :sep #\Newline)) + (format t "~&~%Currently, there are ~S players." + (length users))) + (format t "~&~%Please press ENTER") + (read-line) + (start-menu)) (2 (clear-screen) (pager "../doc/PLAYING" T) (start-menu)) @@ -61,21 +62,30 @@ (4 (format t "~&Goodbye!") (quit)))) -(defun new-game () - "Set up a new game." - ;; ask the player for his/her name +(defun start-playing () + "Ask the player for his name, then start a new game or load a saved game." (setf player-name "") (while (zerop (length player-name)) (format t "~&What is your name? ") (setf player-name (read-line))) - (if (and (member player-name - (mapcar #'pathname-name (directory "../saves/*")) - :test #'equalp) - (not (yes-or-no-p "A game by this player already exists. Replace it?"))) - (start-menu) - (setf (world-player-name *world*) player-name)) + (setf (world-player-name *world*) player-name) + (if (member player-name (mapcar #'pathname-name (directory "../saves/*")) + :test #'equalp) + (progn (format t "~&Welcome back, ~A! What do you want to do?" player-name) + (case (choose-number-option + '("Load your previous game" "Start a new game" "Go back")) + (0 (load-game player-name) + (play-game)) + (1 (new-game player-name T)) + (2 (start-menu)))) + (new-game player-name))) + +(defun new-game (player-name &optional no-greet) + "Set up a new game." ;; let the player choose one of the game worlds - (format t "~&Which world do you want to play?") + (if no-greet + (format t "~&Which world do you want to play?") + (format t "~&Welcome, ~A! Which world do you want to play?" player-name)) (let ((world (choose-option (append (keys *games*) '("Back"))))) (if (equalp world "Back") (start-menu) (setf world-file (cassoc world *games*))) diff --git a/lisp/banner.txt b/lisp/banner.txt index 3c4a9f5..97a846f 100644 --- a/lisp/banner.txt +++ b/lisp/banner.txt @@ -5,6 +5,6 @@ || |*| |*| Lost worlds await || || ~~~~~~| | A | |~~~~ || || ~~~~~###########~~~ || -|| ~~~~#############~~ (c) 2015-2017 Daniel Vedder || +|| ~~~~#############~~ (c) 2015-2018 Daniel Vedder || || ~~~~~~~~~~~~~~~~~~~ || ======================================================== diff --git a/motd.txt b/motd.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/motd.txt @@ -0,0 +1 @@ +