-
-
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
base: master
Are you sure you want to change the base?
Fix Issue #997 #998
Conversation
…object now, not an array. Had to adjust for that
You know what would be great? If the PR's or engine have some sort of description of which branch of Assets they need to be tested against. |
Having a problem with game crashing after launching new campaign. Here's the debugger output: Is this the same problem? |
@kheckwrecker yeah, I'm pretty sure that's the same problem that this PR addresses. Or one of them, anyway. |
Ok. I'll try pulling this patch and see if it works. |
GitHub is having trouble with the pull request. Something about not find your work? Anyway, I'll just wait until it's approved and merged then try again. |
I pulled this patch and re-compiled, but it's still crashing with the same error. It's entirely possible that I'm screwing up the pull and merge, so I'll wait and try again after this patch is officially merged with master. If the problem still occurs after that, I'll create a new issue report. |
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.
Where is the fix for root? I assumed the offending line would be
unit_attributes["root"] = file.GetRoot();
but you didn't actually change it.
#include <vector> | ||
#include <string> | ||
#include <map> | ||
#include <boost/json.hpp> | ||
|
||
#include "resource/json_utils.h" | ||
|
||
|
||
void UnitJSONFactory::ParseJSON(VSFileSystem::VSFile &file, bool player_ship) { |
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:
[
{"a": "1", "b": 2},
{"a": "1", "b": 2},
{"a": "1", "b": 2},
...
]
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.
I thought it would be too, but as it turned out, that was not the problem. |
…ed by WriteUnit(), as per peer review
Code Changes:
Issues:
Purpose: