You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
This commit is contained in:
@@ -132,11 +132,7 @@ void InputEvent::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device");
|
||||
}
|
||||
|
||||
InputEvent::InputEvent() {
|
||||
|
||||
device = 0;
|
||||
}
|
||||
////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventFromWindow::_bind_methods() {
|
||||
|
||||
@@ -152,11 +148,7 @@ int64_t InputEventFromWindow::get_window_id() const {
|
||||
return window_id;
|
||||
}
|
||||
|
||||
InputEventFromWindow::InputEventFromWindow() {
|
||||
window_id = 0;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventWithModifiers::set_shift(bool p_enabled) {
|
||||
|
||||
@@ -236,15 +228,7 @@ void InputEventWithModifiers::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "command"), "set_command", "get_command");
|
||||
}
|
||||
|
||||
InputEventWithModifiers::InputEventWithModifiers() {
|
||||
|
||||
alt = false;
|
||||
shift = false;
|
||||
control = false;
|
||||
meta = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventKey::set_pressed(bool p_pressed) {
|
||||
|
||||
@@ -411,16 +395,7 @@ void InputEventKey::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "echo"), "set_echo", "is_echo");
|
||||
}
|
||||
|
||||
InputEventKey::InputEventKey() {
|
||||
|
||||
pressed = false;
|
||||
keycode = 0;
|
||||
physical_keycode = 0;
|
||||
unicode = 0; ///unicode
|
||||
echo = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventMouse::set_button_mask(int p_mask) {
|
||||
|
||||
@@ -465,12 +440,7 @@ void InputEventMouse::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "global_position"), "set_global_position", "get_global_position");
|
||||
}
|
||||
|
||||
InputEventMouse::InputEventMouse() {
|
||||
|
||||
button_mask = 0;
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventMouseButton::set_factor(float p_factor) {
|
||||
|
||||
@@ -608,15 +578,7 @@ void InputEventMouseButton::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "doubleclick"), "set_doubleclick", "is_doubleclick");
|
||||
}
|
||||
|
||||
InputEventMouseButton::InputEventMouseButton() {
|
||||
|
||||
factor = 1;
|
||||
button_index = 0;
|
||||
pressed = false;
|
||||
doubleclick = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventMouseMotion::set_tilt(const Vector2 &p_tilt) {
|
||||
|
||||
@@ -773,12 +735,7 @@ void InputEventMouseMotion::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
|
||||
}
|
||||
|
||||
InputEventMouseMotion::InputEventMouseMotion() {
|
||||
|
||||
pressure = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventJoypadMotion::set_axis(int p_axis) {
|
||||
|
||||
@@ -849,12 +806,7 @@ void InputEventJoypadMotion::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "axis_value"), "set_axis_value", "get_axis_value");
|
||||
}
|
||||
|
||||
InputEventJoypadMotion::InputEventJoypadMotion() {
|
||||
|
||||
axis = 0;
|
||||
axis_value = 0;
|
||||
}
|
||||
/////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventJoypadButton::set_button_index(int p_index) {
|
||||
|
||||
@@ -931,14 +883,7 @@ void InputEventJoypadButton::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
|
||||
}
|
||||
|
||||
InputEventJoypadButton::InputEventJoypadButton() {
|
||||
|
||||
button_index = 0;
|
||||
pressure = 0;
|
||||
pressed = false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventScreenTouch::set_index(int p_index) {
|
||||
|
||||
@@ -1001,13 +946,7 @@ void InputEventScreenTouch::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
|
||||
}
|
||||
|
||||
InputEventScreenTouch::InputEventScreenTouch() {
|
||||
|
||||
index = 0;
|
||||
pressed = false;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventScreenDrag::set_index(int p_index) {
|
||||
|
||||
@@ -1088,11 +1027,7 @@ void InputEventScreenDrag::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "speed"), "set_speed", "get_speed");
|
||||
}
|
||||
|
||||
InputEventScreenDrag::InputEventScreenDrag() {
|
||||
|
||||
index = 0;
|
||||
}
|
||||
/////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventAction::set_action(const StringName &p_action) {
|
||||
|
||||
@@ -1171,11 +1106,7 @@ void InputEventAction::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_strength", "get_strength");
|
||||
}
|
||||
|
||||
InputEventAction::InputEventAction() {
|
||||
pressed = false;
|
||||
strength = 1.0f;
|
||||
}
|
||||
/////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventGesture::set_position(const Vector2 &p_pos) {
|
||||
|
||||
@@ -1194,7 +1125,8 @@ Vector2 InputEventGesture::get_position() const {
|
||||
|
||||
return pos;
|
||||
}
|
||||
/////////////////////////////
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventMagnifyGesture::set_factor(real_t p_factor) {
|
||||
|
||||
@@ -1235,11 +1167,7 @@ void InputEventMagnifyGesture::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "factor"), "set_factor", "get_factor");
|
||||
}
|
||||
|
||||
InputEventMagnifyGesture::InputEventMagnifyGesture() {
|
||||
|
||||
factor = 1.0;
|
||||
}
|
||||
/////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventPanGesture::set_delta(const Vector2 &p_delta) {
|
||||
|
||||
@@ -1279,11 +1207,7 @@ void InputEventPanGesture::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "delta"), "set_delta", "get_delta");
|
||||
}
|
||||
|
||||
InputEventPanGesture::InputEventPanGesture() {
|
||||
|
||||
delta = Vector2(0, 0);
|
||||
}
|
||||
/////////////////////////////
|
||||
///////////////////////////////////
|
||||
|
||||
void InputEventMIDI::set_channel(const int p_channel) {
|
||||
|
||||
@@ -1390,15 +1314,3 @@ void InputEventMIDI::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_number"), "set_controller_number", "get_controller_number");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_value"), "set_controller_value", "get_controller_value");
|
||||
}
|
||||
|
||||
InputEventMIDI::InputEventMIDI() {
|
||||
|
||||
channel = 0;
|
||||
message = 0;
|
||||
pitch = 0;
|
||||
velocity = 0;
|
||||
instrument = 0;
|
||||
pressure = 0;
|
||||
controller_number = 0;
|
||||
controller_value = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user