-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PROCESS JSON COMMAND - New Features #3341
base: master
Are you sure you want to change the base?
Conversation
We had this discussion before: Exceptions ( (and our homebrew platforms but they do not have JSON support enabled so you do not see them failing here) |
The Operations were updated to: 0: GET 1: SET 2: GET LENGTH 3: GET KEYS 4: GET VAR TYPE There are also new Flags: - Extract data from json path - similar to how stringvars extracts. - Prettify json - to make its output easier to read. Update json_helper.cpp
e632a37
to
b1c6177
Compare
Sorry about the confusion, Now the code is way closer to how initially was |
I found some OOB crashes from the older implementation, "lists": {
"length": 5,
"data": [{
"id": "MAP TYPE",
"length": 7,
"values": ["EasyRPG World", "EasyRPG Exterior", "EasyRPG Interior", "EasyRPG Dungeon", "EasyRPG Ship", "Uncanny World", "Danny's House"],
"chipset_files": ["EasyRPG_World", "EasyRPG_Exterior", "easyRPG_interiorB", "EasyRPG_Dungeon", "EasyRPG_Ship", "EasyRPG+gfragger_mkt_CCBY", "EasyRPG+kotatsuAkira_Interior_CC0"],
"tileset_locations": [1531, 1535, 1534, 1533, 1532, 523, 524],
"current": 0
},
{
"id": "TILES LAYER",
"length": 3,
"values": ["LOWER", "UPPER", "EVENTS"],
"current": 0
},
{
"id": "DRAW AUTOTILES",
"length": 2,
"values": ["YES", "NO"],
"current": 0
},
{
"id": "MAP PANORAMA",
"length": 4,
"values": ["[OFF]", "A", "B", "C"],
"current": 0
},
{
"id": "BACKGROUND MUSIC",
"length": 4,
"values": ["[OFF]", "A", "B", "C"],
"current": 0
}
]
}, I thought about adding some error messages, but those messages could conflict with cases such as: [
[-6,-6,-6,-6,-6,-6,-6,-6,-6,-6],
[6,-6,-6,null,-6,-6,-6],[-6,-6,-6,-6,-6,-6,-6,null,null,null,-6,-6],
[-6,6,-6,null,-6,-6,-6,-6,-6,-6,-6,-6],
[-6,6,6,null,14,14,14,-6,14,14,14,-6,14,14,14,null,14,14,14,6],
[6,6,6,null,null,14,6,null,14,null,null,null,14,-6,-6,-6,-6,14]
] where I wanted to have null values to fast walk through a list of map tiles. |
…lohmann::ordered_json this can break for loops, and it's a weird extra step when processing json data
…da functions to reduce repetition.
5782f85
to
badd8c6
Compare
To fix (well, disable) nlohmann for Ubuntu 20.04 you must require a newer version of nlohmann. 3.9.1 appears to work. In CMakeLists: player_find_package(NAME nlohmann_json
VERSION 3.9.1
CONDITION PLAYER_WITH_NLOHMANN_JSON
DEFINITION HAVE_NLOHMANN_JSON
TARGET nlohmann_json::nlohmann_json
ONLY_CONFIG
) There are 2 cases where nlohmann_json is used in the file. Please add configure.ac:
|
Another observation:
|
btw to handle the complexity I wrote unit tests to verify the JSON Api (will commit them when the remarks are addressed). Can confirm that the rest of it appears to work 👍 . Good job. Also found the |
Make it possible to configure the "keys" output of "GetKeys"
fdcd3bb
to
81f1b88
Compare
Compile fix for old nlohmann version
The Operations were updated to:
0: GET VALUE
1: SET VALUE
2: GET LENGTH
3: GET KEYS
4: GET VAR TYPE
5: REMOVE VALUE
6: PUSH INTO ARRAW
7: POP FROM ARRAY
8: CHECK IF VALUE EXISTS
There are also new Flags: