Open olanti-p opened 1 year ago
Modernizing JSON parser to accept type strings over raw integers
i have a JSON mapping script, could you share some conversion guidelines?
It basically boils down to the following steps:
Finding where the parser supports loading both integer values and strings for units.
For example, it seems that any assign( ... )
when used with units will accept both integers and typed strings:
https://github.com/CleverRaven/Cataclysm-DDA/blob/d48717db010722fc43d6aaf8e3ff207de3a6d0a2/src/assign.cpp#L37-L40
There may be more hidden here and there.
Updating these usages in JSON with a script, replacing integer values with typed strings
Some time in the future (when? #3302), dropping the integer support for migrated fields
We have multiple code migration projects that we've inherited from DDA, it'd be nice to have them finished or somehow wrapped up:
player
class intoCharacter
andavatar
.player
class has been used as dumping grounds for all NPC and player character code for a long time, resulting in a mess that became hard to use and debug in context of NPC AI. Theplayer
class should be eliminated, all code that uses it should be changed to use one of the 3 classes:npc
,Character
,avatar
(which to use depends on context)."volume": 1
used to mean250 ml
, but it can now be explicitly specified with"volume": "250 ml"
).string_id
s. This in theory could allow for dynamic anatomies (amputations, extra limbs, limb replacements, multiwielding), but may come with a performance hit (hardcode will always be faster than dynamic, and limbs are accessed and used extensively in the code). Original issue: https://github.com/CleverRaven/Cataclysm-DDA/pull/39068activity_actor
s is they allow custom types and custom type names, which makes it much easier to understand, extend, debug and implement new activities. Original issue: https://github.com/CleverRaven/Cataclysm-DDA/issues/40013point
andtripoint
APIs to use type safe coord types. We've ported the original implementation ( https://github.com/CleverRaven/Cataclysm-DDA/pull/32017 ) and some of the following changes because it was required for other features, but no further systematic work has been done about it.data/json/
and mods. Tracking issue: #1816string_id
activities
toactivity actor
systempoint
andtripoint
to use type safe coord types