CleverRaven / CleverRaven/Cataclysm-DDA
Name as an object not supported for some types
- Dominant language
- C++
- Stars
- 13.1k
- Forks
- 4.6k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 200
Description
# Describe the bug
Writing the ammunition_type name as "name": { "str": ".223" },
produces this error:
```
DEBUG : Error: data/mods//dda/../../json/items/ammo_types.json: line 101:13: expecting string but got '{'
"type": "ammunition_type",
"id": "22",
"name": {
^
"str": ".22" },
"default": "22_lr"
},
FUNCTION : bool main_menu::load_character_tab(bool)
FILE : src/main_menu.cpp
LINE : 1074
```
The same applies to type 'material' and possibly more. I will reply to this issue if I find more.
# Steps To Reproduce
Steps to reproduce the behavior:
1. Write "name": { "str": ".223" } in ammunition_type
3. Start a game
4. Observe error
# Expected behavior
Accepting the name as an object
# Versions and configuration
- OS: Windows
- OS Version: MINGW/CYGWIN/MSYS2 on unknown Windows version
- Game Version: 0.D-11806-g9df6c1607d [64-bit]
- Graphics Version: Tiles
- Mods loaded: [
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
Aftershock [aftershock],
C.R.I.T Expansion Mod [crt_expansion],
Magiclysm [magiclysm],
]
# Additional context
In order to implement #36611 and fix #36110 this issue needs to be solved.
The solution used in #37697 can probably work here too.
Contributor guide
Research direction
Start with data/mods//dda/../../json/items/ammo_types.json around line 101 and the load_character_tab entry point in src/main_menu.cpp. Compare the solution used in #37697 and check how ammunition_type and material names are parsed; done means name objects are accepted for these types without the reported loading error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, json
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100