##// END OF EJS Templates
Bugfixes
naryl -
r41:097aa130 default
parent child Browse files
Show More
@@ -30,6 +30,9 b''
30 30 (defun make-menu-delimiter ()
31 31 "<hr>")
32 32
33 (defun copy-obj (obj)
34 (chain *j-s-o-n (parse (chain *j-s-o-n (stringify obj)))))
35
33 36 (defun report-error (text)
34 37 (alert text))
35 38
@@ -139,12 +142,15 b''
139 142 (setf name (chain name (to-upper-case)))
140 143 (with-frame
141 144 (with-call-args args
142 (funcall (getprop *locs name)))))
145 (funcall (getprop *locs name))))
146 (void))
143 147
144 148 (defun call-act (title)
145 (let ((*current-act title))
149 (setf *current-action title)
146 150 (with-frame
147 (funcall (getprop *acts title :act)))))
151 (funcall (getprop *acts title :act)))
152 (setf *current-action nil)
153 (void))
148 154
149 155 ;;; Text windows
150 156
@@ -184,7 +190,7 b''
184 190 (create :title title :img img :act act :selected nil))
185 191 (update-acts))
186 192
187 (defun del-act (title)
193 (defun del-act (&optional title)
188 194 (delete (getprop *acts (or title *current-action)))
189 195 (update-acts))
190 196
@@ -225,7 +231,7 b''
225 231 v))
226 232
227 233 (defun set-str-element (slot index value)
228 (if (in index (getprop slot :indexes))
234 (if (has index (getprop slot :indexes))
229 235 (setf (elt (getprop slot)
230 236 (getprop slot :indexes index))
231 237 value)
@@ -16,12 +16,6 b''
16 16
17 17 ;;; 3expr
18 18
19 (defpsmacro obj (name)
20 `(in ,name *objs))
21
22 (defpsmacro loc (name)
23 `(in ,name *locs))
24
25 19 (defpsmacro no (arg)
26 20 `(- -1 ,arg))
27 21
@@ -115,7 +109,9 b''
115 109 `(api-call enable-frame :acts ,enable))
116 110
117 111 (defpsmacro delact (&optional name)
118 `(api-call del-act ,name))
112 (if name
113 `(api-call del-act ,name)
114 `(api-call del-act)))
119 115
120 116 (defpsmacro cla ()
121 117 `(api-call clear-act))
@@ -25,6 +25,12 b''
25 25
26 26 ;;; 3expr
27 27
28 (defun obj (name)
29 (has name *objs))
30
31 (defun loc (name)
32 (has name *locs))
33
28 34 ;;; 4code
29 35
30 36 (defun rand (a &optional (b 1))
@@ -186,7 +192,7 b''
186 192 ;;; 14act
187 193
188 194 (defun curacts ()
189 (let ((acts *acts))
195 (let ((acts (api-call copy-obj *acts)))
190 196 (lambda ()
191 197 (setf *acts acts)
192 198 (void))))
@@ -203,6 +209,7 b''
203 209
204 210 (defun delobj (name)
205 211 (delete (getprop *objs name))
212 (api:update-objs)
206 213 (api-call call-serv-loc "$ONOBJDEL" name)
207 214 (void))
208 215
@@ -1,12 +1,8 b''
1 1
2 2 (in-package sugar-qsp.main)
3 3
4
5 (defpsmacro by-id (id)
6 `(chain document (get-element-by-id ,id)))
7
8 4 (defmacro+ps api-call (name &rest args)
9 5 `(,(intern (string-upcase name) "API") ,@args))
10 6
11 (defpsmacro in (key obj)
7 (defpsmacro has (key obj)
12 8 `(chain ,obj (has-own-property ,key)))
@@ -36,7 +36,6 b''
36 36 ;; Active locations
37 37 (var *locs (create))
38 38
39 ;; Launch the game from the first location
40 39 (setf (@ window onload)
41 40 (lambda ()
42 41 (#.(intern "INIT-DOM" "SUGAR-QSP.API"))
@@ -49,3 +48,8 b''
49 48 (#.(intern "RUN-GAME" "SUGAR-QSP.API")
50 49 (chain *object (keys *games) 0))
51 50 (values)))
51
52 ;;; Some very common utilities (for both api and lib)
53
54 (defun by-id (id)
55 (chain document (get-element-by-id id)))
@@ -6,7 +6,7 b''
6 6 (defpackage :sugar-qsp.main
7 7 (:use :cl :ps :sugar-qsp.js)
8 8 (:export #:api-call #:by-id
9 #:in
9 #:has
10 10
11 11 #:*globals #:*objs #:*current-location #:*current-action
12 12 #:*started-at #:*timer-interval #:*timer-obj #:*loaded-games
@@ -15,7 +15,6 b''
15 15 (defun not-quote (char)
16 16 (not (eql #\' char)))
17 17
18
19 18 (defun not-doublequote (char)
20 19 (not (eql #\" char)))
21 20
General Comments 0
You need to be logged in to leave comments. Login now