Commit 19d7d10
authored
Fix broken script when json is not in TF/O/M/D order (#75)
Seems like this is a known issue from when parseJson was first
implemented in #8.
> Behavior is undefined if not entered in order of all characters of
each category in order Townsfolk, Outsiders, Minion, Demon
It's an easy fix, just do a stable-sort in TF/O/M/D order. Tested with a
randomly shuffled TB script:
`http://localhost:5173/script.html?json=[{"id": "mayor"}, {"id":
"poisoner"}, {"id": "investigator"}, {"id": "soldier"}, {"id":
"undertaker"}, {"id": "spy"}, {"id": "virgin"}, {"id": "empath"}, {"id":
"butler"}, {"id": "slayer"}, {"id": "monk"}, {"id": "_meta", "name":
"Trouble Brewing"}, {"id": "recluse"}, {"id": "baron"}, {"id": "saint"},
{"id": "scarletwoman"}, {"id": "washerwoman"}, {"id": "fortuneteller"},
{"id": "chef"}, {"id": "ravenkeeper"}, {"id": "imp"}, {"id": "drunk"},
{"id": "librarian"}]`
<img width="1049" height="1276" alt="image"
src="https://github.com/user-attachments/assets/64de3a15-5de1-4556-bf79-881a2f126730"
/>1 parent dc2d752 commit 19d7d10
2 files changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
| |||
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
40 | | - | |
| 47 | + | |
| 48 | + | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
| |||
0 commit comments