Browse Source

updated to non-hacky wasm loading

Inderjit Gill 4 months ago
parent
commit
13b958f60b
13 changed files with 248 additions and 231 deletions
  1. 2
    3
      README.md
  2. 124
    108
      client/Cargo.lock
  3. 2
    6
      client/build.sh
  4. 1
    1
      client/src/lib.rs
  5. 2
    5
      client/www/index.js
  6. 52
    43
      core/Cargo.lock
  7. 14
    8
      core/src/audio.rs
  8. 18
    22
      core/src/game.rs
  9. 3
    3
      core/src/geometry.rs
  10. 1
    1
      core/src/level.rs
  11. 22
    27
      core/src/level_builder.rs
  12. 4
    1
      core/src/lib.rs
  13. 3
    3
      core/src/tile.rs

+ 2
- 3
README.md View File

@@ -23,7 +23,6 @@ $ basic-http-server
23 23
 ## ensure that the correct toolchain is installed
24 24
 ```sh
25 25
 $ rustup update
26
-$ rustup install nightly
27
-$ rustup target add wasm32-unknown-unknown --toolchain nightly
28
-$ cargo +nightly install wasm-bindgen-cli
26
+$ rustup target add wasm32-unknown-unknown
27
+$ cargo install -f wasm-bindgen-cli
29 28
 ```

+ 124
- 108
client/Cargo.lock View File

@@ -1,84 +1,97 @@
1
+# This file is automatically @generated by Cargo.
2
+# It is not intended for manual editing.
3
+[[package]]
4
+name = "autocfg"
5
+version = "0.1.2"
6
+source = "registry+https://github.com/rust-lang/crates.io-index"
7
+
1 8
 [[package]]
2 9
 name = "backtrace"
3
-version = "0.3.9"
10
+version = "0.3.15"
4 11
 source = "registry+https://github.com/rust-lang/crates.io-index"
5 12
 dependencies = [
6
- "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
7
- "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
8
- "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
9
- "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
10
- "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
13
+ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
14
+ "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
15
+ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
16
+ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
17
+ "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
18
+ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
11 19
 ]
12 20
 
13 21
 [[package]]
14 22
 name = "backtrace-sys"
15
-version = "0.1.24"
23
+version = "0.1.28"
16 24
 source = "registry+https://github.com/rust-lang/crates.io-index"
17 25
 dependencies = [
18
- "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
19
- "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
26
+ "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
27
+ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
20 28
 ]
21 29
 
22 30
 [[package]]
31
+name = "bumpalo"
32
+version = "2.3.0"
33
+source = "registry+https://github.com/rust-lang/crates.io-index"
34
+
35
+[[package]]
23 36
 name = "cc"
24
-version = "1.0.25"
37
+version = "1.0.35"
25 38
 source = "registry+https://github.com/rust-lang/crates.io-index"
26 39
 
27 40
 [[package]]
28 41
 name = "cfg-if"
29
-version = "0.1.6"
42
+version = "0.1.7"
30 43
 source = "registry+https://github.com/rust-lang/crates.io-index"
31 44
 
32 45
 [[package]]
33 46
 name = "console_error_panic_hook"
34
-version = "0.1.5"
47
+version = "0.1.6"
35 48
 source = "registry+https://github.com/rust-lang/crates.io-index"
36 49
 dependencies = [
37
- "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
38
- "wasm-bindgen 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
50
+ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
51
+ "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
39 52
 ]
40 53
 
41 54
 [[package]]
42 55
 name = "failure"
43
-version = "0.1.3"
56
+version = "0.1.5"
44 57
 source = "registry+https://github.com/rust-lang/crates.io-index"
45 58
 dependencies = [
46
- "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
47
- "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
59
+ "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
60
+ "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
48 61
 ]
49 62
 
50 63
 [[package]]
51 64
 name = "failure_derive"
52
-version = "0.1.3"
65
+version = "0.1.5"
53 66
 source = "registry+https://github.com/rust-lang/crates.io-index"
54 67
 dependencies = [
55
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
56
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
57
- "syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)",
68
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
69
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
70
+ "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
58 71
  "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
59 72
 ]
60 73
 
61 74
 [[package]]
62 75
 name = "futures"
63
-version = "0.1.25"
76
+version = "0.1.26"
64 77
 source = "registry+https://github.com/rust-lang/crates.io-index"
65 78
 
66 79
 [[package]]
67 80
 name = "js-sys"
68
-version = "0.3.5"
81
+version = "0.3.19"
69 82
 source = "registry+https://github.com/rust-lang/crates.io-index"
70 83
 dependencies = [
71
- "wasm-bindgen 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
84
+ "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
72 85
 ]
73 86
 
74 87
 [[package]]
75 88
 name = "lazy_static"
76
-version = "1.2.0"
89
+version = "1.3.0"
77 90
 source = "registry+https://github.com/rust-lang/crates.io-index"
78 91
 
79 92
 [[package]]
80 93
 name = "libc"
81
-version = "0.2.43"
94
+version = "0.2.51"
82 95
 source = "registry+https://github.com/rust-lang/crates.io-index"
83 96
 
84 97
 [[package]]
@@ -86,7 +99,7 @@ name = "log"
86 99
 version = "0.4.6"
87 100
 source = "registry+https://github.com/rust-lang/crates.io-index"
88 101
 dependencies = [
89
- "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
102
+ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
90 103
 ]
91 104
 
92 105
 [[package]]
@@ -96,7 +109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
96 109
 
97 110
 [[package]]
98 111
 name = "proc-macro2"
99
-version = "0.4.24"
112
+version = "0.4.27"
100 113
 source = "registry+https://github.com/rust-lang/crates.io-index"
101 114
 dependencies = [
102 115
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -104,48 +117,48 @@ dependencies = [
104 117
 
105 118
 [[package]]
106 119
 name = "quote"
107
-version = "0.6.10"
120
+version = "0.6.12"
108 121
 source = "registry+https://github.com/rust-lang/crates.io-index"
109 122
 dependencies = [
110
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
123
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
111 124
 ]
112 125
 
113 126
 [[package]]
114 127
 name = "rustc-demangle"
115
-version = "0.1.9"
128
+version = "0.1.14"
116 129
 source = "registry+https://github.com/rust-lang/crates.io-index"
117 130
 
118 131
 [[package]]
119 132
 name = "scoped-tls"
120
-version = "0.1.2"
133
+version = "1.0.0"
121 134
 source = "registry+https://github.com/rust-lang/crates.io-index"
122 135
 
123 136
 [[package]]
124 137
 name = "sokoban-client"
125 138
 version = "0.1.0"
126 139
 dependencies = [
127
- "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
128
- "console_error_panic_hook 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
140
+ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
141
+ "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
129 142
  "sokoban-core 0.1.0",
130
- "wasm-bindgen 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
131
- "wasm-bindgen-test 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
132
- "wee_alloc 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
143
+ "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
144
+ "wasm-bindgen-test 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
145
+ "wee_alloc 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
133 146
 ]
134 147
 
135 148
 [[package]]
136 149
 name = "sokoban-core"
137 150
 version = "0.1.0"
138 151
 dependencies = [
139
- "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
152
+ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
140 153
 ]
141 154
 
142 155
 [[package]]
143 156
 name = "syn"
144
-version = "0.15.21"
157
+version = "0.15.30"
145 158
 source = "registry+https://github.com/rust-lang/crates.io-index"
146 159
 dependencies = [
147
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
148
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
160
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
161
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
149 162
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
150 163
 ]
151 164
 
@@ -154,9 +167,9 @@ name = "synstructure"
154 167
 version = "0.10.1"
155 168
 source = "registry+https://github.com/rust-lang/crates.io-index"
156 169
 dependencies = [
157
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
158
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
159
- "syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)",
170
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
171
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
172
+ "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
160 173
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
161 174
 ]
162 175
 
@@ -180,99 +193,100 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
180 193
 
181 194
 [[package]]
182 195
 name = "wasm-bindgen"
183
-version = "0.2.28"
196
+version = "0.2.42"
184 197
 source = "registry+https://github.com/rust-lang/crates.io-index"
185 198
 dependencies = [
186
- "wasm-bindgen-macro 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
199
+ "wasm-bindgen-macro 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
187 200
 ]
188 201
 
189 202
 [[package]]
190 203
 name = "wasm-bindgen-backend"
191
-version = "0.2.28"
204
+version = "0.2.42"
192 205
 source = "registry+https://github.com/rust-lang/crates.io-index"
193 206
 dependencies = [
194
- "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
207
+ "bumpalo 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
208
+ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
195 209
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
196
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
197
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
198
- "syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)",
199
- "wasm-bindgen-shared 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
210
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
211
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
212
+ "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
213
+ "wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
200 214
 ]
201 215
 
202 216
 [[package]]
203 217
 name = "wasm-bindgen-futures"
204
-version = "0.3.5"
218
+version = "0.3.19"
205 219
 source = "registry+https://github.com/rust-lang/crates.io-index"
206 220
 dependencies = [
207
- "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
208
- "js-sys 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
209
- "wasm-bindgen 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
221
+ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
222
+ "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
223
+ "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
210 224
 ]
211 225
 
212 226
 [[package]]
213 227
 name = "wasm-bindgen-macro"
214
-version = "0.2.28"
228
+version = "0.2.42"
215 229
 source = "registry+https://github.com/rust-lang/crates.io-index"
216 230
 dependencies = [
217
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
218
- "wasm-bindgen-macro-support 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
231
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
232
+ "wasm-bindgen-macro-support 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
219 233
 ]
220 234
 
221 235
 [[package]]
222 236
 name = "wasm-bindgen-macro-support"
223
-version = "0.2.28"
237
+version = "0.2.42"
224 238
 source = "registry+https://github.com/rust-lang/crates.io-index"
225 239
 dependencies = [
226
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
227
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
228
- "syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)",
229
- "wasm-bindgen-backend 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
230
- "wasm-bindgen-shared 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
240
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
241
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
242
+ "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
243
+ "wasm-bindgen-backend 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
244
+ "wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
231 245
 ]
232 246
 
233 247
 [[package]]
234 248
 name = "wasm-bindgen-shared"
235
-version = "0.2.28"
249
+version = "0.2.42"
236 250
 source = "registry+https://github.com/rust-lang/crates.io-index"
237 251
 
238 252
 [[package]]
239 253
 name = "wasm-bindgen-test"
240
-version = "0.2.28"
254
+version = "0.2.42"
241 255
 source = "registry+https://github.com/rust-lang/crates.io-index"
242 256
 dependencies = [
243
- "console_error_panic_hook 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
244
- "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
245
- "js-sys 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
246
- "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
247
- "wasm-bindgen 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
248
- "wasm-bindgen-futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
249
- "wasm-bindgen-test-macro 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)",
257
+ "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
258
+ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)",
259
+ "js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
260
+ "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
261
+ "wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
262
+ "wasm-bindgen-futures 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
263
+ "wasm-bindgen-test-macro 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)",
250 264
 ]
251 265
 
252 266
 [[package]]
253 267
 name = "wasm-bindgen-test-macro"
254
-version = "0.2.28"
268
+version = "0.2.42"
255 269
 source = "registry+https://github.com/rust-lang/crates.io-index"
256 270
 dependencies = [
257
- "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
258
- "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
271
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
272
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
259 273
 ]
260 274
 
261 275
 [[package]]
262 276
 name = "wee_alloc"
263
-version = "0.4.2"
277
+version = "0.4.3"
264 278
 source = "registry+https://github.com/rust-lang/crates.io-index"
265 279
 dependencies = [
266
- "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
267
- "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
280
+ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
281
+ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
268 282
  "memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
269 283
  "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
270
- "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
284
+ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
271 285
 ]
272 286
 
273 287
 [[package]]
274 288
 name = "winapi"
275
-version = "0.3.6"
289
+version = "0.3.7"
276 290
 source = "registry+https://github.com/rust-lang/crates.io-index"
277 291
 dependencies = [
278 292
  "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -290,37 +304,39 @@ version = "0.4.0"
290 304
 source = "registry+https://github.com/rust-lang/crates.io-index"
291 305
 
292 306
 [metadata]
293
-"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
294
-"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
295
-"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
296
-"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
297
-"checksum console_error_panic_hook 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6c5dd2c094474ec60a6acaf31780af270275e3153bafff2db5995b715295762e"
298
-"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7"
299
-"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596"
300
-"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b"
301
-"checksum js-sys 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9f476e674d55cc43a57dfd1d3986c7c305e41827ead21ff6373652804f728afe"
302
-"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
303
-"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
307
+"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
308
+"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637"
309
+"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6"
310
+"checksum bumpalo 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6a6bc2ba935b1e2f810787ceba8dfe86cbc164cee55925cae715541186673c4"
311
+"checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83"
312
+"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4"
313
+"checksum console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211"
314
+"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
315
+"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
316
+"checksum futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "62941eff9507c8177d448bd83a44d9b9760856e184081d8cd79ba9f03dd24981"
317
+"checksum js-sys 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3c994fd445b81741d77f6bcd227d6ed645b95b35a2ecfd2050767450ff1c0b6d"
318
+"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
319
+"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917"
304 320
 "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
305 321
 "checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3"
306
-"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
307
-"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
308
-"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
309
-"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
310
-"checksum syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)" = "816b7af21405b011a23554ea2dc3f6576dc86ca557047c34098c1d741f10f823"
322
+"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
323
+"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
324
+"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288"
325
+"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
326
+"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2"
311 327
 "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
312 328
 "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
313 329
 "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
314 330
 "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
315
-"checksum wasm-bindgen 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)" = "dcefd48aa89f1319c61780595be0d378c5de5ccefd9d4e55c282aad4245a256c"
316
-"checksum wasm-bindgen-backend 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)" = "9b12e4c544f22adf78c7bc06fa605ac084566adc88bcbbe8857f0ceb0a12613a"
317
-"checksum wasm-bindgen-futures 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e681f39732ced443d8ae6cc866ba00fdebc4482f6e0e7e96ef0c415681be83d0"
318
-"checksum wasm-bindgen-macro 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c71b31dc194560c8696348975abc32ed134742c19a865601db3d7eb01a1c56"
319
-"checksum wasm-bindgen-macro-support 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)" = "890018bb4a49c4c977c66e0c6a5f633d82766f6e78a57e2bc8f611a22f72dc18"
320
-"checksum wasm-bindgen-shared 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)" = "0e38e79a1881e09015aaf8db197b04d97439e06da0f50a213608e93247f5ecfc"
321
-"checksum wasm-bindgen-test 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)" = "aae7dcae1123854b20b06288ea930153d6fa0fa75948aa0218fb50f81cac1a1d"
322
-"checksum wasm-bindgen-test-macro 0.2.28 (registry+https://github.com/rust-lang/crates.io-index)" = "d7341ddac1babc9790b0647769f772d1dba217c9b16f204a55f82910853dca5b"
323
-"checksum wee_alloc 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "27875be1daf838fa18f3e94fd19fd12638e34615b42f56da2610c8f46be80cc6"
324
-"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
331
+"checksum wasm-bindgen 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ffde3534e5fa6fd936e3260cd62cd644b8656320e369388f9303c955895e35d4"
332
+"checksum wasm-bindgen-backend 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "40c0543374a7ae881cdc5d32d19de28d1d1929e92263ffa7e31712cc2d53f9f1"
333
+"checksum wasm-bindgen-futures 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "0ad171fc1f6e43f97d155d27f4ee5657bd8aa5cce7c497ef3a0a0c5b44618b2d"
334
+"checksum wasm-bindgen-macro 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "f914c94c2c5f4c9364510ca2429e59c92157ec89429243bcc245e983db990a71"
335
+"checksum wasm-bindgen-macro-support 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "9168c413491e4233db7b6884f09a43beb00c14d11d947ffd165242daa48a2385"
336
+"checksum wasm-bindgen-shared 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "326c32126e1a157b6ced7400061a84ac5b11182b2cda6edad7314eb3ae9ac9fe"
337
+"checksum wasm-bindgen-test 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "8aed4ef1aa56f2ef4aff593c516de6a3e48711c703b3f7415c9151a7c9babd17"
338
+"checksum wasm-bindgen-test-macro 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eb477c50f3c9a9ecd99c78fb9bd3b6599d414b918d5f72165b12c53738011ae1"
339
+"checksum wee_alloc 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e841fed992c6c70cf2af5dbcffb0d988b1a7ffc5177ae4fb714ed14944b39d0a"
340
+"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
325 341
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
326 342
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

+ 2
- 6
client/build.sh View File

@@ -2,13 +2,9 @@
2 2
 
3 3
 if [ "$1" = "release" ]
4 4
 then
5
-    cargo +nightly build --release --target wasm32-unknown-unknown
5
+    cargo build --release --target wasm32-unknown-unknown
6 6
     wasm-bindgen target/wasm32-unknown-unknown/release/sokoban_client.wasm --out-dir www --no-typescript --no-modules
7
-
8
-    sed -i "s/__exports.BridgeConfig = BridgeConfig;/__exports.BridgeConfig = BridgeConfig;\n\/\/ ISG HACK\n__exports.wasm = wasm;/g" www/sokoban_client.js
9 7
 else
10
-    cargo +nightly build --target wasm32-unknown-unknown
8
+    cargo build --target wasm32-unknown-unknown
11 9
     wasm-bindgen target/wasm32-unknown-unknown/debug/sokoban_client.wasm --out-dir www --no-typescript --no-modules
12
-
13
-    sed -i "s/__exports.BridgeConfig = BridgeConfig;/__exports.BridgeConfig = BridgeConfig;\n\/\/ ISG HACK\n__exports.wasm = wasm;/g" www/sokoban_client.js
14 10
 fi

+ 1
- 1
client/src/lib.rs View File

@@ -1,5 +1,5 @@
1 1
 #![allow(dead_code)]
2
-#![cfg_attr(feature = "cargo-clippy", allow(many_single_char_names, too_many_arguments))]
2
+#![cfg_attr(feature = "cargo-clippy", allow(clippy::many_single_char_names, clippy::too_many_arguments))]
3 3
 
4 4
 extern crate cfg_if;
5 5
 extern crate sokoban_core;

+ 2
- 5
client/www/index.js View File

@@ -834,11 +834,8 @@ function main() {
834 834
 
835 835
 document.addEventListener('DOMContentLoaded', () => {
836 836
   wasm_bindgen('./sokoban_client_bg.wasm')
837
-    .then(() => {
838
-      // hack to access the memory
839
-      // the build.sh has a sed command to export the wasm object
840
-      // replace the js renderer with a rust implmentation to get rid of this hack
841
-      memory = wasm_bindgen.wasm.memory;
837
+    .then(client_bg => {
838
+      memory = client_bg.memory;
842 839
       main();
843 840
     })
844 841
     .catch(console.error);

+ 52
- 43
core/Cargo.lock View File

@@ -1,62 +1,70 @@
1
+# This file is automatically @generated by Cargo.
2
+# It is not intended for manual editing.
3
+[[package]]
4
+name = "autocfg"
5
+version = "0.1.2"
6
+source = "registry+https://github.com/rust-lang/crates.io-index"
7
+
1 8
 [[package]]
2 9
 name = "backtrace"
3
-version = "0.3.9"
10
+version = "0.3.15"
4 11
 source = "registry+https://github.com/rust-lang/crates.io-index"
5 12
 dependencies = [
6
- "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
7
- "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
8
- "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
9
- "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
10
- "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
13
+ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
14
+ "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
15
+ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
16
+ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
17
+ "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
18
+ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
11 19
 ]
12 20
 
13 21
 [[package]]
14 22
 name = "backtrace-sys"
15
-version = "0.1.24"
23
+version = "0.1.28"
16 24
 source = "registry+https://github.com/rust-lang/crates.io-index"
17 25
 dependencies = [
18
- "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
19
- "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
26
+ "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
27
+ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
20 28
 ]
21 29
 
22 30
 [[package]]
23 31
 name = "cc"
24
-version = "1.0.25"
32
+version = "1.0.35"
25 33
 source = "registry+https://github.com/rust-lang/crates.io-index"
26 34
 
27 35
 [[package]]
28 36
 name = "cfg-if"
29
-version = "0.1.6"
37
+version = "0.1.7"
30 38
 source = "registry+https://github.com/rust-lang/crates.io-index"
31 39
 
32 40
 [[package]]
33 41
 name = "failure"
34
-version = "0.1.3"
42
+version = "0.1.5"
35 43
 source = "registry+https://github.com/rust-lang/crates.io-index"
36 44
 dependencies = [
37
- "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
38
- "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
45
+ "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
46
+ "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
39 47
 ]
40 48
 
41 49
 [[package]]
42 50
 name = "failure_derive"
43
-version = "0.1.3"
51
+version = "0.1.5"
44 52
 source = "registry+https://github.com/rust-lang/crates.io-index"
45 53
 dependencies = [
46
- "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
47
- "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
48
- "syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)",
54
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
55
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
56
+ "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
49 57
  "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
50 58
 ]
51 59
 
52 60
 [[package]]
53 61
 name = "libc"
54
-version = "0.2.43"
62
+version = "0.2.51"
55 63
 source = "registry+https://github.com/rust-lang/crates.io-index"
56 64
 
57 65
 [[package]]
58 66
 name = "proc-macro2"
59
-version = "0.4.20"
67
+version = "0.4.27"
60 68
 source = "registry+https://github.com/rust-lang/crates.io-index"
61 69
 dependencies = [
62 70
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -64,31 +72,31 @@ dependencies = [
64 72
 
65 73
 [[package]]
66 74
 name = "quote"
67
-version = "0.6.9"
75
+version = "0.6.12"
68 76
 source = "registry+https://github.com/rust-lang/crates.io-index"
69 77
 dependencies = [
70
- "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
78
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
71 79
 ]
72 80
 
73 81
 [[package]]
74 82
 name = "rustc-demangle"
75
-version = "0.1.9"
83
+version = "0.1.14"
76 84
 source = "registry+https://github.com/rust-lang/crates.io-index"
77 85
 
78 86
 [[package]]
79 87
 name = "sokoban-core"
80 88
 version = "0.1.0"
81 89
 dependencies = [
82
- "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
90
+ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
83 91
 ]
84 92
 
85 93
 [[package]]
86 94
 name = "syn"
87
-version = "0.15.18"
95
+version = "0.15.30"
88 96
 source = "registry+https://github.com/rust-lang/crates.io-index"
89 97
 dependencies = [
90
- "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
91
- "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
98
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
99
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
92 100
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
93 101
 ]
94 102
 
@@ -97,9 +105,9 @@ name = "synstructure"
97 105
 version = "0.10.1"
98 106
 source = "registry+https://github.com/rust-lang/crates.io-index"
99 107
 dependencies = [
100
- "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
101
- "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
102
- "syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)",
108
+ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
109
+ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
110
+ "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)",
103 111
  "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
104 112
 ]
105 113
 
@@ -110,7 +118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
110 118
 
111 119
 [[package]]
112 120
 name = "winapi"
113
-version = "0.3.6"
121
+version = "0.3.7"
114 122
 source = "registry+https://github.com/rust-lang/crates.io-index"
115 123
 dependencies = [
116 124
  "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -128,19 +136,20 @@ version = "0.4.0"
128 136
 source = "registry+https://github.com/rust-lang/crates.io-index"
129 137
 
130 138
 [metadata]
131
-"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
132
-"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
133
-"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
134
-"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
135
-"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7"
136
-"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596"
137
-"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
138
-"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee"
139
-"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b"
140
-"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
141
-"checksum syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)" = "90c39a061e2f412a9f869540471ab679e85e50c6b05604daf28bc3060f75c430"
139
+"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
140
+"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637"
141
+"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6"
142
+"checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83"
143
+"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4"
144
+"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
145
+"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
146
+"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917"
147
+"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
148
+"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
149
+"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288"
150
+"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2"
142 151
 "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
143 152
 "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
144
-"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
153
+"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
145 154
 "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
146 155
 "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

+ 14
- 8
core/src/audio.rs View File

@@ -16,6 +16,20 @@ pub struct AudioConfig {
16 16
 
17 17
 impl AudioConfig {
18 18
     pub fn new() -> AudioConfig {
19
+        Default::default()
20
+    }
21
+
22
+    pub fn get_num_audio_tracks(&self) -> usize {
23
+        self.tracks.len()
24
+    }
25
+
26
+    pub fn get_audio_track_info(&self, index: usize) -> Option<&AudioTrackInfo> {
27
+        self.tracks.get(index)
28
+    }
29
+}
30
+
31
+impl Default for AudioConfig {
32
+    fn default() -> AudioConfig {
19 33
         AudioConfig {
20 34
             tracks: vec![
21 35
                 AudioTrackInfo {
@@ -33,12 +47,4 @@ impl AudioConfig {
33 47
             ],
34 48
         }
35 49
     }
36
-
37
-    pub fn get_num_audio_tracks(&self) -> usize {
38
-        self.tracks.len()
39
-    }
40
-
41
-    pub fn get_audio_track_info(&self, index: usize) -> Option<&AudioTrackInfo> {
42
-        self.tracks.get(index)
43
-    }
44 50
 }

+ 18
- 22
core/src/game.rs View File

@@ -285,7 +285,7 @@ impl Game {
285 285
             };
286 286
 
287 287
             if level_num == self.level_number {
288
-                let tau = 3.141_592_653 * 2.0;
288
+                let tau = std::f32::consts::PI * 2.0;
289 289
                 let num_waves = 3.0;
290 290
 
291 291
                 let a = (self.showing_progress_timer / self.showing_progress_time_limit)
@@ -350,14 +350,13 @@ impl Game {
350 350
         // returns true if tick should be called again
351 351
         //
352 352
 
353
-        let corrected_delta;
354
-        // prevent a crazy delta value if we're resuming from a paused state
355
-        if self.resume_from_paused {
353
+        let corrected_delta = if self.resume_from_paused {
354
+            // prevent a crazy delta value if we're resuming from a paused state
356 355
             self.resume_from_paused = false;
357
-            corrected_delta = 0.0;
356
+            0.0
358 357
         } else {
359
-            corrected_delta = delta;
360
-        }
358
+            delta
359
+        };
361 360
 
362 361
         if self.debug_mode {
363 362
             self.debug_flash = !self.debug_flash;
@@ -385,17 +384,15 @@ fn play_sound(host: &Host, sound_effect: SoundEffect) {
385 384
 }
386 385
 
387 386
 fn update_pause_menu(game: &mut Game, host: &Host, controller: &Controller) -> bool {
388
-    let mut update = false;
389
-
390
-    if controller.just_pressed(ControllerButton::Down) {
387
+    let mut update = if controller.just_pressed(ControllerButton::Down) {
391 388
         game.menu_active_item += 1;
392
-        update = true;
393
-    }
394
-
395
-    if controller.just_pressed(ControllerButton::Up) {
389
+        true
390
+    } else if controller.just_pressed(ControllerButton::Up) {
396 391
         game.menu_active_item -= 1;
397
-        update = true;
398
-    }
392
+        true
393
+    } else {
394
+        false
395
+    };
399 396
 
400 397
     game.menu_active_item = mathutils::wrap(game.menu_active_item, 0, game.menu_num_items - 1);
401 398
 
@@ -432,12 +429,11 @@ fn update_pause_menu(game: &mut Game, host: &Host, controller: &Controller) -> b
432 429
         game.menu_curvature = mathutils::clamp(game.menu_curvature, 0, game.menu_max_curvature);
433 430
     }
434 431
 
435
-    if game.menu_active_item == 3 {
436
-        if controller.just_pressed(ControllerButton::Start) {
437
-            // let _ = game.restart(random);
438
-            update = true;
439
-        }
432
+    if game.menu_active_item == 3 && controller.just_pressed(ControllerButton::Start) {
433
+        // let _ = game.restart(random);
434
+        update = true;
440 435
     }
436
+
441 437
     update
442 438
 }
443 439
 
@@ -549,7 +545,7 @@ fn move_hero(host: &Host, level: &mut Level, dir: Direction) -> error::Result<Op
549 545
 
550 546
         for entity in &next_tile.entities {
551 547
             if entity.is_movable() {
552
-                if next_along_tile.can_entity_be_moved_here(entity) {
548
+                if next_along_tile.can_entity_be_moved_here(*entity) {
553 549
                     shoved_along.push(entity.clone());
554 550
                 } else {
555 551
                     // can't push the existing entity of the next_pos onto their next_pos

+ 3
- 3
core/src/geometry.rs View File

@@ -443,7 +443,7 @@ impl Geometry {
443 443
     // remaining lines in pos.y - n
444 444
     pub fn push_centred_boxed_multiline(
445 445
         &mut self,
446
-        lines: &Vec<&str>,
446
+        lines: &[&str],
447 447
         centre: Tile2D,
448 448
         text_col: RGB,
449 449
         background_colour: RGB,
@@ -473,9 +473,9 @@ impl Geometry {
473 473
             background_colour,
474 474
         );
475 475
 
476
-        for y in 0..height {
476
+        for (y, line) in lines.iter().enumerate().take(height) {
477 477
             self.push_text(
478
-                lines[y],
478
+                line,
479 479
                 Tile2D {
480 480
                     x: pos.x,
481 481
                     y: pos.y - (y as i32),

+ 1
- 1
core/src/level.rs View File

@@ -51,7 +51,7 @@ impl Level {
51 51
     }
52 52
 
53 53
     pub fn completed_level(&self) -> bool {
54
-        self.floor.iter().all(|t| t.completed())
54
+        self.floor.iter().all(Tile::completed)
55 55
     }
56 56
 
57 57
     pub fn update_geometry(&self, _host: &Host, geometry: &mut Geometry) {

+ 22
- 27
core/src/level_builder.rs View File

@@ -10,37 +10,37 @@ pub struct LevelBlueprint {
10 10
 
11 11
 impl LevelBlueprint {
12 12
     /*
13
-     * H: hero
13
+    * H: hero
14 14
 
15
-     * x: red wall
15
+    * x: red wall
16 16
 
17
-     * W: wood block
18
-     * R: red block
19
-     * B: blue block
20
-     * G: green block
21
-     * S: stone block
17
+    * W: wood block
18
+    * R: red block
19
+    * B: blue block
20
+    * G: green block
21
+    * S: stone block
22 22
 
23
-     * h: hole
24
-     * w: wood hole
25
-     * r: red hole
26
-     * b: blue hole
27
-     * g: green hole
28
-     * s: stone hole
23
+    * h: hole
24
+    * w: wood hole
25
+    * r: red hole
26
+    * b: blue hole
27
+    * g: green hole
28
+    * s: stone hole
29 29
 
30
-     * m: marker
31
-     * ?: wood marker
32
-     * ?: red marker
33
-     * ?: blue marker
34
-     * ?: green marker
35
-     * ?: stone marker
30
+    * m: marker
31
+    * ?: wood marker
32
+    * ?: red marker
33
+    * ?: blue marker
34
+    * ?: green marker
35
+    * ?: stone marker
36 36
 
37
-     * M: hole + marker
37
+    * M: hole + marker
38 38
 
39 39
 
40 40
 
41
-     */
41
+    */
42 42
 
43
-    #[cfg_attr(rustfmt, rustfmt_skip)]
43
+    #[rustfmt::skip]
44 44
     pub fn get(level_number: i32) -> Self {
45 45
         match level_number {
46 46
             0 => LevelBlueprint {
@@ -180,7 +180,6 @@ fn add_marker(
180 180
             sprite,
181 181
             entity_type: EntityType::Marker,
182 182
             colour,
183
-            ..Default::default()
184 183
         },
185 184
     )
186 185
 }
@@ -206,7 +205,6 @@ fn add_block(
206 205
             sprite,
207 206
             entity_type: EntityType::Block,
208 207
             colour,
209
-            ..Default::default()
210 208
         },
211 209
     )
212 210
 }
@@ -232,7 +230,6 @@ fn add_sunken_block(
232 230
             sprite,
233 231
             entity_type: EntityType::SunkenBlock,
234 232
             colour,
235
-            ..Default::default()
236 233
         },
237 234
     )
238 235
 }
@@ -253,7 +250,6 @@ fn add_hole(level: &mut Level, pos_x: i32, pos_y: i32, colour: SokobanColour) ->
253 250
             sprite,
254 251
             entity_type: EntityType::Hole,
255 252
             colour,
256
-            ..Default::default()
257 253
         },
258 254
     )
259 255
 }
@@ -274,7 +270,6 @@ fn add_wall(level: &mut Level, pos_x: i32, pos_y: i32, colour: SokobanColour) ->
274 270
             sprite,
275 271
             entity_type: EntityType::Wall,
276 272
             colour,
277
-            ..Default::default()
278 273
         },
279 274
     )
280 275
 }

+ 4
- 1
core/src/lib.rs View File

@@ -1,5 +1,8 @@
1 1
 #![allow(dead_code)]
2
-#![cfg_attr(feature = "cargo-clippy", allow(many_single_char_names, too_many_arguments))]
2
+#![cfg_attr(
3
+    feature = "cargo-clippy",
4
+    allow(clippy::many_single_char_names, clippy::too_many_arguments)
5
+)]
3 6
 
4 7
 #[macro_use]
5 8
 extern crate failure;

+ 3
- 3
core/src/tile.rs View File

@@ -65,14 +65,14 @@ impl Default for Entity {
65 65
 }
66 66
 
67 67
 impl Entity {
68
-    pub fn is_movable(&self) -> bool {
68
+    pub fn is_movable(self) -> bool {
69 69
         match self.entity_type {
70 70
             EntityType::Block => true,
71 71
             _ => false,
72 72
         }
73 73
     }
74 74
 
75
-    pub fn is_barrier_for_hero(&self) -> bool {
75
+    pub fn is_barrier_for_hero(self) -> bool {
76 76
         match self.entity_type {
77 77
             EntityType::Wall => true,
78 78
             EntityType::Hole => true,
@@ -184,7 +184,7 @@ impl Tile {
184 184
         !self.entities.iter().any(|e| e.is_barrier_for_hero())
185 185
     }
186 186
 
187
-    pub fn can_entity_be_moved_here(&self, entity: &Entity) -> bool {
187
+    pub fn can_entity_be_moved_here(&self, entity: Entity) -> bool {
188 188
         if self.entities.is_empty() {
189 189
             return true;
190 190
         }

Loading…
Cancel
Save