diff clojure/com/aurellem/gb/species.clj @ 190:9a7a46c4aa1b

extending functionality of support namespaces in prepreation of give-pokemon
author Robert McIntyre <rlm@mit.edu>
date Thu, 22 Mar 2012 16:34:10 -0500
parents 76b031d2f586
children 893c753f8088
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/species.clj	Thu Mar 22 15:58:39 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/species.clj	Thu Mar 22 16:34:10 2012 -0500
     1.3 @@ -161,16 +161,28 @@
     1.4    (zipmap (vals species-code->species-name)
     1.5            (keys species-code->species-name)))
     1.6  
     1.7 +(defn pokemon-species-data-address [poke-num]
     1.8 +  (+ species-ID-1 poke-num))
     1.9 +
    1.10 +(defn read-species
    1.11 +  ([^SaveState state poke-num]
    1.12 +     (assert (<= 0 poke-num 5))
    1.13 +     (species-code->species-name
    1.14 +      (aget (memory state)
    1.15 +            (pokemon-species-data-address poke-num))))
    1.16 +  ([poke-num]
    1.17 +     (read-species @current-state poke-num)))
    1.18 +
    1.19  (defn set-species
    1.20 -  ([^SaveState state pokemon-num species-name]
    1.21 -     (assert (<= 0 pokemon-num 5))
    1.22 +  ([^SaveState state poke-num species-name]
    1.23 +     (assert (<= 0 poke-num 5))
    1.24       (let [species-code (species-name->species-code
    1.25                           species-name
    1.26                           species-name)]
    1.27         
    1.28 -       (set-memory state (+ species-ID-1 pokemon-num)
    1.29 +       (set-memory state (pokemon-species-data-address poke-num)
    1.30                     species-code)))
    1.31 -  ([pokemon-num species-name]
    1.32 -     (set-species @current-state pokemon-num species-name)))
    1.33 +  ([poke-num species-name]
    1.34 +     (set-species @current-state poke-num species-name)))
    1.35  
    1.36