-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Fix Issue #997 #998
Open
stephengtuggy
wants to merge
7
commits into
vegastrike:master
Choose a base branch
from
stephengtuggy:fix/issue_997
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+40
−67
Open
Fix Issue #997 #998
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4ec7b97
unit_csv.cpp: Fix issue #997
stephengtuggy 12c7b17
unit_json_factory.cpp: When reading, the root of the file JSON is an …
stephengtuggy 07579b4
unit_json_factory.cpp: More on reading and parsing
stephengtuggy 2625c01
Peer feedback: omit several functions and constructors that aren't ne…
stephengtuggy 35d07a1
unit_json_factory.cpp: Fix error message as per peer review
stephengtuggy db4d8c1
unit_csv.cpp: Put an array at the root of the JSON file that gets sav…
stephengtuggy 21a399f
Merge branch 'master' into fix/issue_997
stephengtuggy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My code (deficiencies and all) assumed the following:
However, this looks like it supports other file formats such as
{"a": "1", "b": 2}
without an array. Why would we do this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that's how the Boost JSON serialization function constructs it. So when we go to load the file, we need to support either format -- with or without an array at the top level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify further: Roy, your code saved an array with a single object element inside of it:
[ { ... } ]
My code simply removes the root array:
{ ... }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we actually want the array. Right now the game saves each ship in its own file. There's no reason to do this. We just need to figure the whole player_ship issue. Either, replace it with player_ship_1...2...3 or player_ship_<random 6 alphanumeric> or something like that and check for prefix.
This would also solve the issue of not supporting a fleet containing two ships of the same type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.