 (defn- get-stash
   "Gets the current stash"
   [game]
-  (println game)
-  (if (empty? (get-in game ["battle" "stash" "p1"]))
-    (get-in game ["battle" "stash" "p2"])
-    (get-in game ["battle" "stash" "p1"])))
+  (get-in game ["battle" "stash" (get-in game ["viewed-by" "player-code"])]))
 
 (defn- game-stash
   "Shows the current stash if available"

  "Error loading action"
  []
  (state/set-state :processing-action nil))

(defn- add-action
  "Processes a new action"

  (let [token (state/get-state :token)
        url (str "http://api.orionsbelt.eu/game/" (params :id) "?token=" token)]
    (state/set-state :loading-game (str "Loading game " (params :id) "..."))
    (state/set-state :game-id (params :id))
    (GET url {:handler game-loaded
              :error-handler error-loading})))

