From 08f22f1cf0e0d133b7ea763dc3886cf462c6fcb2 Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Sat, 8 Dec 2018 15:07:33 -0500 Subject: [PATCH] Moved member variables to initializer list --- core/core_string_names.cpp | 47 ++-- core/dvector.h | 12 +- core/func_ref.cpp | 5 +- core/io/file_access_compressed.cpp | 35 ++- core/io/file_access_zip.cpp | 89 ++++--- core/io/logger.cpp | 13 +- core/io/marshalls.cpp | 5 +- core/io/packet_peer.cpp | 7 +- core/io/packet_peer_udp.cpp | 13 +- core/io/resource_format_binary.cpp | 11 +- core/io/stream_peer_tcp.cpp | 11 +- core/io/tcp_server.cpp | 5 +- core/math/expression.cpp | 14 +- core/math/expression.h | 4 +- core/math/plane.h | 5 +- core/math/quat.h | 28 ++- core/os/dir_access.cpp | 6 +- core/reference.cpp | 4 +- core/variant_parser.h | 3 +- drivers/alsa/audio_driver_alsa.cpp | 37 ++- drivers/coreaudio/audio_driver_coreaudio.cpp | 26 +- drivers/coremidi/core_midi.cpp | 6 +- drivers/gles2/rasterizer_scene_gles2.h | 49 ++-- drivers/gles2/rasterizer_storage_gles2.h | 150 ++++++------ drivers/gles3/rasterizer_scene_gles3.h | 160 ++++++------ drivers/gles3/rasterizer_storage_gles3.h | 228 +++++++++--------- .../pulseaudio/audio_driver_pulseaudio.cpp | 47 ++-- drivers/rtaudio/audio_driver_rtaudio.cpp | 13 +- drivers/unix/file_access_unix.cpp | 9 +- drivers/unix/net_socket_posix.cpp | 8 +- drivers/wasapi/audio_driver_wasapi.h | 22 +- drivers/windows/file_access_windows.cpp | 9 +- drivers/windows/thread_windows.cpp | 5 +- drivers/xaudio2/audio_driver_xaudio2.cpp | 38 ++- editor/collada/collada.h | 41 ++-- editor/editor_export.cpp | 9 +- editor/editor_export.h | 6 +- editor/editor_help_search.cpp | 22 +- editor/editor_plugin.cpp | 10 +- editor/editor_sectioned_inspector.cpp | 15 +- editor/editor_settings.h | 32 +-- editor/import/editor_scene_importer_gltf.h | 28 +-- editor/plugins/abstract_polygon_2d_editor.cpp | 10 +- .../animation_blend_tree_editor_plugin.h | 6 +- 44 files changed, 609 insertions(+), 694 deletions(-) diff --git a/core/core_string_names.cpp b/core/core_string_names.cpp index ba596f7f16e..8a3fdade64a 100644 --- a/core/core_string_names.cpp +++ b/core/core_string_names.cpp @@ -47,28 +47,27 @@ CoreStringNames::CoreStringNames() : #ifdef TOOLS_ENABLED _sections_unfolded(StaticCString::create("_sections_unfolded")), #endif - _custom_features(StaticCString::create("_custom_features")) { - - x = StaticCString::create("x"); - y = StaticCString::create("y"); - z = StaticCString::create("z"); - w = StaticCString::create("w"); - r = StaticCString::create("r"); - g = StaticCString::create("g"); - b = StaticCString::create("b"); - a = StaticCString::create("a"); - position = StaticCString::create("position"); - size = StaticCString::create("size"); - end = StaticCString::create("end"); - basis = StaticCString::create("basis"); - origin = StaticCString::create("origin"); - normal = StaticCString::create("normal"); - d = StaticCString::create("d"); - h = StaticCString::create("h"); - s = StaticCString::create("s"); - v = StaticCString::create("v"); - r8 = StaticCString::create("r8"); - g8 = StaticCString::create("g8"); - b8 = StaticCString::create("b8"); - a8 = StaticCString::create("a8"); + _custom_features(StaticCString::create("_custom_features")), + x(StaticCString::create("x")), + y(StaticCString::create("y")), + z(StaticCString::create("z")), + w(StaticCString::create("w")), + r(StaticCString::create("r")), + g(StaticCString::create("g")), + b(StaticCString::create("b")), + a(StaticCString::create("a")), + position(StaticCString::create("position")), + size(StaticCString::create("size")), + end(StaticCString::create("end")), + basis(StaticCString::create("basis")), + origin(StaticCString::create("origin")), + normal(StaticCString::create("normal")), + d(StaticCString::create("d")), + h(StaticCString::create("h")), + s(StaticCString::create("s")), + v(StaticCString::create("v")), + r8(StaticCString::create("r8")), + g8(StaticCString::create("g8")), + b8(StaticCString::create("b8")), + a8(StaticCString::create("a8")) { } diff --git a/core/dvector.h b/core/dvector.h index 2830c57ec06..9760dcbcadb 100644 --- a/core/dvector.h +++ b/core/dvector.h @@ -56,12 +56,12 @@ struct MemoryPool { Alloc *free_list; - Alloc() { - mem = NULL; - lock = 0; - pool_id = POOL_ALLOCATOR_INVALID_ID; - size = 0; - free_list = NULL; + Alloc() : + lock(0), + mem(NULL), + pool_id(POOL_ALLOCATOR_INVALID_ID), + size(0), + free_list(NULL) { } }; diff --git a/core/func_ref.cpp b/core/func_ref.cpp index c707f1c4cb3..d9d1a2b7997 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -69,7 +69,6 @@ void FuncRef::_bind_methods() { ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function); } -FuncRef::FuncRef() { - - id = 0; +FuncRef::FuncRef() : + id(0) { } diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index 645d97ae7ee..a3633dc1f4e 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -373,24 +373,23 @@ uint64_t FileAccessCompressed::_get_modified_time(const String &p_file) { return 0; } -FileAccessCompressed::FileAccessCompressed() { - - f = NULL; - magic = "GCMP"; - cmode = Compression::MODE_ZSTD; - writing = false; - write_ptr = 0; - write_buffer_size = 0; - write_max = 0; - block_size = 0; - read_eof = false; - at_end = false; - read_total = 0; - read_ptr = NULL; - read_block = 0; - read_block_count = 0; - read_block_size = 0; - read_pos = 0; +FileAccessCompressed::FileAccessCompressed() : + cmode(Compression::MODE_ZSTD), + writing(false), + write_ptr(0), + write_buffer_size(0), + write_max(0), + block_size(0), + read_eof(false), + at_end(false), + read_ptr(NULL), + read_block(0), + read_block_count(0), + read_block_size(0), + read_pos(0), + read_total(0), + magic("GCMP"), + f(NULL) { } FileAccessCompressed::~FileAccessCompressed() { diff --git a/core/io/file_access_zip.cpp b/core/io/file_access_zip.cpp index 7b6385c3ffc..d99cdf0d86e 100644 --- a/core/io/file_access_zip.cpp +++ b/core/io/file_access_zip.cpp @@ -43,31 +43,31 @@ static void *godot_open(void *data, const char *p_fname, int mode) { if (mode & ZLIB_FILEFUNC_MODE_WRITE) { return NULL; - }; + } FileAccess *f = (FileAccess *)data; f->open(p_fname, FileAccess::READ); return f->is_open() ? data : NULL; -}; +} static uLong godot_read(void *data, void *fdata, void *buf, uLong size) { FileAccess *f = (FileAccess *)data; f->get_buffer((uint8_t *)buf, size); return size; -}; +} static uLong godot_write(voidpf opaque, voidpf stream, const void *buf, uLong size) { return 0; -}; +} static long godot_tell(voidpf opaque, voidpf stream) { FileAccess *f = (FileAccess *)opaque; return f->get_position(); -}; +} static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) { @@ -84,36 +84,36 @@ static long godot_seek(voidpf opaque, voidpf stream, uLong offset, int origin) { break; default: break; - }; + } f->seek(pos); return 0; -}; +} static int godot_close(voidpf opaque, voidpf stream) { FileAccess *f = (FileAccess *)opaque; f->close(); return 0; -}; +} static int godot_testerror(voidpf opaque, voidpf stream) { FileAccess *f = (FileAccess *)opaque; return f->get_error() != OK ? 1 : 0; -}; +} static voidpf godot_alloc(voidpf opaque, uInt items, uInt size) { return memalloc(items * size); -}; +} static void godot_free(voidpf opaque, voidpf address) { memfree(address); -}; +} -}; // extern "C" +} // extern "C" void ZipArchive::close_handle(unzFile p_file) const { @@ -122,7 +122,7 @@ void ZipArchive::close_handle(unzFile p_file) const { unzCloseCurrentFile(p_file); unzClose(p_file); memdelete(f); -}; +} unzFile ZipArchive::get_file_handle(String p_file) const { @@ -155,10 +155,10 @@ unzFile ZipArchive::get_file_handle(String p_file) const { unzClose(pkg); ERR_FAIL_V(NULL); - }; + } return pkg; -}; +} bool ZipArchive::try_open_pack(const String &p_path) { @@ -215,36 +215,36 @@ bool ZipArchive::try_open_pack(const String &p_path) { if ((i + 1) < gi.number_entry) { unzGoToNextFile(zfile); - }; - }; + } + } return true; -}; +} bool ZipArchive::file_exists(String p_name) const { return files.has(p_name); -}; +} FileAccess *ZipArchive::get_file(const String &p_path, PackedData::PackedFile *p_file) { return memnew(FileAccessZip(p_path, *p_file)); -}; +} ZipArchive *ZipArchive::get_singleton() { if (instance == NULL) { instance = memnew(ZipArchive); - }; + } return instance; -}; +} ZipArchive::ZipArchive() { instance = this; //fa_create_func = FileAccess::get_create_func(); -}; +} ZipArchive::~ZipArchive() { @@ -253,10 +253,10 @@ ZipArchive::~ZipArchive() { FileAccess *f = (FileAccess *)unzGetOpaque(packages[i].zfile); unzClose(packages[i].zfile); memdelete(f); - }; + } packages.clear(); -}; +} Error FileAccessZip::_open(const String &p_path, int p_mode_flags) { @@ -272,7 +272,7 @@ Error FileAccessZip::_open(const String &p_path, int p_mode_flags) { ERR_FAIL_COND_V(err != UNZ_OK, FAILED); return OK; -}; +} void FileAccessZip::close() { @@ -283,50 +283,50 @@ void FileAccessZip::close() { ERR_FAIL_COND(!arch); arch->close_handle(zfile); zfile = NULL; -}; +} bool FileAccessZip::is_open() const { return zfile != NULL; -}; +} void FileAccessZip::seek(size_t p_position) { ERR_FAIL_COND(!zfile); unzSeekCurrentFile(zfile, p_position); -}; +} void FileAccessZip::seek_end(int64_t p_position) { ERR_FAIL_COND(!zfile); unzSeekCurrentFile(zfile, get_len() + p_position); -}; +} size_t FileAccessZip::get_position() const { ERR_FAIL_COND_V(!zfile, 0); return unztell(zfile); -}; +} size_t FileAccessZip::get_len() const { ERR_FAIL_COND_V(!zfile, 0); return file_info.uncompressed_size; -}; +} bool FileAccessZip::eof_reached() const { ERR_FAIL_COND_V(!zfile, true); return at_eof; -}; +} uint8_t FileAccessZip::get_8() const { uint8_t ret = 0; get_buffer(&ret, 1); return ret; -}; +} int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const { @@ -339,20 +339,20 @@ int FileAccessZip::get_buffer(uint8_t *p_dst, int p_length) const { if (read < p_length) at_eof = true; return read; -}; +} Error FileAccessZip::get_error() const { if (!zfile) { return ERR_UNCONFIGURED; - }; + } if (eof_reached()) { return ERR_FILE_EOF; - }; + } return OK; -}; +} void FileAccessZip::flush() { @@ -362,22 +362,21 @@ void FileAccessZip::flush() { void FileAccessZip::store_8(uint8_t p_dest) { ERR_FAIL(); -}; +} bool FileAccessZip::file_exists(const String &p_name) { return false; -}; +} -FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) { - - zfile = NULL; +FileAccessZip::FileAccessZip(const String &p_path, const PackedData::PackedFile &p_file) : + zfile(NULL) { _open(p_path, FileAccess::READ); -}; +} FileAccessZip::~FileAccessZip() { close(); -}; +} #endif diff --git a/core/io/logger.cpp b/core/io/logger.cpp index 01755c8ee93..3c4b4a1ac34 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -179,11 +179,10 @@ void RotatedFileLogger::rotate_file() { file = FileAccess::open(base_path, FileAccess::WRITE); } -RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) { - file = NULL; - base_path = p_base_path.simplify_path(); - max_files = p_max_files > 0 ? p_max_files : 1; - +RotatedFileLogger::RotatedFileLogger(const String &p_base_path, int p_max_files) : + base_path(p_base_path.simplify_path()), + max_files(p_max_files > 0 ? p_max_files : 1), + file(NULL) { rotate_file(); } @@ -240,8 +239,8 @@ void StdLogger::logv(const char *p_format, va_list p_list, bool p_err) { StdLogger::~StdLogger() {} -CompositeLogger::CompositeLogger(Vector p_loggers) { - loggers = p_loggers; +CompositeLogger::CompositeLogger(Vector p_loggers) : + loggers(p_loggers) { } void CompositeLogger::logv(const char *p_format, va_list p_list, bool p_err) { diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 6338cee39d0..c71903c94d9 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -55,9 +55,8 @@ ObjectID EncodedObjectAsID::get_object_id() const { return id; } -EncodedObjectAsID::EncodedObjectAsID() { - - id = 0; +EncodedObjectAsID::EncodedObjectAsID() : + id(0) { } #define ENCODE_MASK 0xFF diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index b6dd4eaf6fd..aadcca01d5e 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -35,10 +35,9 @@ /* helpers / binders */ -PacketPeer::PacketPeer() { - - allow_object_decoding = false; - last_get_error = OK; +PacketPeer::PacketPeer() : + last_get_error(OK), + allow_object_decoding(false) { } void PacketPeer::set_allow_object_decoding(bool p_enable) { diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index d33ba6f8552..2e916d6a48c 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -239,13 +239,12 @@ void PacketPeerUDP::_bind_methods() { ClassDB::bind_method(D_METHOD("set_dest_address", "host", "port"), &PacketPeerUDP::_set_dest_address); } -PacketPeerUDP::PacketPeerUDP() { - - _sock = Ref(NetSocket::create()); - blocking = true; - packet_port = 0; - queue_count = 0; - peer_port = 0; +PacketPeerUDP::PacketPeerUDP() : + packet_port(0), + queue_count(0), + peer_port(0), + blocking(true), + _sock(Ref(NetSocket::create())) { rb.resize(16); } diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 6f3a8c3d2e9..b91268dab23 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -970,12 +970,11 @@ String ResourceInteractiveLoaderBinary::recognize(FileAccess *p_f) { return type; } -ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() { - - f = NULL; - stage = 0; - error = OK; - translation_remapped = false; +ResourceInteractiveLoaderBinary::ResourceInteractiveLoaderBinary() : + translation_remapped(false), + f(NULL), + error(OK), + stage(0) { } ResourceInteractiveLoaderBinary::~ResourceInteractiveLoaderBinary() { diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 28561e8cbc0..4b86735aa36 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -349,12 +349,11 @@ void StreamPeerTCP::_bind_methods() { BIND_ENUM_CONSTANT(STATUS_ERROR); } -StreamPeerTCP::StreamPeerTCP() { - - _sock = Ref(NetSocket::create()); - status = STATUS_NONE; - peer_host = IP_Address(); - peer_port = 0; +StreamPeerTCP::StreamPeerTCP() : + _sock(Ref(NetSocket::create())), + status(STATUS_NONE), + peer_host(IP_Address()), + peer_port(0) { } StreamPeerTCP::~StreamPeerTCP() { diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index b8194cb17f2..be9176779e8 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -116,9 +116,8 @@ void TCP_Server::stop() { } } -TCP_Server::TCP_Server() { - - _sock = Ref(NetSocket::create()); +TCP_Server::TCP_Server() : + _sock(Ref(NetSocket::create())) { } TCP_Server::~TCP_Server() { diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 0cfb54234c0..7f3439e956e 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -2157,13 +2157,13 @@ void Expression::_bind_methods() { ClassDB::bind_method(D_METHOD("get_error_text"), &Expression::get_error_text); } -Expression::Expression() { - output_type = Variant::NIL; - error_set = true; - root = NULL; - nodes = NULL; - sequenced = false; - execution_error = false; +Expression::Expression() : + output_type(Variant::NIL), + sequenced(false), + error_set(true), + root(NULL), + nodes(NULL), + execution_error(false) { } Expression::~Expression() { diff --git a/core/math/expression.h b/core/math/expression.h index ac2416d0ddd..7f81542480a 100644 --- a/core/math/expression.h +++ b/core/math/expression.h @@ -116,7 +116,9 @@ private: Variant::Type type; String name; - Input() { type = Variant::NIL; } + Input() : + type(Variant::NIL) { + } }; Vector inputs; diff --git a/core/math/plane.h b/core/math/plane.h index 4eedebb79e8..5182dc67dd0 100644 --- a/core/math/plane.h +++ b/core/math/plane.h @@ -74,10 +74,11 @@ public: _FORCE_INLINE_ bool operator!=(const Plane &p_plane) const; operator String() const; - _FORCE_INLINE_ Plane() { d = 0; } + _FORCE_INLINE_ Plane() : + d(0) {} _FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) : normal(p_a, p_b, p_c), - d(p_d){}; + d(p_d) {} _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d); _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal); diff --git a/core/math/quat.h b/core/math/quat.h index c4f9b3a732d..59a15f460bf 100644 --- a/core/math/quat.h +++ b/core/math/quat.h @@ -115,20 +115,20 @@ public: z = p_z; w = p_w; } - inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) { - x = p_x; - y = p_y; - z = p_z; - w = p_w; + inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) : + x(p_x), + y(p_y), + z(p_z), + w(p_w) { } Quat(const Vector3 &axis, const real_t &angle) { set_axis_angle(axis, angle); } Quat(const Vector3 &euler) { set_euler(euler); } - Quat(const Quat &q) { - x = q.x; - y = q.y; - z = q.z; - w = q.w; + Quat(const Quat &q) : + x(q.x), + y(q.y), + z(q.z), + w(q.w) { } Quat(const Vector3 &v0, const Vector3 &v1) // shortest arc @@ -153,9 +153,11 @@ public: } } - inline Quat() { - x = y = z = 0; - w = 1; + inline Quat() : + x(0), + y(0), + z(0), + w(1) { } }; diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index ce70b859ebf..8f4f2b6920a 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -349,9 +349,9 @@ class DirChanger { String original_dir; public: - DirChanger(DirAccess *p_da, String p_dir) { - da = p_da; - original_dir = p_da->get_current_dir(); + DirChanger(DirAccess *p_da, String p_dir) : + da(p_da), + original_dir(p_da->get_current_dir()) { p_da->change_dir(p_dir); } diff --git a/core/reference.cpp b/core/reference.cpp index b79ad0bf3d9..6ccc444b930 100644 --- a/core/reference.cpp +++ b/core/reference.cpp @@ -139,8 +139,8 @@ void WeakRef::set_ref(const REF &p_ref) { ref = p_ref.is_valid() ? p_ref->get_instance_id() : 0; } -WeakRef::WeakRef() { - ref = 0; +WeakRef::WeakRef() : + ref(0) { } void WeakRef::_bind_methods() { diff --git a/core/variant_parser.h b/core/variant_parser.h index 531c1d59cd2..e183169ed8e 100644 --- a/core/variant_parser.h +++ b/core/variant_parser.h @@ -45,7 +45,8 @@ public: CharType saved; - Stream() { saved = 0; } + Stream() : + saved(0) {} virtual ~Stream() {} }; diff --git a/drivers/alsa/audio_driver_alsa.cpp b/drivers/alsa/audio_driver_alsa.cpp index 50697b88349..2e3861f500d 100644 --- a/drivers/alsa/audio_driver_alsa.cpp +++ b/drivers/alsa/audio_driver_alsa.cpp @@ -159,7 +159,7 @@ Error AudioDriverALSA::init() { } return err; -}; +} void AudioDriverALSA::thread_func(void *p_udata) { @@ -232,25 +232,25 @@ void AudioDriverALSA::thread_func(void *p_udata) { ad->stop_counting_ticks(); ad->unlock(); - }; + } ad->thread_exited = true; -}; +} void AudioDriverALSA::start() { active = true; -}; +} int AudioDriverALSA::get_mix_rate() const { return mix_rate; -}; +} AudioDriver::SpeakerMode AudioDriverALSA::get_speaker_mode() const { return speaker_mode; -}; +} Array AudioDriverALSA::get_device_list() { @@ -302,14 +302,14 @@ void AudioDriverALSA::lock() { if (!thread || !mutex) return; mutex->lock(); -}; +} void AudioDriverALSA::unlock() { if (!thread || !mutex) return; mutex->unlock(); -}; +} void AudioDriverALSA::finish_device() { @@ -337,18 +337,15 @@ void AudioDriverALSA::finish() { finish_device(); } -AudioDriverALSA::AudioDriverALSA() { +AudioDriverALSA::AudioDriverALSA() : + thread(NULL), + mutex(NULL), + pcm_handle(NULL), + device_name("Default"), + new_device("Default") { +} - mutex = NULL; - thread = NULL; - pcm_handle = NULL; - - device_name = "Default"; - new_device = "Default"; -}; - -AudioDriverALSA::~AudioDriverALSA(){ - -}; +AudioDriverALSA::~AudioDriverALSA() { +} #endif diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index 850b90d59b9..726cee10a45 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -684,22 +684,18 @@ String AudioDriverCoreAudio::capture_get_device() { #endif -AudioDriverCoreAudio::AudioDriverCoreAudio() { - audio_unit = NULL; - input_unit = NULL; - active = false; - mutex = NULL; - - mix_rate = 0; - channels = 2; - capture_channels = 2; - - buffer_frames = 0; - +AudioDriverCoreAudio::AudioDriverCoreAudio() : + audio_unit(NULL), + input_unit(NULL), + active(false), + mutex(NULL), + device_name("Default"), + capture_device_name("Default"), + mix_rate(0), + channels(2), + capture_channels(2), + buffer_frames(0) { samples_in.clear(); - - device_name = "Default"; - capture_device_name = "Default"; } AudioDriverCoreAudio::~AudioDriverCoreAudio(){}; diff --git a/drivers/coremidi/core_midi.cpp b/drivers/coremidi/core_midi.cpp index 2ebbabaa380..a20aec04b56 100644 --- a/drivers/coremidi/core_midi.cpp +++ b/drivers/coremidi/core_midi.cpp @@ -112,13 +112,11 @@ PoolStringArray MIDIDriverCoreMidi::get_connected_inputs() { return list; } -MIDIDriverCoreMidi::MIDIDriverCoreMidi() { - - client = 0; +MIDIDriverCoreMidi::MIDIDriverCoreMidi() : + client(0) { } MIDIDriverCoreMidi::~MIDIDriverCoreMidi() { - close(); } diff --git a/drivers/gles2/rasterizer_scene_gles2.h b/drivers/gles2/rasterizer_scene_gles2.h index ba406183c7f..6ac0eeb72d7 100644 --- a/drivers/gles2/rasterizer_scene_gles2.h +++ b/drivers/gles2/rasterizer_scene_gles2.h @@ -369,33 +369,28 @@ public: float fog_height_max; float fog_height_curve; - Environment() { - bg_mode = VS::ENV_BG_CLEAR_COLOR; - sky_custom_fov = 0.0; - bg_energy = 1.0; - sky_ambient = 0; - ambient_energy = 1.0; - ambient_sky_contribution = 0.0; - canvas_max_layer = 0; - - fog_enabled = false; - fog_color = Color(0.5, 0.5, 0.5); - fog_sun_color = Color(0.8, 0.8, 0.0); - fog_sun_amount = 0; - - fog_depth_enabled = true; - - fog_depth_begin = 10; - fog_depth_end = 0; - fog_depth_curve = 1; - - fog_transmit_enabled = true; - fog_transmit_curve = 1; - - fog_height_enabled = false; - fog_height_min = 0; - fog_height_max = 100; - fog_height_curve = 1; + Environment() : + bg_mode(VS::ENV_BG_CLEAR_COLOR), + sky_custom_fov(0.0), + bg_energy(1.0), + sky_ambient(0), + ambient_energy(1.0), + ambient_sky_contribution(0.0), + canvas_max_layer(0), + fog_enabled(false), + fog_color(Color(0.5, 0.5, 0.5)), + fog_sun_color(Color(0.8, 0.8, 0.0)), + fog_sun_amount(0), + fog_depth_enabled(true), + fog_depth_begin(10), + fog_depth_end(0), + fog_depth_curve(1), + fog_transmit_enabled(true), + fog_transmit_curve(1), + fog_height_enabled(false), + fog_height_min(0), + fog_height_max(100), + fog_height_curve(1) { } }; diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index 5bdc65a0b5d..ec7616b9f39 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -131,10 +131,9 @@ public: } } render, render_final, snap; - Info() { - - texture_mem = 0; - vertex_mem = 0; + Info() : + texture_mem(0), + vertex_mem(0) { render.reset(); render_final.reset(); } @@ -254,30 +253,31 @@ public: VisualServer::TextureDetectCallback detect_normal; void *detect_normal_ud; - Texture() { - alloc_width = 0; - alloc_height = 0; - target = 0; - - stored_cube_sides = 0; - ignore_mipmaps = false; - render_target = NULL; - flags = width = height = 0; - tex_id = 0; - data_size = 0; - format = Image::FORMAT_L8; - active = false; - compressed = false; - total_data_size = 0; - mipmaps = 0; - detect_3d = NULL; - detect_3d_ud = NULL; - detect_srgb = NULL; - detect_srgb_ud = NULL; - detect_normal = NULL; - detect_normal_ud = NULL; - proxy = NULL; - redraw_if_visible = false; + Texture() : + proxy(NULL), + flags(0), + width(0), + height(0), + alloc_width(0), + alloc_height(0), + format(Image::FORMAT_L8), + target(0), + data_size(0), + total_data_size(0), + ignore_mipmaps(false), + compressed(false), + mipmaps(0), + active(false), + tex_id(0), + stored_cube_sides(0), + render_target(NULL), + redraw_if_visible(false), + detect_3d(NULL), + detect_3d_ud(NULL), + detect_srgb(NULL), + detect_srgb_ud(NULL), + detect_normal(NULL), + detect_normal_ud(NULL) { } _ALWAYS_INLINE_ Texture *get_ptr() { @@ -615,20 +615,15 @@ public: int total_data_size; - Surface() { - array_byte_size = 0; - index_array_byte_size = 0; - - array_len = 0; - index_array_len = 0; - - mesh = NULL; - - primitive = VS::PRIMITIVE_POINTS; - - active = false; - - total_data_size = 0; + Surface() : + mesh(NULL), + array_len(0), + index_array_len(0), + array_byte_size(0), + index_array_byte_size(0), + primitive(VS::PRIMITIVE_POINTS), + active(false), + total_data_size(0) { } }; @@ -658,9 +653,9 @@ public: } } - Mesh() { - blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED; - blend_shape_count = 0; + Mesh() : + blend_shape_count(0), + blend_shape_mode(VS::BLEND_SHAPE_MODE_NORMALIZED) { } }; @@ -731,22 +726,18 @@ public: bool dirty_data; MultiMesh() : + size(0), + transform_format(VS::MULTIMESH_TRANSFORM_2D), + color_format(VS::MULTIMESH_COLOR_NONE), + custom_data_format(VS::MULTIMESH_CUSTOM_DATA_NONE), update_list(this), - mesh_list(this) { - dirty_aabb = true; - dirty_data = true; - - xform_floats = 0; - color_floats = 0; - custom_data_floats = 0; - - visible_instances = -1; - - size = 0; - - transform_format = VS::MULTIMESH_TRANSFORM_2D; - color_format = VS::MULTIMESH_COLOR_NONE; - custom_data_format = VS::MULTIMESH_CUSTOM_DATA_NONE; + mesh_list(this), + visible_instances(-1), + xform_floats(0), + color_floats(0), + custom_data_floats(0), + dirty_aabb(true), + dirty_data(true) { } }; @@ -847,10 +838,10 @@ public: Set instances; Skeleton() : + use_2d(false), + size(0), + tex_id(0), update_list(this) { - tex_id = 0; - size = 0; - use_2d = false; } }; @@ -1121,11 +1112,11 @@ public: GLuint color; - Effect() { - fbo = 0; - width = 0; - height = 0; - color = 0; + Effect() : + fbo(0), + width(0), + height(0), + color(0) { } }; @@ -1140,22 +1131,17 @@ public: RID texture; - RenderTarget() { - fbo = 0; - - color = 0; - depth = 0; - - width = 0; - height = 0; - - for (int i = 0; i < RENDER_TARGET_FLAG_MAX; i++) { + RenderTarget() : + fbo(0), + color(0), + depth(0), + width(0), + height(0), + used_in_frame(false), + msaa(VS::VIEWPORT_MSAA_DISABLED) { + for (int i = 0; i < RENDER_TARGET_FLAG_MAX; ++i) { flags[i] = false; } - - used_in_frame = false; - - msaa = VS::VIEWPORT_MSAA_DISABLED; } }; diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 0e6027c4ad0..1d84fb487bc 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -450,89 +450,77 @@ public: float fog_height_max; float fog_height_curve; - Environment() { - bg_mode = VS::ENV_BG_CLEAR_COLOR; - sky_custom_fov = 0.0; - bg_energy = 1.0; - sky_ambient = 0; - ambient_energy = 1.0; - ambient_sky_contribution = 0.0; - canvas_max_layer = 0; - - ssr_enabled = false; - ssr_max_steps = 64; - ssr_fade_in = 0.15; - ssr_fade_out = 2.0; - ssr_depth_tolerance = 0.2; - ssr_roughness = true; - - ssao_enabled = false; - ssao_intensity = 1.0; - ssao_radius = 1.0; - ssao_intensity2 = 1.0; - ssao_radius2 = 0.0; - ssao_bias = 0.01; - ssao_light_affect = 0; - ssao_ao_channel_affect = 0; - ssao_filter = VS::ENV_SSAO_BLUR_3x3; - ssao_quality = VS::ENV_SSAO_QUALITY_LOW; - ssao_bilateral_sharpness = 4; - - tone_mapper = VS::ENV_TONE_MAPPER_LINEAR; - tone_mapper_exposure = 1.0; - tone_mapper_exposure_white = 1.0; - auto_exposure = false; - auto_exposure_speed = 0.5; - auto_exposure_min = 0.05; - auto_exposure_max = 8; - auto_exposure_grey = 0.4; - - glow_enabled = false; - glow_levels = (1 << 2) | (1 << 4); - glow_intensity = 0.8; - glow_strength = 1.0; - glow_bloom = 0.0; - glow_blend_mode = VS::GLOW_BLEND_MODE_SOFTLIGHT; - glow_hdr_bleed_threshold = 1.0; - glow_hdr_bleed_scale = 2.0; - glow_hdr_luminance_cap = 12.0; - glow_bicubic_upscale = false; - - dof_blur_far_enabled = false; - dof_blur_far_distance = 10; - dof_blur_far_transition = 5; - dof_blur_far_amount = 0.1; - dof_blur_far_quality = VS::ENV_DOF_BLUR_QUALITY_MEDIUM; - - dof_blur_near_enabled = false; - dof_blur_near_distance = 2; - dof_blur_near_transition = 1; - dof_blur_near_amount = 0.1; - dof_blur_near_quality = VS::ENV_DOF_BLUR_QUALITY_MEDIUM; - - adjustments_enabled = false; - adjustments_brightness = 1.0; - adjustments_contrast = 1.0; - adjustments_saturation = 1.0; - - fog_enabled = false; - fog_color = Color(0.5, 0.5, 0.5); - fog_sun_color = Color(0.8, 0.8, 0.0); - fog_sun_amount = 0; - - fog_depth_enabled = true; - - fog_depth_begin = 10; - fog_depth_end = 0; - fog_depth_curve = 1; - - fog_transmit_enabled = true; - fog_transmit_curve = 1; - - fog_height_enabled = false; - fog_height_min = 0; - fog_height_max = 100; - fog_height_curve = 1; + Environment() : + bg_mode(VS::ENV_BG_CLEAR_COLOR), + sky_custom_fov(0.0), + bg_energy(1.0), + sky_ambient(0), + ambient_energy(1.0), + ambient_sky_contribution(0.0), + canvas_max_layer(0), + ssr_enabled(false), + ssr_max_steps(64), + ssr_fade_in(0.15), + ssr_fade_out(2.0), + ssr_depth_tolerance(0.2), + ssr_roughness(true), + ssao_enabled(false), + ssao_intensity(1.0), + ssao_radius(1.0), + ssao_intensity2(1.0), + ssao_radius2(0.0), + ssao_bias(0.01), + ssao_light_affect(0), + ssao_ao_channel_affect(0), + ssao_quality(VS::ENV_SSAO_QUALITY_LOW), + ssao_bilateral_sharpness(4), + ssao_filter(VS::ENV_SSAO_BLUR_3x3), + glow_enabled(false), + glow_levels((1 << 2) | (1 << 4)), + glow_intensity(0.8), + glow_strength(1.0), + glow_bloom(0.0), + glow_blend_mode(VS::GLOW_BLEND_MODE_SOFTLIGHT), + glow_hdr_bleed_threshold(1.0), + glow_hdr_bleed_scale(2.0), + glow_hdr_luminance_cap(12.0), + glow_bicubic_upscale(false), + tone_mapper(VS::ENV_TONE_MAPPER_LINEAR), + tone_mapper_exposure(1.0), + tone_mapper_exposure_white(1.0), + auto_exposure(false), + auto_exposure_speed(0.5), + auto_exposure_min(0.05), + auto_exposure_max(8), + auto_exposure_grey(0.4), + dof_blur_far_enabled(false), + dof_blur_far_distance(10), + dof_blur_far_transition(5), + dof_blur_far_amount(0.1), + dof_blur_far_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM), + dof_blur_near_enabled(false), + dof_blur_near_distance(2), + dof_blur_near_transition(1), + dof_blur_near_amount(0.1), + dof_blur_near_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM), + adjustments_enabled(false), + adjustments_brightness(1.0), + adjustments_contrast(1.0), + adjustments_saturation(1.0), + fog_enabled(false), + fog_color(Color(0.5, 0.5, 0.5)), + fog_sun_color(Color(0.8, 0.8, 0.0)), + fog_sun_amount(0), + fog_depth_enabled(true), + fog_depth_begin(10), + fog_depth_end(0), + fog_depth_curve(1), + fog_transmit_enabled(true), + fog_transmit_curve(1), + fog_height_enabled(false), + fog_height_min(0), + fog_height_max(100), + fog_height_curve(1) { } }; @@ -643,9 +631,9 @@ public: Vector3 bounds; Transform transform_to_data; - GIProbeInstance() { - probe = NULL; - tex_cache = 0; + GIProbeInstance() : + probe(NULL), + tex_cache(0) { } }; diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 398ffdeb823..958086f6c79 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -285,29 +285,30 @@ public: VisualServer::TextureDetectCallback detect_normal; void *detect_normal_ud; - Texture() { - - using_srgb = false; - stored_cube_sides = 0; - ignore_mipmaps = false; - render_target = NULL; - flags = width = height = 0; - tex_id = 0; - data_size = 0; - format = Image::FORMAT_L8; - active = false; - compressed = false; - total_data_size = 0; - target = GL_TEXTURE_2D; - mipmaps = 0; - detect_3d = NULL; - detect_3d_ud = NULL; - detect_srgb = NULL; - detect_srgb_ud = NULL; - detect_normal = NULL; - detect_normal_ud = NULL; - proxy = NULL; - redraw_if_visible = false; + Texture() : + proxy(NULL), + flags(0), + width(0), + height(0), + format(Image::FORMAT_L8), + target(GL_TEXTURE_2D), + data_size(0), + compressed(false), + total_data_size(0), + ignore_mipmaps(false), + mipmaps(0), + active(false), + tex_id(0), + using_srgb(false), + redraw_if_visible(false), + stored_cube_sides(0), + render_target(NULL), + detect_3d(NULL), + detect_3d_ud(NULL), + detect_srgb(NULL), + detect_srgb_ud(NULL), + detect_normal(NULL), + detect_normal_ud(NULL) { } _ALWAYS_INLINE_ Texture *get_ptr() { @@ -553,16 +554,16 @@ public: bool is_animated_cache; Material() : + shader(NULL), + ubo_id(0), + ubo_size(0), list(this), - dirty_list(this) { - can_cast_shadow_cache = false; - is_animated_cache = false; - shader = NULL; - line_width = 1.0; - ubo_id = 0; - ubo_size = 0; - last_pass = 0; - render_priority = 0; + dirty_list(this), + line_width(1.0), + render_priority(0), + last_pass(0), + can_cast_shadow_cache(false), + is_animated_cache(false) { } }; @@ -661,27 +662,24 @@ public: int total_data_size; - Surface() { - - array_byte_size = 0; - index_array_byte_size = 0; - mesh = NULL; - format = 0; - array_id = 0; - vertex_id = 0; - index_id = 0; - array_len = 0; + Surface() : + mesh(NULL), + format(0), + array_id(0), + vertex_id(0), + index_id(0), + index_wireframe_id(0), + array_wireframe_id(0), + instancing_array_wireframe_id(0), + index_wireframe_len(0), + array_len(0), + index_array_len(0), + array_byte_size(0), + index_array_byte_size(0), + primitive(VS::PRIMITIVE_POINTS), + active(false), + total_data_size(0) { type = GEOMETRY_SURFACE; - primitive = VS::PRIMITIVE_POINTS; - index_array_len = 0; - active = false; - - total_data_size = 0; - - index_wireframe_id = 0; - array_wireframe_id = 0; - instancing_array_wireframe_id = 0; - index_wireframe_len = 0; } ~Surface() { @@ -708,11 +706,11 @@ public: } } - Mesh() { - blend_shape_mode = VS::BLEND_SHAPE_MODE_NORMALIZED; - blend_shape_count = 0; - last_pass = 0; - active = false; + Mesh() : + active(false), + blend_shape_count(0), + blend_shape_mode(VS::BLEND_SHAPE_MODE_NORMALIZED), + last_pass(0) { } }; @@ -780,19 +778,19 @@ public: bool dirty_data; MultiMesh() : + size(0), + transform_format(VS::MULTIMESH_TRANSFORM_2D), + color_format(VS::MULTIMESH_COLOR_NONE), + custom_data_format(VS::MULTIMESH_CUSTOM_DATA_NONE), update_list(this), - mesh_list(this) { - dirty_aabb = true; - dirty_data = true; - xform_floats = 0; - color_floats = 0; - custom_data_floats = 0; - visible_instances = -1; - size = 0; - buffer = 0; - transform_format = VS::MULTIMESH_TRANSFORM_2D; - color_format = VS::MULTIMESH_COLOR_NONE; - custom_data_format = VS::MULTIMESH_CUSTOM_DATA_NONE; + mesh_list(this), + buffer(0), + visible_instances(-1), + xform_floats(0), + color_floats(0), + custom_data_floats(0), + dirty_aabb(true), + dirty_data(true) { } }; @@ -889,11 +887,10 @@ public: Transform2D base_transform_2d; Skeleton() : + use_2d(false), + size(0), + texture(0), update_list(this) { - size = 0; - - use_2d = false; - texture = 0; } }; @@ -1174,37 +1171,31 @@ public: Transform emission_transform; Particles() : - particle_element(this) { - cycle_number = 0; - emitting = false; - one_shot = false; - amount = 0; - lifetime = 1.0; - pre_process_time = 0.0; - explosiveness = 0.0; - randomness = 0.0; - use_local_coords = true; - fixed_fps = 0; - fractional_delta = false; - frame_remainder = 0; - histories_enabled = false; - speed_scale = 1.0; - random_seed = 0; - - restart_request = false; - - custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8)); - - draw_order = VS::PARTICLES_DRAW_ORDER_INDEX; + inactive(true), + inactive_time(0.0), + emitting(false), + one_shot(false), + amount(0), + lifetime(1.0), + pre_process_time(0.0), + explosiveness(0.0), + randomness(0.0), + restart_request(false), + custom_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))), + use_local_coords(true), + draw_order(VS::PARTICLES_DRAW_ORDER_INDEX), + histories_enabled(false), + particle_element(this), + prev_ticks(0), + random_seed(0), + cycle_number(0), + speed_scale(1.0), + fixed_fps(0), + fractional_delta(false), + frame_remainder(0), + clear(true) { particle_buffers[0] = 0; particle_buffers[1] = 0; - - prev_ticks = 0; - - clear = true; - inactive = true; - inactive_time = 0.0; - glGenBuffers(2, particle_buffers); glGenVertexArrays(2, particle_vaos); } @@ -1309,9 +1300,9 @@ public: GLuint color; int levels; - MipMaps() { - color = 0; - levels = 0; + MipMaps() : + color(0), + levels(0) { } }; @@ -1326,10 +1317,10 @@ public: Vector depth_mipmap_fbos; //fbos for depth mipmapsla ver - SSAO() { + SSAO() : + linear_depth(0) { blur_fbo[0] = 0; blur_fbo[1] = 0; - linear_depth = 0; } } ssao; @@ -1341,7 +1332,8 @@ public: GLuint fbo; GLuint color; - Exposure() { fbo = 0; } + Exposure() : + fbo(0) {} } exposure; uint64_t last_exposure_tick; @@ -1355,26 +1347,22 @@ public: RID texture; - RenderTarget() { - - msaa = VS::VIEWPORT_MSAA_DISABLED; - width = 0; - height = 0; - depth = 0; - fbo = 0; + RenderTarget() : + fbo(0), + depth(0), + last_exposure_tick(0), + width(0), + height(0), + used_in_frame(false), + msaa(VS::VIEWPORT_MSAA_DISABLED) { exposure.fbo = 0; buffers.fbo = 0; - used_in_frame = false; - for (int i = 0; i < RENDER_TARGET_FLAG_MAX; i++) { flags[i] = false; } flags[RENDER_TARGET_HDR] = true; - buffers.active = false; buffers.effects_active = false; - - last_exposure_tick = 0; } }; diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 720824d451d..4988557dcb3 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -743,35 +743,28 @@ String AudioDriverPulseAudio::capture_get_device() { return name; } -AudioDriverPulseAudio::AudioDriverPulseAudio() { - - pa_ml = NULL; - pa_ctx = NULL; - pa_str = NULL; - pa_rec_str = NULL; - - mutex = NULL; - thread = NULL; - - device_name = "Default"; - new_device = "Default"; - default_device = ""; - +AudioDriverPulseAudio::AudioDriverPulseAudio() : + thread(NULL), + mutex(NULL), + pa_ml(NULL), + pa_ctx(NULL), + pa_str(NULL), + pa_rec_str(NULL), + device_name("Default"), + new_device("Default"), + default_device(""), + mix_rate(0), + buffer_frames(0), + pa_buffer_size(0), + channels(0), + pa_ready(0), + pa_status(0), + active(false), + thread_exited(false), + exit_thread(false), + latency(0) { samples_in.clear(); samples_out.clear(); - - mix_rate = 0; - buffer_frames = 0; - pa_buffer_size = 0; - channels = 0; - pa_ready = 0; - pa_status = 0; - - active = false; - thread_exited = false; - exit_thread = false; - - latency = 0; } AudioDriverPulseAudio::~AudioDriverPulseAudio() { diff --git a/drivers/rtaudio/audio_driver_rtaudio.cpp b/drivers/rtaudio/audio_driver_rtaudio.cpp index bc6ceb1e7e8..80537315aff 100644 --- a/drivers/rtaudio/audio_driver_rtaudio.cpp +++ b/drivers/rtaudio/audio_driver_rtaudio.cpp @@ -194,13 +194,12 @@ void AudioDriverRtAudio::finish() { } } -AudioDriverRtAudio::AudioDriverRtAudio() { - - active = false; - mutex = NULL; - dac = NULL; - mix_rate = DEFAULT_MIX_RATE; - speaker_mode = SPEAKER_MODE_STEREO; +AudioDriverRtAudio::AudioDriverRtAudio() : + speaker_mode(SPEAKER_MODE_STEREO), + mutex(NULL), + dac(NULL), + mix_rate(DEFAULT_MIX_RATE), + active(false) { } #endif diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 3b97b95f7c9..10f6be3cbe0 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -309,11 +309,10 @@ FileAccess *FileAccessUnix::create_libc() { CloseNotificationFunc FileAccessUnix::close_notification_func = NULL; -FileAccessUnix::FileAccessUnix() { - - f = NULL; - flags = 0; - last_error = OK; +FileAccessUnix::FileAccessUnix() : + f(NULL), + flags(0), + last_error(OK) { } FileAccessUnix::~FileAccessUnix() { diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index 833b17f122a..740b1edb9c5 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -167,10 +167,10 @@ void NetSocketPosix::cleanup() { #endif } -NetSocketPosix::NetSocketPosix() { - _sock = SOCK_EMPTY; - _ip_type = IP::TYPE_NONE; - _is_stream = false; +NetSocketPosix::NetSocketPosix() : + _sock(SOCK_EMPTY), + _ip_type(IP::TYPE_NONE), + _is_stream(false) { } NetSocketPosix::~NetSocketPosix() { diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h index 3d94f3ba490..71f56cfb5b6 100644 --- a/drivers/wasapi/audio_driver_wasapi.h +++ b/drivers/wasapi/audio_driver_wasapi.h @@ -58,17 +58,17 @@ class AudioDriverWASAPI : public AudioDriver { String device_name; String new_device; - AudioDeviceWASAPI() { - audio_client = NULL; - render_client = NULL; - capture_client = NULL; - active = false; - format_tag = 0; - bits_per_sample = 0; - channels = 0; - frame_size = 0; - device_name = "Default"; - new_device = "Default"; + AudioDeviceWASAPI() : + audio_client(NULL), + render_client(NULL), + capture_client(NULL), + active(false), + format_tag(0), + bits_per_sample(0), + channels(0), + frame_size(0), + device_name("Default"), + new_device("Default") { } }; diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 25824782596..a289945aa7f 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -307,11 +307,10 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) { } } -FileAccessWindows::FileAccessWindows() { - - f = NULL; - flags = 0; - last_error = OK; +FileAccessWindows::FileAccessWindows() : + f(NULL), + flags(0), + last_error(OK) { } FileAccessWindows::~FileAccessWindows() { diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index 52dcfacdf83..dbccad3b5df 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -93,9 +93,8 @@ void ThreadWindows::make_default() { wait_to_finish_func = wait_to_finish_func_windows; } -ThreadWindows::ThreadWindows() { - - handle = NULL; +ThreadWindows::ThreadWindows() : + handle(NULL) { } ThreadWindows::~ThreadWindows() { diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index 452a1105cae..ce2f0db0fcc 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -91,7 +91,7 @@ Error AudioDriverXAudio2::init() { thread = Thread::create(AudioDriverXAudio2::thread_func, this); return OK; -}; +} void AudioDriverXAudio2::thread_func(void *p_udata) { @@ -131,10 +131,10 @@ void AudioDriverXAudio2::thread_func(void *p_udata) { WaitForSingleObject(ad->voice_callback.buffer_end_event, INFINITE); } } - }; + } ad->thread_exited = true; -}; +} void AudioDriverXAudio2::start() { @@ -144,17 +144,17 @@ void AudioDriverXAudio2::start() { ERR_EXPLAIN("XAudio2 start error " + itos(hr)); ERR_FAIL(); } -}; +} int AudioDriverXAudio2::get_mix_rate() const { return mix_rate; -}; +} AudioDriver::SpeakerMode AudioDriverXAudio2::get_speaker_mode() const { return speaker_mode; -}; +} float AudioDriverXAudio2::get_latency() { @@ -172,13 +172,13 @@ void AudioDriverXAudio2::lock() { if (!thread || !mutex) return; mutex->lock(); -}; +} void AudioDriverXAudio2::unlock() { if (!thread || !mutex) return; mutex->unlock(); -}; +} void AudioDriverXAudio2::finish() { @@ -195,12 +195,12 @@ void AudioDriverXAudio2::finish() { if (samples_in) { memdelete_arr(samples_in); - }; + } if (samples_out[0]) { for (int i = 0; i < AUDIO_BUFFERS; i++) { memdelete_arr(samples_out[i]); } - }; + } mastering_voice->DestroyVoice(); @@ -208,20 +208,18 @@ void AudioDriverXAudio2::finish() { if (mutex) memdelete(mutex); thread = NULL; -}; +} -AudioDriverXAudio2::AudioDriverXAudio2() { - - mutex = NULL; - thread = NULL; +AudioDriverXAudio2::AudioDriverXAudio2() : + thread(NULL), + mutex(NULL), + current_buffer(0) { wave_format = { 0 }; for (int i = 0; i < AUDIO_BUFFERS; i++) { xaudio_buffer[i] = { 0 }; samples_out[i] = 0; } - current_buffer = 0; -}; +} -AudioDriverXAudio2::~AudioDriverXAudio2(){ - -}; +AudioDriverXAudio2::~AudioDriverXAudio2() { +} diff --git a/editor/collada/collada.h b/editor/collada/collada.h index b777fa04c2d..2d5819902c7 100644 --- a/editor/collada/collada.h +++ b/editor/collada/collada.h @@ -110,14 +110,13 @@ public: float z_near; float z_far; - CameraData() { - - mode = MODE_PERSPECTIVE; - perspective.y_fov = 0; + CameraData() : + mode(MODE_PERSPECTIVE), + aspect(1), + z_near(0.1), + z_far(100) { perspective.x_fov = 0; - aspect = 1; - z_near = 0.1; - z_far = 100; + perspective.y_fov = 0; } }; @@ -141,16 +140,14 @@ public: float spot_angle; float spot_exp; - LightData() { - - mode = MODE_AMBIENT; - color = Color(1, 1, 1, 1); - constant_att = 0; - linear_att = 0; - quad_att = 0; - - spot_angle = 45; - spot_exp = 1; + LightData() : + mode(MODE_AMBIENT), + color(Color(1, 1, 1, 1)), + constant_att(0), + linear_att(0), + quad_att(0), + spot_angle(45), + spot_exp(1) { } }; @@ -580,11 +577,11 @@ public: float animation_length; - State() { - unit_scale = 1.0; - up_axis = Vector3::AXIS_Y; - import_flags = 0; - animation_length = 0; + State() : + import_flags(0), + unit_scale(1.0), + up_axis(Vector3::AXIS_Y), + animation_length(0) { } } state; diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 9df0f30ca43..71315f13771 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -222,11 +222,10 @@ String EditorExportPreset::get_custom_features() const { return custom_features; } -EditorExportPreset::EditorExportPreset() { - - export_path = ""; - export_filter = EXPORT_ALL_RESOURCES; - runnable = false; +EditorExportPreset::EditorExportPreset() : + export_filter(EXPORT_ALL_RESOURCES), + export_path(""), + runnable(false) { } /////////////////////////////////// diff --git a/editor/editor_export.h b/editor/editor_export.h index 483af489a31..881e86fb12a 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -206,9 +206,9 @@ public: PropertyInfo option; Variant default_value; - ExportOption(const PropertyInfo &p_info, const Variant &p_default) { - option = p_info; - default_value = p_default; + ExportOption(const PropertyInfo &p_info, const Variant &p_default) : + option(p_info), + default_value(p_default) { } ExportOption() {} }; diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 4e4c5143f2b..6b68bf12d1f 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -579,18 +579,12 @@ bool EditorHelpSearch::Runner::work(uint64_t slot) { return true; } -EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree, const String &p_term, int p_search_flags) { - - ui_service = p_icon_service; - results_tree = p_results_tree; - term = p_term.strip_edges(); - search_flags = p_search_flags; - - if ((search_flags & SEARCH_CASE_SENSITIVE) == 0) - term = term.to_lower(); - - empty_icon = ui_service->get_icon("ArrowRight", "EditorIcons"); - disabled_color = ui_service->get_color("disabled_font_color", "Editor"); - - phase = 0; +EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree, const String &p_term, int p_search_flags) : + phase(0), + ui_service(p_icon_service), + results_tree(p_results_tree), + term((p_search_flags & SEARCH_CASE_SENSITIVE) == 0 ? p_term.strip_edges().to_lower() : p_term.strip_edges()), + search_flags(p_search_flags), + empty_icon(ui_service->get_icon("ArrowRight", "EditorIcons")), + disabled_color(ui_service->get_color("disabled_font_color", "Editor")) { } diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 86b2db877ee..cd024ff8700 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -829,11 +829,11 @@ void EditorPlugin::_bind_methods() { BIND_ENUM_CONSTANT(DOCK_SLOT_MAX); } -EditorPlugin::EditorPlugin() { - undo_redo = NULL; - input_event_forwarding_always_enabled = false; - force_draw_over_forwarding_enabled = false; - last_main_screen_name = ""; +EditorPlugin::EditorPlugin() : + undo_redo(NULL), + input_event_forwarding_always_enabled(false), + force_draw_over_forwarding_enabled(false), + last_main_screen_name("") { } EditorPlugin::~EditorPlugin() { diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index 9d3ab591166..a28d071d774 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -298,19 +298,18 @@ EditorInspector *SectionedInspector::get_inspector() { return inspector; } -SectionedInspector::SectionedInspector() { - - obj = -1; - - search_box = NULL; - +SectionedInspector::SectionedInspector() : + obj(-1), + sections(memnew(Tree)), + filter(memnew(SectionedInspectorFilter)), + inspector(memnew(EditorInspector)), + search_box(NULL) { add_constant_override("autohide", 1); // Fixes the dragger always showing up VBoxContainer *left_vb = memnew(VBoxContainer); left_vb->set_custom_minimum_size(Size2(170, 0) * EDSCALE); add_child(left_vb); - sections = memnew(Tree); sections->set_v_size_flags(SIZE_EXPAND_FILL); sections->set_hide_root(true); @@ -321,8 +320,6 @@ SectionedInspector::SectionedInspector() { right_vb->set_h_size_flags(SIZE_EXPAND_FILL); add_child(right_vb); - filter = memnew(SectionedInspectorFilter); - inspector = memnew(EditorInspector); inspector->set_v_size_flags(SIZE_EXPAND_FILL); right_vb->add_child(inspector, true); inspector->set_use_doc_hints(true); diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 7b0de9617c6..dabe697f109 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -71,23 +71,23 @@ private: bool hide_from_editor; bool save; bool restart_if_changed; - VariantContainer() { - variant = Variant(); - initial = Variant(); - order = 0; - hide_from_editor = false; - has_default_value = false; - save = false; - restart_if_changed = false; + VariantContainer() : + order(0), + variant(Variant()), + initial(Variant()), + has_default_value(false), + hide_from_editor(false), + save(false), + restart_if_changed(false) { } - VariantContainer(const Variant &p_variant, int p_order) { - variant = p_variant; - initial = Variant(); - order = p_order; - hide_from_editor = false; - has_default_value = false; - save = false; - restart_if_changed = false; + VariantContainer(const Variant &p_variant, int p_order) : + order(p_order), + variant(p_variant), + initial(Variant()), + has_default_value(false), + hide_from_editor(false), + save(false), + restart_if_changed(false) { } }; diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h index 8258ec41fdb..721db301128 100644 --- a/editor/import/editor_scene_importer_gltf.h +++ b/editor/import/editor_scene_importer_gltf.h @@ -114,14 +114,14 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { Vector children; Vector godot_nodes; - GLTFNode() { - // child_of_skeleton = -1; - // skeleton_skin = -1; - mesh = -1; - camera = -1; - parent = -1; - skin = -1; - scale = Vector3(1, 1, 1); + GLTFNode() : + parent(-1), + mesh(-1), + camera(-1), + skin(-1), + //skeleton_skin(-1), + //child_of_skeleton(-1), + scale(Vector3(1, 1, 1)) { } }; @@ -134,12 +134,12 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { bool indices; //matrices need to be transformed to this - GLTFBufferView() { - buffer = 0; - byte_offset = 0; - byte_length = 0; - byte_stride = 0; - indices = false; + GLTFBufferView() : + buffer(0), + byte_offset(0), + byte_length(0), + byte_stride(0), + indices(false) { } }; diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index a85f4456f7b..cc030dac4c3 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -826,13 +826,11 @@ void AbstractPolygon2DEditorPlugin::make_visible(bool p_visible) { } } -AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) { - - editor = p_node; - polygon_editor = p_polygon_editor; - klass = p_class; +AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(EditorNode *p_node, AbstractPolygon2DEditor *p_polygon_editor, String p_class) : + polygon_editor(p_polygon_editor), + editor(p_node), + klass(p_class) { CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor); - polygon_editor->hide(); } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h index e2daefdec61..e7934ea3a0e 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.h +++ b/editor/plugins/animation_blend_tree_editor_plugin.h @@ -70,9 +70,9 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin { String name; String type; Ref