Asterix Gaming Guild Logo GeneralXXLXXL 2XXL 3XXXLOlympic GamesXXL EditorToolsOff-TopicXXL RomasteredXXL 2 RemasteredOther GamesModsCaesar's ChallengeUnfair XXLPatchesFan ArtPersonal ArtSpeedrunningMediaRandomizerBETA RomeHSKALPresence AdrienPresence SPQRSupport Bot Helpdesk

#editor

deathhound246
Since there's numerous files for each game, is there like a "utility" function to get the file contents (perhaps parsed already) depending on the selected game?
adrientd
You can get the content of the JSON files (Properties_Common.json etc.) from the Encyclopedia class
pfahli
Alternative suggestion
deathhound246
It keeps crashing when attempting to load the json file into the encyclodpedia
deathhound246
specifically on this assertion
adrientd
Maybe the file is missing.
deathhound246
i changed it back to properties common and it seems happier. now there's just the issue of if the class isn't in the json file
deathhound246
im pretty sure i had the file spelling correct though, and the file is there (perhaps it was left out of the compilation or something?)
adrientd
Yes, the file is obtained via GetResourceContent, which normally gets the file content through the resources inside the exe, if you added a new file that you might have to include it in the resource script (Resource.rc file)
adrientd
If you doesn't find the file in the resources, it will also look for the file in the "xec_resources" folder. If you run the editor from VS, that folder is in the project's folder.
deathhound246
for `g_encyclo.kclasses`, is the map keys just the class full id?
adrientd
yes, so ` | ( << 6)`
adrientd
or ` + ( * 64)` :Obelul:
deathhound246
I'm doing this already, but still seems to be coming back, either than it can't get the key, or that I'm probably not grabbing the name field correctly (latter is most likely :Obelul: )
deathhound246
It's not crashing though! Progress
deathhound246
I don't think this is right :FrogThinking:
deathhound246
(printf is bad i know, its just temporary for debuggin)
adrientd
I think you hit one of many C++ pitfalls. :Obelul: The string you get from `classinfo.at("name").dump()` is a temporary, so it gets destroyed at the next line. Using c_str to get a pointer to the string data does not extend its lifetime.
adrientd
Do something like this: ```C++ std::string classname = classinfo.at("name").dump(); printf("Classname: %s\n", classname.c_str());```
deathhound246
i was using `.get()` (from github copilot) before dump, and it was seemingly doing the same thing :Obelul: