-
Notifications
You must be signed in to change notification settings - Fork 24
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
Conversation
|
||
|
||
|
||
bool LegacyLadderConfig::ParseConfig() |
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 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.
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 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: |
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.
Please use explicit in the constructor.
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.
Any specific reason for this? or is this just good practice?
Either way, happy to 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.
There are number of caveats behind, see:
https://stackoverflow.com/questions/12437241/c-always-use-explicit-constructor/12437453
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.
Thanks for the info.
I'll resolve any merge conflicts when I get a chance. |
Changes pushed. |
@@ -0,0 +1,12 @@ | |||
{ | |||
"CommandCenterPath": "./path/to/CommandCenter.exe", | |||
"LocalReplayDirectory": "./Replays/", |
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.
Btw we should fix this trailing slash somehow cause the server doesn't work without it.
Of course, not in this PR.
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.
Agreed - this is a good suggestion.
I will add a github issue for this.
src/sc2laddercore/LadderConfig.cpp
Outdated
} | ||
return true; | ||
else |
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.
Style: else is not needed after return. Here and in other places.
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.
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.
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.
Nope, this is a matter of taste.
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.
No problem - I have updated it for you.
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.
Thank you!
src/sc2laddercore/LadderConfig.cpp
Outdated
{ | ||
Str.erase(p + 1); | ||
if (doc[RequestedValue].IsString()) | ||
return doc[RequestedValue].GetString(); |
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.
Should always have braces on an if statement, just makes things a lot cleaner and easier to read
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.
This one is fixed.
Intended to resolve #71
Suggestions welcome.