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
C++11 patchset 9: move hardcoded init parameters to class definitions (part 1) #5984
Conversation
77d4a21
to
260bcae
Compare
src/clientiface.h
Outdated
@@ -388,7 +364,7 @@ class RemoteClient | |||
Block is removed when GOTBLOCKS is received. | |||
Value is time from sending. (not used at the moment) | |||
*/ | |||
std::map<v3s16, float> m_blocks_sending; | |||
std::map<v3s16, float> m_blocks_sending = {}; |
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.
Aren't sets/maps defined to be empty when initialized?
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.
Yes
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 forgot to remove that my bad :)
src/collision.h
Outdated
v3s16 node_p = v3s16(-32768,-32768,-32768); // COLLISION_NODE | ||
bool bouncy = false; | ||
v3f old_speed = v3f(0.0f, 0.0f, 0.0f); | ||
v3f new_speed = v3f(0.0f, 0.0f, 0.0f); |
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.
They're defined to be 0,0,0
in the constructor without args
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.
then i will remove all standard v3f v3s16 :)
src/clouds.h
Outdated
v2f m_speed; | ||
v3s16 m_camera_offset; | ||
video::SColorf m_color; | ||
v3s16 m_camera_offset = v3s16(0, 0, 0); |
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.
Also set to 0 when initialized.
C++11 introduced the possibility to define the default values directly in class definitions, do it on current code Also remove some unused attributes * CollisionInfo::bouncy * collisionMoveResult::collides_xy * collisionMoveResult::standing_on_unloaded * Clouds::speed
260bcae
to
9f4c5e3
Compare
All points fixed |
@@ -499,7 +498,6 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, | |||
info.type = COLLISION_NODE; | |||
|
|||
info.node_p = nearest_info.position; | |||
info.bouncy = bouncy; |
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 affected but never used since 2012 it's why i removed them from code
* remove only write guiFormSpecMenu::m_old_tooltip * move header included inside defintions in genericobject.h * remove some unused since years exception classes * remove unused & empty debug_stacks_init * remove unused & empty content_nodemeta_serialize_legacy * remove forgotten useless bool (bouncy) in collision.cpp code
I added a second commit to this PR to make things advance (it's boring task but should be done) |
bool m_physics_override_sneak = true; | ||
bool m_physics_override_sneak_glitch = false; | ||
bool m_physics_override_new_move = true; | ||
bool m_physics_override_sent = false; |
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.
Could you please line up these values for better readability?
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.
what do you mean ?
src/guiChatConsole.h
Outdated
|
||
// font | ||
gui::IGUIFont* m_font; | ||
gui::IGUIFont* m_font = 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.
Wrong pointer position
src/guiEngine.h
Outdated
@@ -272,7 +272,7 @@ class GUIEngine { | |||
void setTopleftText(const std::string &text); | |||
|
|||
/** pointer to gui element shown at topleft corner */ | |||
irr::gui::IGUIStaticText* m_irr_toplefttext; | |||
irr::gui::IGUIStaticText* m_irr_toplefttext = 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.
Pointer style wrong here too
👍 |
bool bouncy; | ||
CollisionInfo() {} | ||
CollisionType type = COLLISION_NODE; | ||
v3s16 node_p = v3s16(-32768,-32768,-32768); // COLLISION_NODE |
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.
Is it safe to use -32768?
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.
the value fits in the container, i don't really know it's the original behaviour, i think we can keep this as is as it's not a PR which should trigger regression by changing values :)
… (part 1) (minetest#5984) * C++11 patchset 9: move hardcoded init parameters to class definitions C++11 introduced the possibility to define the default values directly in class definitions, do it on current code Also remove some unused attributes * CollisionInfo::bouncy * collisionMoveResult::collides_xy * collisionMoveResult::standing_on_unloaded * Clouds::speed * More constructor cleanups + some variables removal * remove only write guiFormSpecMenu::m_old_tooltip * move header included inside defintions in genericobject.h * remove some unused since years exception classes * remove unused & empty debug_stacks_init * remove unused & empty content_nodemeta_serialize_legacy * remove forgotten useless bool (bouncy) in collision.cpp code
… (part 1) (minetest#5984) * C++11 patchset 9: move hardcoded init parameters to class definitions C++11 introduced the possibility to define the default values directly in class definitions, do it on current code Also remove some unused attributes * CollisionInfo::bouncy * collisionMoveResult::collides_xy * collisionMoveResult::standing_on_unloaded * Clouds::speed * More constructor cleanups + some variables removal * remove only write guiFormSpecMenu::m_old_tooltip * move header included inside defintions in genericobject.h * remove some unused since years exception classes * remove unused & empty debug_stacks_init * remove unused & empty content_nodemeta_serialize_legacy * remove forgotten useless bool (bouncy) in collision.cpp code
C++11 introduced the possibility to define the default values directly in class definitions, do it on current code
This patchset cleanup src/{a*,b*,c*-> constants.h} files