[the-feebs-war-cvs] r17 - definitions documentation graphics

gmilare at common-lisp.net gmilare at common-lisp.net
Sat Mar 15 18:56:02 UTC 2008


Author: gmilare
Date: Sat Mar 15 13:56:01 2008
New Revision: 17

Modified:
   definitions/rules.lisp
   documentation/feebs.tex
   graphics/graphics.lisp
   system.lisp
   the-feebs-war.asd
Log:


Modified: definitions/rules.lisp
==============================================================================
--- definitions/rules.lisp	(original)
+++ definitions/rules.lisp	Sat Mar 15 13:56:01 2008
@@ -202,15 +202,14 @@
 				(total-time)))))
 	  (prog1 nil ; in case that the move was eating something
 	    (incf (feeb-score feeb) (get-feeb-parm 'points-for-slow-down)))
-	(call-next-method))
-    (call-next-method)))
+          (call-next-method))
+      (call-next-method)))
 
 (defmethod make-move :around ((feeb feeb) (move (eql :move-forward)))
-  (let ((thing (find-if #'fireball-p (get-forward-pos feeb))))
-    (if thing
-	(destroy-object feeb thing)
-      (call-next-method))))
-
+  (aif (find-if #'fireball-p (get-forward-pos feeb))
+       (if (call-next-method) ; was the move successfull?
+           (destroy-object feeb it))
+       (call-next-method)))
 
 ;;; Eating
 
@@ -242,6 +241,8 @@
   "Amount of energy lost after throwing a flame.")
 
 (defmethod make-move :around ((feeb feeb) (move (eql :flame)))
-  (when (>= (feeb-energy-reserve feeb) (get-feeb-parm 'flame-energy))
+  (when (and (feeb-ready-to-fire feeb)
+             (>= (feeb-energy-reserve feeb) (get-feeb-parm 'flame-energy)))
+    (setf (feeb-ready-to-fire feeb) nil)
     (decf (feeb-energy-reserve feeb) (get-feeb-parm 'flame-energy))
     (call-next-method)))

Modified: documentation/feebs.tex
==============================================================================
--- documentation/feebs.tex	(original)
+++ documentation/feebs.tex	Sat Mar 15 13:56:01 2008
@@ -169,7 +169,7 @@
 in front of the feeb, and it will see it, so the feeb shouldn't move
 forward. For a few turns, the feeb will not be able to
 throw flames. Each turn, the flame moves forward destroing mushrooms and
-killing feebs it encounters, transforming them into carcass. If there
+killing feebs it encounters, transforming them into carcasses. If there
 is a wall, the flame can reflect, and, if so, it will turn 180 degrees.
 
 Once a feeb is killed (or starves), in it's place in the maze there will appear

Modified: graphics/graphics.lisp
==============================================================================
--- graphics/graphics.lisp	(original)
+++ graphics/graphics.lisp	Sat Mar 15 13:56:01 2008
@@ -39,8 +39,7 @@
 		 ((wallp elt) 
 		  (list " XX"))
 		 ((feeb-p (car elt))
-		  (list "F~1d~a"
-			(position (feeb-name (car elt)) *feebs* :key #'feeb-name)
+		  (list " F~a"
 			(print-direction (feeb-facing (car elt)))))
 		 ((fireball-p (car elt))
 		  (list " *~a" (print-direction (fireball-direction (car elt)))))

Modified: system.lisp
==============================================================================
--- system.lisp	(original)
+++ system.lisp	Sat Mar 15 13:56:01 2008
@@ -133,8 +133,8 @@
 
   (:method ((fireball fireball) x-pos y-pos)
     (push fireball *fireballs-flying*)
-    (setf (object-x-position object) x-pos
-          (object-y-position object) y-pos))) ; don't place it yet, only after first move
+    (setf (object-x-position fireball) x-pos
+          (object-y-position fireball) y-pos))) ; don't place it yet, only after first move
 
 ;;; Reincarnating
 
@@ -147,7 +147,7 @@
 (defgeneric destroy-object (object cause)
   (:documentation "Called when CAUSE destroys OBJECT.
 CAUSE could be :starve or a fireball (for feebs)
-or :dissipate (for fireballs)."
+or :dissipate (for fireballs).")
   (:method (object cause)
     (delete-object object (object-x-position object)
                    (object-y-position object)))
@@ -191,7 +191,7 @@
 returned from MAKE-MOVE-CHOICE for the same object.")
 
   (:method (object move)
-    nil)
+    (warn "Unknown move ~a for object ~a." move object))
 
   (:method (object (move (eql :turn-right)))
     (setf (object-direction object)
@@ -209,7 +209,8 @@
     (multiple-value-bind (stuff new-x new-y)
         (get-forward-pos object)
       (unless (wallp stuff)
-        (change-object-pos object new-x new-y))))
+        (change-object-pos object new-x new-y)
+        t)))
 
   (:method ((fireball fireball) (move (eql :dissipate)))
     (destroy-object fireball :dissipate))

Modified: the-feebs-war.asd
==============================================================================
--- the-feebs-war.asd	(original)
+++ the-feebs-war.asd	Sat Mar 15 13:56:01 2008
@@ -10,7 +10,7 @@
   :version "0.1"
   :author "Gustavo Henrique Milaré <gugamilare at gmail.com>"
   :licence "GPL"
-; :depends-on (lispbuilder-sdl lispbuilder-sdl-image lispbuilder-sdl-gfx)
+; :depends-on (lispbuilder-sdl)
     
   :components
    ((:cl-source-file "package")
@@ -18,6 +18,8 @@
     (:cl-source-file "system" :depends-on ("utils"))
     (:cl-source-file "images" :depends-on ("system"))
     (:cl-source-file "main"   :depends-on ("images"))
+    ;; GPL
+    (:doc-file "licence")
 
     (:module "definitions"
       :depends-on ("main")
@@ -27,15 +29,12 @@
        (:cl-source-file "extra")
        (:cl-source-file "brains")))
      
-   (:module "graphics"
-     :depends-on ("main")
-     :components
-     ((:file "graphics"))))
-     
-   ;; GPL
-   (:doc-file "licence")
+    (:module "graphics"
+      :depends-on ("main")
+      :components
+      ((:file "graphics")))
      
-   ;; documentation
-   (:module "documentation"
-     :components
-     (:doc-file "feebs.tex")))
+    ;; documentation
+    (:module "documentation"
+      :components
+      ((:doc-file "feebs.tex")))))



More information about the The-feebs-war-cvs mailing list