We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Magic number is a numerical constant in the code, the purpose of which is unclear. Example from Platform.cpp:
Platform.cpp
platformSpeed = speed * 0.00125;
What does 0.00125 mean? In most cases, this is corrected by adding #define directive with this number in header file. In that case it should be like:
#define
// Platform.h #define MEANING_OF_MAGIC_NUMBER 0.00125
The similar sutuation with AllHitboxInf::animationProcess. For example, in this function:
AllHitboxInf::animationProcess
// Platform.cpp : line 45 void Platform::drawObject(float &time) { if (AHI->animationProcess != 1) movePlatform(time, AHI); }
We can't understand what does 1 mean, without comments. In this situations, we should use enum, like:
1
enum
enum { LEVEL_PASSING, LEVEL_PASSED_ANIMATION, LEVEL_PASSED };
These are just two examples, there is a lot of this in the code.
The text was updated successfully, but these errors were encountered:
Not a define - use some constants, like constexpr double SPEED_MULTIPLIER = 0.00125;
Sorry, something went wrong.
No branches or pull requests
Magic number is a numerical constant in the code, the purpose of which is unclear.
Example from
Platform.cpp
:platformSpeed = speed * 0.00125;
What does 0.00125 mean?
In most cases, this is corrected by adding
#define
directive with this number in header file.In that case it should be like:
The similar sutuation with
AllHitboxInf::animationProcess
.For example, in this function:
We can't understand what does
1
mean, without comments. In this situations, we should useenum
, like:enum { LEVEL_PASSING, LEVEL_PASSED_ANIMATION, LEVEL_PASSED };
These are just two examples, there is a lot of this in the code.
The text was updated successfully, but these errors were encountered: