playbymail / Far-Horizons

Far Horizons is a strategic play-by-email (PBeM) game of galactic exploration, trade, diplomacy, and conquest. This repository contains the game engine source code.
GNU General Public License v3.0
2 stars 2 forks source link

JSON Import Does not appear to work #7

Closed gmsshadow closed 11 months ago

gmsshadow commented 11 months ago

I tried to re import the JSON after editing but I keep getting the following errors:

[ec2-user@ip-172-31-39-194 shadow]$ sudo FH_SEED=$RANDOM ../build/fh import --file=galaxy.json unmarshalData: unknown key 'data.num_species' [ec2-user@ip-172-31-39-194 shadow]$ sudo ../build/fh import --file=sp01.species.json unmarshalData: unknown key 'data.id' [ec2-user@ip-172-31-39-194 shadow]$ sudo FH_SEED=$RANDOM ../build/fh import --file=sp01.ships.json unmarshalData: unknown key 'data.species_no'

mdhender commented 11 months ago

Rewrote all of the JSON import and export. Removed the hand-krufted code and replaced with the cJSON library.

Both the fh import json and fh export json work with the entire data set now. This was changed from the prior behavior (importing and exporting a single data type) to keep the files in sync with each other. The README file has been updated to include these changes.

The alpha/rebuild.sh script runs some basic tests. Needs to be updated to remove hard-coded paths and perform more tests to verify that internal indexes are updated correctly when importing things like new ships and planets.

Can be used with caution and plenty of backing up of your data.