Skip to content
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

Config standardization #74

Merged
merged 13 commits into from
Aug 7, 2018
Merged

Conversation

lladdy
Copy link
Contributor

@lladdy lladdy commented Aug 4, 2018

Intended to resolve #71
Suggestions welcome.

  • Previous LadderConfig moved to LegacyLadderConfig in case we decide to still support it.
  • LadderConfig class updated to read and write JSON




bool LegacyLadderConfig::ParseConfig()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote for removal of all the legacy code. There are two reasons behind:
a. We have version control history so can always revert the changes (especially if it would be in a single commit).
b. Current implementation of the cmake routine will grab all the source files, including the legacy code, which means that we have to support this code in the future.

If you still want to keep both implementations, then probably we should use a kind of virtual interface class in order to force both implementation use the same interface and implement it in some way. That will allow to easily switch to a different config in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also like to remove it as well, but I kept it in because it was easy enough, just in case we decided to support backwards compatibility.
If no-one else has any qualms, I'll just remove it.


#include <string>
#include <map>

class LadderConfig
{
public:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use explicit in the constructor.

Copy link
Contributor Author

@lladdy lladdy Aug 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason for this? or is this just good practice?
Either way, happy to do this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info.

@lladdy
Copy link
Contributor Author

lladdy commented Aug 6, 2018

I'll resolve any merge conflicts when I get a chance.

@lladdy
Copy link
Contributor Author

lladdy commented Aug 6, 2018

Changes pushed.

@@ -0,0 +1,12 @@
{
"CommandCenterPath": "./path/to/CommandCenter.exe",
"LocalReplayDirectory": "./Replays/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw we should fix this trailing slash somehow cause the server doesn't work without it.
Of course, not in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - this is a good suggestion.
I will add a github issue for this.

}
return true;
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style: else is not needed after return. Here and in other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just the way I'm used to because I understand it easier - it tells me there should be a return somewhere in the if statement when I see the else return.
Is your suggestion a more standard way of doing it?
Regardless, not too fussed which way it is - just asking for my own edification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, this is a matter of taste.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem - I have updated it for you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

{
Str.erase(p + 1);
if (doc[RequestedValue].IsString())
return doc[RequestedValue].GetString();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should always have braces on an if statement, just makes things a lot cleaner and easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is fixed.

@Cryptyc Cryptyc merged commit 08a6260 into Cryptyc:master Aug 7, 2018
@lladdy lladdy deleted the ConfigStandardization branch October 1, 2018 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Config format standardization
3 participants