-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Auto-generate configuration based on config.json #1052
base: master
Are you sure you want to change the base?
Conversation
@@ -1,8 +1,8 @@ | |||
/* | |||
* configuration.cpp | |||
* configuration.h |
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.
Incorrect
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 vote would be to get rid of all those, that's just useless cruft, IMHO.
* | ||
* Copyright (C) 2021-2022 Daniel Horn, Roy Falk, ministerofinformation, | ||
* David Wales, Stephen G. Tuggy, and other Vega Strike contributors | ||
* Copyright (C) 2021-2023 Daniel Horn, Roy Falk, ministerofinformation, |
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.
Shouldn't the end year be 2025?
std::shared_ptr<Configuration> configuration() { | ||
static std::shared_ptr<Configuration> kConfiguration = nullptr; |
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 think I was the one who introduced this form of singleton for holding the Configuration object. Unfortunately, I don't think my code was quite correct. At least, I don't think it's a true Meyers singleton if it uses a pointer instead of a reference for the static variable.
Hopefully this won't be too difficult to fix in your Json Struct generation code, @royfalk . The Vega Strike Logger class should demonstrate how to implement a Meyers singleton properly. (At least I think I have it right finally.)
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 think I was the one who introduced this
Yes.
Hopefully this won't be too difficult to fix in your Json Struct generation code, @royfalk . The Vega Strike Logger class should demonstrate how to implement a Meyers singleton properly. (At least I think I have it right finally.)
I'll take a look.
return kConfiguration; | ||
} | ||
} |
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.
Missing LF at end of file
@@ -1,8 +1,8 @@ | |||
/* | |||
* configuration.h | |||
* configuration.cpp |
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.
Looks like the .cpp and .h files got their headers switched around.
* | ||
* Copyright (C) 2021-2023 Daniel Horn, Roy Falk, ministerofinformation, | ||
* David Wales, Stephen G. Tuggy, Benjamen R. Meyer, and other Vega Strike contributors | ||
* Copyright (C) 2021-2022 Daniel Horn, Roy Falk, ministerofinformation, |
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 believe the end year here should also be 2025.
}; | ||
|
||
extern std::shared_ptr<Configuration> configuration(); | ||
|
||
#endif //VEGA_STRIKE_ENGINE_CONFIG_CONFIGURATION_H | ||
#endif //VEGA_STRIKE_ENGINE_CONFIG_CONFIGURATION_H |
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.
Missing LF at end of file
Looks pretty good for the most part. Thanks, @royfalk |
|
||
const float max = diamond_size * r_size * 0.75f * configuration()->graphics_config.hud.min_missile_bracket_size; | ||
const float coord = configuration()->graphics_config.hud.min_missile_bracket_size + (configuration()->graphics_config.hud.max_missile_bracket_size - configuration()->graphics_config.hud.min_missile_bracket_size) * lock_percent; | ||
const float max = diamond_size * r_size * 0.75f * configuration()->hud.min_missile_bracket_size; |
Check failure
Code scanning / CodeQL
Multiplication result converted to larger type High
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 ensure this is fixed
This uses my https://github.com/royfalk/JsonStruct project to auto-generate configuration.h/cpp based on config.json.
Please answer the following:
Code Changes:
Issues: