Initialize class/struct variables with default values in modules/

This commit is contained in:
Rafał Mikrut 2021-02-08 10:57:18 +01:00
parent 57e2822a05
commit f7209b459b
100 changed files with 533 additions and 772 deletions

View file

@ -207,7 +207,6 @@ Vector<uint8_t> TextureBasisU::get_basisu_data() const {
};
TextureBasisU::TextureBasisU() {
flags = FLAGS_DEFAULT;
texture = RenderingServer::get_singleton()->texture_create();
};

View file

@ -47,7 +47,7 @@ class TextureBasisU : public Texture {
RID texture;
Size2 tex_size;
uint32_t flags;
uint32_t flags = FLAGS_DEFAULT;
Vector<uint8_t> data;

View file

@ -55,24 +55,24 @@ protected:
struct bmp_header_s {
struct bmp_file_header_s {
uint16_t bmp_signature;
uint32_t bmp_file_size;
uint32_t bmp_file_padding;
uint32_t bmp_file_offset;
uint16_t bmp_signature = 0;
uint32_t bmp_file_size = 0;
uint32_t bmp_file_padding = 0;
uint32_t bmp_file_offset = 0;
} bmp_file_header;
struct bmp_info_header_s {
uint32_t bmp_header_size;
uint32_t bmp_width;
uint32_t bmp_height;
uint16_t bmp_planes;
uint16_t bmp_bit_count;
uint32_t bmp_compression;
uint32_t bmp_size_image;
uint32_t bmp_pixels_per_meter_x;
uint32_t bmp_pixels_per_meter_y;
uint32_t bmp_colors_used;
uint32_t bmp_important_colors;
uint32_t bmp_header_size = 0;
uint32_t bmp_width = 0;
uint32_t bmp_height = 0;
uint16_t bmp_planes = 0;
uint16_t bmp_bit_count = 0;
uint32_t bmp_compression = 0;
uint32_t bmp_size_image = 0;
uint32_t bmp_pixels_per_meter_x = 0;
uint32_t bmp_pixels_per_meter_y = 0;
uint32_t bmp_colors_used = 0;
uint32_t bmp_important_colors = 0;
} bmp_info_header;
};

View file

@ -80,18 +80,18 @@ public:
private:
// These are used by function callEvent. Instead to create this each call I create if one time.
Variant call_event_res[5];
Variant *call_event_res_ptr[5];
Variant *call_event_res_ptr[5] = {};
btGhostObject *btGhost;
btGhostObject *btGhost = nullptr;
Vector<OverlappingObjectData> overlappingObjects;
bool monitorable = true;
PhysicsServer3D::AreaSpaceOverrideMode spOv_mode = PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED;
bool spOv_gravityPoint = false;
real_t spOv_gravityPointDistanceScale = 0;
real_t spOv_gravityPointAttenuation = 1;
real_t spOv_gravityPointDistanceScale = 0.0;
real_t spOv_gravityPointAttenuation = 1.0;
Vector3 spOv_gravityVec = Vector3(0, -1, 0);
real_t spOv_gravityMag = 10;
real_t spOv_gravityMag = 10.0;
real_t spOv_linearDump = 0.1;
real_t spOv_angularDump = 0.1;
int spOv_priority = 0;

View file

@ -39,11 +39,9 @@
*/
btRayShape::btRayShape(btScalar length) :
btConvexInternalShape(),
m_shapeAxis(0, 0, 1) {
btConvexInternalShape() {
m_shapeType = CUSTOM_CONVEX_SHAPE_TYPE;
setLength(length);
slipsOnSlope = false;
}
btRayShape::~btRayShape() {

View file

@ -42,10 +42,10 @@
/// Ray shape around z axis
ATTRIBUTE_ALIGNED16(class)
btRayShape : public btConvexInternalShape {
btScalar m_length;
bool slipsOnSlope;
btScalar m_length = 0;
bool slipsOnSlope = false;
/// The default axis is the z
btVector3 m_shapeAxis;
btVector3 m_shapeAxis = btVector3(0, 0, 1);
btTransform m_cacheSupportPoint;
btScalar m_cacheScaledLength;

View file

@ -110,7 +110,7 @@ public:
};
protected:
Type type;
Type type = TYPE_AREA;
ObjectID instance_id;
uint32_t collisionLayer = 0;
uint32_t collisionMask = 0;

View file

@ -51,7 +51,7 @@ class GodotMotionState : public btMotionState {
/// This data is used to store last world position
btTransform bodyCurrentWorldTransform;
RigidBodyBullet *owner;
RigidBodyBullet *owner = nullptr;
public:
GodotMotionState(RigidBodyBullet *p_owner) :

View file

@ -45,7 +45,7 @@ class GodotRayWorldAlgorithm : public btActivatingCollisionAlgorithm {
const btDiscreteDynamicsWorld *m_world;
btPersistentManifold *m_manifoldPtr;
bool m_ownManifold = false;
bool m_isSwapped;
bool m_isSwapped = false;
public:
GodotRayWorldAlgorithm(const btDiscreteDynamicsWorld *world, btPersistentManifold *mf, const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, bool isSwapped);

View file

@ -59,8 +59,8 @@ struct GodotClosestRayResultCallback : public btCollisionWorld::ClosestRayResult
bool m_pickRay = false;
int m_shapeId = 0;
bool collide_with_bodies;
bool collide_with_areas;
bool collide_with_bodies = false;
bool collide_with_areas = false;
public:
GodotClosestRayResultCallback(const btVector3 &rayFromWorld, const btVector3 &rayToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
@ -84,8 +84,8 @@ public:
// store all colliding object
struct GodotAllConvexResultCallback : public btCollisionWorld::ConvexResultCallback {
public:
PhysicsDirectSpaceState3D::ShapeResult *m_results;
int m_resultMax;
PhysicsDirectSpaceState3D::ShapeResult *m_results = nullptr;
int m_resultMax = 0;
const Set<RID> *m_exclude;
int count = 0;
@ -117,8 +117,8 @@ public:
const Set<RID> *m_exclude;
int m_shapeId = 0;
bool collide_with_bodies;
bool collide_with_areas;
bool collide_with_bodies = false;
bool collide_with_areas = false;
GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld),
@ -134,13 +134,13 @@ public:
struct GodotAllContactResultCallback : public btCollisionWorld::ContactResultCallback {
public:
const btCollisionObject *m_self_object;
PhysicsDirectSpaceState3D::ShapeResult *m_results;
int m_resultMax;
PhysicsDirectSpaceState3D::ShapeResult *m_results = nullptr;
int m_resultMax = 0;
const Set<RID> *m_exclude;
int m_count = 0;
bool collide_with_bodies;
bool collide_with_areas;
bool collide_with_bodies = false;
bool collide_with_areas = false;
GodotAllContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeResult *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
m_self_object(p_self_object),
@ -159,13 +159,13 @@ public:
struct GodotContactPairContactResultCallback : public btCollisionWorld::ContactResultCallback {
public:
const btCollisionObject *m_self_object;
Vector3 *m_results;
int m_resultMax;
Vector3 *m_results = nullptr;
int m_resultMax = 0;
const Set<RID> *m_exclude;
int m_count = 0;
bool collide_with_bodies;
bool collide_with_areas;
bool collide_with_bodies = false;
bool collide_with_areas = false;
GodotContactPairContactResultCallback(btCollisionObject *p_self_object, Vector3 *p_results, int p_resultMax, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
m_self_object(p_self_object),
@ -183,14 +183,14 @@ public:
struct GodotRestInfoContactResultCallback : public btCollisionWorld::ContactResultCallback {
public:
const btCollisionObject *m_self_object;
PhysicsDirectSpaceState3D::ShapeRestInfo *m_result;
PhysicsDirectSpaceState3D::ShapeRestInfo *m_result = nullptr;
const Set<RID> *m_exclude;
bool m_collided = false;
real_t m_min_distance = 0;
const btCollisionObject *m_rest_info_collision_object;
real_t m_min_distance = 0.0;
const btCollisionObject *m_rest_info_collision_object = nullptr;
btVector3 m_rest_info_bt_point;
bool collide_with_bodies;
bool collide_with_areas;
bool collide_with_bodies = false;
bool collide_with_areas = false;
GodotRestInfoContactResultCallback(btCollisionObject *p_self_object, PhysicsDirectSpaceState3D::ShapeRestInfo *p_result, const Set<RID> *p_exclude, bool p_collide_with_bodies, bool p_collide_with_areas) :
m_self_object(p_self_object),

View file

@ -41,7 +41,7 @@ class BulletPhysicsServer3D;
class RIDBullet {
RID self;
BulletPhysicsServer3D *physicsServer;
BulletPhysicsServer3D *physicsServer = nullptr;
public:
_FORCE_INLINE_ void set_self(const RID &p_self) { self = p_self; }

View file

@ -81,8 +81,8 @@ public:
}
public:
RigidBodyBullet *body;
real_t deltaTime;
RigidBodyBullet *body = nullptr;
real_t deltaTime = 0.0;
private:
BulletPhysicsDirectBodyState3D() {}
@ -144,13 +144,13 @@ public:
class RigidBodyBullet : public RigidCollisionObjectBullet {
public:
struct CollisionData {
RigidBodyBullet *otherObject;
int other_object_shape;
int local_shape;
RigidBodyBullet *otherObject = nullptr;
int other_object_shape = 0;
int local_shape = 0;
Vector3 hitLocalLocation;
Vector3 hitWorldLocation;
Vector3 hitNormal;
real_t appliedImpulse;
real_t appliedImpulse = 0.0;
};
struct ForceIntegrationCallback {
@ -169,7 +169,7 @@ public:
};
struct KinematicUtilities {
RigidBodyBullet *owner;
RigidBodyBullet *owner = nullptr;
btScalar safe_margin;
Vector<KinematicShape> shapes;
@ -194,10 +194,10 @@ private:
GodotMotionState *godotMotionState;
btRigidBody *btBody;
uint16_t locked_axis = 0;
real_t mass = 1;
real_t gravity_scale = 1;
real_t linearDamp = 0;
real_t angularDamp = 0;
real_t mass = 1.0;
real_t gravity_scale = 1.0;
real_t linearDamp = 0.0;
real_t angularDamp = 0.0;
bool can_sleep = true;
bool omit_forces_integration = false;
bool can_integrate_forces = false;

View file

@ -213,10 +213,10 @@ private:
class HeightMapShapeBullet : public ShapeBullet {
public:
Vector<real_t> heights;
int width;
int depth;
real_t min_height;
real_t max_height;
int width = 0;
int depth = 0;
real_t min_height = 0.0;
real_t max_height = 0.0;
HeightMapShapeBullet();
@ -231,7 +231,7 @@ private:
class RayShapeBullet : public ShapeBullet {
public:
real_t length = 1;
real_t length = 1.0;
bool slips_on_slope = false;
RayShapeBullet();

View file

@ -59,7 +59,7 @@ class SoftBodyBullet : public CollisionObjectBullet {
private:
btSoftBody *bt_soft_body = nullptr;
Vector<Vector<int>> indices_table;
btSoftBody::Material *mat0; // This is just a copy of pointer managed by btSoftBody
btSoftBody::Material *mat0 = nullptr; // This is just a copy of pointer managed by btSoftBody
bool isScratched = false;
Ref<Mesh> soft_mesh;

View file

@ -1092,13 +1092,13 @@ private:
btDbvtVolume bounds;
const btCollisionObject *self_collision_object;
uint32_t collision_layer;
uint32_t collision_mask;
uint32_t collision_layer = 0;
uint32_t collision_mask = 0;
struct CompoundLeafCallback : btDbvt::ICollide {
private:
RecoverPenetrationBroadPhaseCallback *parent_callback;
btCollisionObject *collision_object;
RecoverPenetrationBroadPhaseCallback *parent_callback = nullptr;
btCollisionObject *collision_object = nullptr;
public:
CompoundLeafCallback(RecoverPenetrationBroadPhaseCallback *p_parent_callback, btCollisionObject *p_collision_object) :
@ -1116,8 +1116,8 @@ private:
public:
struct BroadphaseResult {
btCollisionObject *collision_object;
int compound_child_index;
btCollisionObject *collision_object = nullptr;
int compound_child_index = 0;
};
Vector<BroadphaseResult> results;

View file

@ -100,12 +100,12 @@ class SpaceBullet : public RIDBullet {
btGhostPairCallback *ghostPairCallback = nullptr;
GodotFilterCallback *godotFilterCallback = nullptr;
btGjkEpaPenetrationDepthSolver *gjk_epa_pen_solver;
btVoronoiSimplexSolver *gjk_simplex_solver;
btGjkEpaPenetrationDepthSolver *gjk_epa_pen_solver = nullptr;
btVoronoiSimplexSolver *gjk_simplex_solver = nullptr;
BulletPhysicsDirectSpaceState *direct_access;
Vector3 gravityDirection = Vector3(0, -1, 0);
real_t gravityMagnitude = 10;
real_t gravityMagnitude = 10.0;
real_t linear_damp = 0.0;
real_t angular_damp = 0.0;

View file

@ -48,9 +48,9 @@ struct CSGBrush {
Vector3 vertices[3];
Vector2 uvs[3];
AABB aabb;
bool smooth;
bool invert;
int material;
bool smooth = false;
bool invert = false;
int material = 0;
};
Vector<Face> faces;
@ -74,20 +74,20 @@ struct CSGBrushOperation {
struct MeshMerge {
struct Face {
bool from_b;
bool inside;
int points[3];
bool from_b = false;
bool inside = false;
int points[3] = {};
Vector2 uvs[3];
bool smooth;
bool invert;
int material_idx;
bool smooth = false;
bool invert = false;
int material_idx = 0;
};
struct FaceBVH {
int face;
int left;
int right;
int next;
int face = 0;
int left = 0;
int right = 0;
int next = 0;
Vector3 center;
AABB aabb;
};
@ -142,7 +142,7 @@ struct CSGBrushOperation {
Map<Ref<Material>, int> materials;
Map<Vector3, int> vertex_map;
OAHashMap<VertexKey, int, VertexKeyHash> snap_cache;
float vertex_snap;
float vertex_snap = 0.0;
inline void _add_distance(List<real_t> &r_intersectionsA, List<real_t> &r_intersectionsB, bool p_from_B, real_t p_distance) const;
inline bool _bvh_inside(FaceBVH *facebvhptr, int p_max_depth, int p_bvh_first, int p_face_idx) const;
@ -159,7 +159,7 @@ struct CSGBrushOperation {
};
struct Face2D {
int vertex_idx[3];
int vertex_idx[3] = {};
};
Vector<Vertex2D> vertices;
@ -167,7 +167,7 @@ struct CSGBrushOperation {
Plane plane;
Transform to_2D;
Transform to_3D;
float vertex_snap2;
float vertex_snap2 = 0.0;
inline int _get_point_idx(const Vector2 &p_point);
inline int _add_vertex(const Vertex2D &p_vertex);

View file

@ -625,15 +625,6 @@ void CSGShape3D::_bind_methods() {
}
CSGShape3D::CSGShape3D() {
operation = OPERATION_UNION;
parent = nullptr;
brush = nullptr;
dirty = false;
snap = 0.001;
use_collision = false;
collision_layer = 1;
collision_mask = 1;
calculate_tangents = true;
set_notify_local_transform(true);
}

View file

@ -50,23 +50,23 @@ public:
};
private:
Operation operation;
CSGShape3D *parent;
Operation operation = OPERATION_UNION;
CSGShape3D *parent = nullptr;
CSGBrush *brush;
CSGBrush *brush = nullptr;
AABB node_aabb;
bool dirty;
float snap;
bool dirty = false;
float snap = 0.001;
bool use_collision;
uint32_t collision_layer;
uint32_t collision_mask;
bool use_collision = false;
uint32_t collision_layer = 1;
uint32_t collision_mask = 1;
Ref<ConcavePolygonShape3D> root_collision_shape;
RID root_collision_instance;
bool calculate_tangents;
bool calculate_tangents = true;
Ref<ArrayMesh> root_mesh;
@ -85,12 +85,12 @@ private:
Vector<Vector2> uvs;
Vector<float> tans;
Ref<Material> material;
int last_added;
int last_added = 0;
Vector3 *verticesw;
Vector3 *normalsw;
Vector2 *uvsw;
float *tansw;
Vector3 *verticesw = nullptr;
Vector3 *normalsw = nullptr;
Vector2 *uvsw = nullptr;
float *tansw = nullptr;
};
//mikktspace callbacks

View file

@ -37,26 +37,26 @@
#include <ConvectionKernels.h>
struct CVTTCompressionJobParams {
bool is_hdr;
bool is_signed;
int bytes_per_pixel;
bool is_hdr = false;
bool is_signed = false;
int bytes_per_pixel = 0;
cvtt::Options options;
};
struct CVTTCompressionRowTask {
const uint8_t *in_mm_bytes;
uint8_t *out_mm_bytes;
int y_start;
int width;
int height;
uint8_t *out_mm_bytes = nullptr;
int y_start = 0;
int width = 0;
int height = 0;
};
struct CVTTCompressionJobQueue {
CVTTCompressionJobParams job_params;
const CVTTCompressionRowTask *job_tasks;
uint32_t num_tasks;
uint32_t current_task;
uint32_t num_tasks = 0;
uint32_t current_task = 0;
};
static void _digest_row_task(const CVTTCompressionJobParams &p_job_params, const CVTTCompressionRowTask &p_row_task) {

View file

@ -69,11 +69,11 @@ enum DDSFormat {
struct DDSFormatInfo {
const char *name;
bool compressed;
bool palette;
uint32_t divisor;
uint32_t block_size;
Image::Format format;
bool compressed = false;
bool palette = false;
uint32_t divisor = 0;
uint32_t block_size = 0;
Image::Format format = Image::Format::FORMAT_BPTC_RGBA;
};
static const DDSFormatInfo dds_format_info[DDS_MAX] = {

View file

@ -866,28 +866,12 @@ void NetworkedMultiplayerENet::_bind_methods() {
}
NetworkedMultiplayerENet::NetworkedMultiplayerENet() {
active = false;
server = false;
refuse_connections = false;
server_relay = true;
unique_id = 0;
target_peer = 0;
current_packet.packet = nullptr;
transfer_mode = TRANSFER_MODE_RELIABLE;
channel_count = SYSCH_MAX;
transfer_channel = -1;
always_ordered = false;
connection_status = CONNECTION_DISCONNECTED;
compression_mode = COMPRESS_NONE;
enet_compressor.context = this;
enet_compressor.compress = enet_compress;
enet_compressor.decompress = enet_decompress;
enet_compressor.destroy = enet_compressor_destroy;
bind_ip = IP_Address("*");
dtls_enabled = false;
dtls_verify = true;
}
NetworkedMultiplayerENet::~NetworkedMultiplayerENet() {

View file

@ -62,35 +62,35 @@ private:
SYSCH_MAX
};
bool active;
bool server;
bool active = false;
bool server = false;
uint32_t unique_id;
uint32_t unique_id = 0;
int target_peer;
TransferMode transfer_mode;
int transfer_channel;
int channel_count;
bool always_ordered;
int target_peer = 0;
TransferMode transfer_mode = TRANSFER_MODE_RELIABLE;
int transfer_channel = -1;
int channel_count = SYSCH_MAX;
bool always_ordered = false;
ENetEvent event;
ENetPeer *peer;
ENetHost *host;
ENetPeer *peer = nullptr;
ENetHost *host = nullptr;
bool refuse_connections;
bool server_relay;
bool refuse_connections = false;
bool server_relay = true;
ConnectionStatus connection_status;
ConnectionStatus connection_status = CONNECTION_DISCONNECTED;
Map<int, ENetPeer *> peer_map;
struct Packet {
ENetPacket *packet;
int from;
int channel;
ENetPacket *packet = nullptr;
int from = 0;
int channel = 0;
};
CompressionMode compression_mode;
CompressionMode compression_mode = COMPRESS_NONE;
List<Packet> incoming_packets;
@ -110,10 +110,10 @@ private:
IP_Address bind_ip;
bool dtls_enabled;
bool dtls_enabled = false;
Ref<CryptoKey> dtls_key;
Ref<X509Certificate> dtls_cert;
bool dtls_verify;
bool dtls_verify = true;
protected:
static void _bind_methods();

View file

@ -35,11 +35,11 @@
struct ETC1Header {
char tag[6]; // "PKM 10"
uint16_t format; // Format == number of mips (== zero)
uint16_t texWidth; // Texture dimensions, multiple of 4 (big-endian)
uint16_t texHeight;
uint16_t origWidth; // Original dimensions (big-endian)
uint16_t origHeight;
uint16_t format = 0; // Format == number of mips (== zero)
uint16_t texWidth = 0; // Texture dimensions, multiple of 4 (big-endian)
uint16_t texHeight = 0;
uint16_t origWidth = 0; // Original dimensions (big-endian)
uint16_t origHeight = 0;
};
RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) {

View file

@ -95,9 +95,9 @@ public:
class GDNativeLibraryEditorPlugin : public EditorPlugin {
GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin);
GDNativeLibraryEditor *library_editor;
EditorNode *editor;
Button *button;
GDNativeLibraryEditor *library_editor = nullptr;
EditorNode *editor = nullptr;
Button *button = nullptr;
public:
virtual String get_name() const override { return "GDNativeLibrary"; }

View file

@ -1196,13 +1196,6 @@ void NativeScriptLanguage::_unload_stuff(bool p_reload) {
NativeScriptLanguage::NativeScriptLanguage() {
NativeScriptLanguage::singleton = this;
#ifndef NO_THREADS
has_objects_to_register = false;
#endif
#ifdef DEBUG_ENABLED
profiling = false;
#endif
_init_call_type = "nativescript_init";
_init_call_name = "nativescript_init";

View file

@ -51,8 +51,8 @@ struct NativeScriptDesc {
struct Method {
godot_nativescript_instance_method method;
MethodInfo info;
int rpc_mode;
uint16_t rpc_method_id;
int rpc_mode = 0;
uint16_t rpc_method_id = 0;
String documentation;
};
@ -61,7 +61,7 @@ struct NativeScriptDesc {
godot_nativescript_property_get_func getter;
PropertyInfo info;
Variant default_value;
int rset_mode;
int rset_mode = 0;
uint16_t rset_property_id;
String documentation;
};
@ -78,7 +78,7 @@ struct NativeScriptDesc {
Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
StringName base;
StringName base_native_type;
NativeScriptDesc *base_data;
NativeScriptDesc *base_data = nullptr;
godot_nativescript_instance_create_func create_func;
godot_nativescript_instance_destroy_func destroy_func;
@ -86,7 +86,7 @@ struct NativeScriptDesc {
const void *type_tag = nullptr;
bool is_tool;
bool is_tool = false;
inline NativeScriptDesc() {
zeromem(&create_func, sizeof(godot_nativescript_instance_create_func));
@ -254,7 +254,7 @@ class NativeScriptLanguage : public ScriptLanguage {
private:
static NativeScriptLanguage *singleton;
int lang_idx;
int lang_idx = 0;
void _unload_stuff(bool p_reload = false);
@ -262,7 +262,7 @@ private:
#ifndef NO_THREADS
Set<Ref<GDNativeLibrary>> libs_to_init;
Set<NativeScript *> scripts_to_register;
volatile bool has_objects_to_register; // so that we don't lock mutex every frame - it's rarely needed
volatile bool has_objects_to_register = false; // so that we don't lock mutex every frame - it's rarely needed
void defer_init_library(Ref<GDNativeLibrary> lib, NativeScript *script);
#endif
@ -279,19 +279,19 @@ private:
struct ProfileData {
StringName signature;
uint64_t call_count;
uint64_t self_time;
uint64_t total_time;
uint64_t frame_call_count;
uint64_t frame_self_time;
uint64_t frame_total_time;
uint64_t last_frame_call_count;
uint64_t last_frame_self_time;
uint64_t last_frame_total_time;
uint64_t call_count = 0;
uint64_t self_time = 0;
uint64_t total_time = 0;
uint64_t frame_call_count = 0;
uint64_t frame_self_time = 0;
uint64_t frame_total_time = 0;
uint64_t last_frame_call_count = 0;
uint64_t last_frame_self_time = 0;
uint64_t last_frame_total_time = 0;
};
Map<StringName, ProfileData> profile_data;
bool profiling;
bool profiling = false;
public:
// These two maps must only be touched on the main thread

View file

@ -44,10 +44,10 @@ class PluginScriptInstance : public ScriptInstance {
private:
Ref<PluginScript> _script;
Object *_owner;
Object *_owner = nullptr;
Variant _owner_variant;
godot_pluginscript_instance_data *_data;
const godot_pluginscript_instance_desc *_desc;
godot_pluginscript_instance_data *_data = nullptr;
const godot_pluginscript_instance_desc *_desc = nullptr;
public:
_FORCE_INLINE_ Object *get_owner() { return _owner; }

View file

@ -118,7 +118,7 @@ class VideoStreamPlaybackGDNative : public VideoStreamPlayback {
AudioMixCallback mix_callback = nullptr;
int num_channels = -1;
float time = 0;
float time = 0.0;
bool seek_backward = false;
int mix_rate = 0;
double delay_compensation = 0;

View file

@ -51,7 +51,7 @@ union PointKey {
int64_t z : 21;
};
uint64_t key;
uint64_t key = 0;
bool operator<(const PointKey &p_key) const { return key < p_key.key; }
};
@ -86,8 +86,6 @@ struct Edge {
/// The other `Polygon` at this edge id has this `Polygon`.
int other_edge = -1;
Edge() {}
};
struct Polygon {
@ -111,8 +109,6 @@ struct Connection {
int A_edge = -1;
Polygon *B = nullptr;
int B_edge = -1;
Connection() {}
};
struct NavigationPoly {
@ -141,12 +137,12 @@ struct NavigationPoly {
};
struct FreeEdge {
bool is_free;
Polygon *poly;
uint32_t edge_id;
bool is_free = false;
Polygon *poly = nullptr;
uint32_t edge_id = 0;
Vector3 edge_center;
Vector3 edge_dir;
float edge_len_squared;
float edge_len_squared = 0.0;
};
} // namespace gd

View file

@ -53,7 +53,7 @@ class RvoAgent : public NavRid {
NavMap *map = nullptr;
RVO::Agent agent;
AvoidanceComputedCallback callback;
uint32_t map_update_id;
uint32_t map_update_id = 0;
public:
RvoAgent();

View file

@ -39,8 +39,8 @@
class GDScriptEditorTranslationParserPlugin : public EditorTranslationParserPlugin {
GDCLASS(GDScriptEditorTranslationParserPlugin, EditorTranslationParserPlugin);
Vector<String> *ids;
Vector<Vector<String>> *ids_ctx_plural;
Vector<String> *ids = nullptr;
Vector<Vector<String>> *ids_ctx_plural = nullptr;
// List of patterns used for extracting translation strings.
StringName tr_func = "tr";

View file

@ -219,7 +219,7 @@ StringName GDScript::get_instance_base_type() const {
}
struct _GDScriptMemberSort {
int index;
int index = 0;
StringName name;
_FORCE_INLINE_ bool operator<(const _GDScriptMemberSort &p_member) const { return index < p_member.index; }
};
@ -1162,17 +1162,6 @@ String GDScript::_get_gdscript_reference_class_name(const GDScript *p_gdscript)
GDScript::GDScript() :
script_list(this) {
valid = false;
subclass_count = 0;
initializer = nullptr;
_base = nullptr;
_owner = nullptr;
tool = false;
#ifdef TOOLS_ENABLED
source_changed_cache = false;
placeholder_fallback_enabled = false;
#endif
#ifdef DEBUG_ENABLED
{
MutexLock lock(GDScriptLanguage::get_singleton()->lock);

View file

@ -57,11 +57,11 @@ public:
class GDScript : public Script {
GDCLASS(GDScript, Script);
bool tool;
bool valid;
bool tool = false;
bool valid = false;
struct MemberInfo {
int index;
int index = 0;
StringName setter;
StringName getter;
MultiplayerAPI::RPCMode rpc_mode;
@ -77,8 +77,8 @@ class GDScript : public Script {
Ref<GDScriptNativeClass> native;
Ref<GDScript> base;
GDScript *_base; //fast pointer access
GDScript *_owner; //for subclasses
GDScript *_base = nullptr; //fast pointer access
GDScript *_owner = nullptr; //for subclasses
Set<StringName> members; //members are just indices to the instanced script.
Map<StringName, Variant> constants;
@ -97,8 +97,8 @@ class GDScript : public Script {
Map<StringName, Variant> member_default_values_cache;
Ref<GDScript> base_cache;
Set<ObjectID> inheriters_cache;
bool source_changed_cache;
bool placeholder_fallback_enabled;
bool source_changed_cache = false;
bool placeholder_fallback_enabled = false;
void _update_exports_values(Map<StringName, Variant> &values, List<PropertyInfo> &propnames);
DocData::ClassDoc doc;
@ -121,7 +121,7 @@ class GDScript : public Script {
GDScriptFunction *implicit_initializer = nullptr;
GDScriptFunction *initializer = nullptr; //direct pointer to new , faster to locate
int subclass_count;
int subclass_count = 0;
Set<Object *> instances;
//exported members
String source;

View file

@ -133,8 +133,8 @@ class GDScriptCompiler {
Error _parse_class_level(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
Error _parse_class_blocks(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
void _make_scripts(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state);
int err_line;
int err_column;
int err_line = 0;
int err_column = 0;
StringName source;
String error;
bool within_await = false;

View file

@ -77,14 +77,14 @@ int GDScriptFunction::get_max_stack_size() const {
}
struct _GDFKC {
int order;
int order = 0;
List<int> pos;
};
struct _GDFKCS {
int order;
int order = 0;
StringName id;
int pos;
int pos = 0;
bool operator<(const _GDFKCS &p_r) const {
return order < p_r.order;
@ -294,7 +294,6 @@ void GDScriptFunctionState::_bind_methods() {
GDScriptFunctionState::GDScriptFunctionState() :
scripts_list(this),
instances_list(this) {
function = nullptr;
}
GDScriptFunctionState::~GDScriptFunctionState() {

View file

@ -420,19 +420,19 @@ private:
public:
struct CallState {
GDScript *script;
GDScriptInstance *instance;
GDScript *script = nullptr;
GDScriptInstance *instance = nullptr;
#ifdef DEBUG_ENABLED
StringName function_name;
String script_path;
#endif
Vector<uint8_t> stack;
int stack_size;
int stack_size = 0;
Variant self;
uint32_t alloca_size;
int ip;
int line;
int defarg;
uint32_t alloca_size = 0;
int ip = 0;
int line = 0;
int defarg = 0;
Variant result;
};
@ -488,7 +488,7 @@ public:
class GDScriptFunctionState : public Reference {
GDCLASS(GDScriptFunctionState, Reference);
friend class GDScriptFunction;
GDScriptFunction *function;
GDScriptFunction *function = nullptr;
GDScriptFunction::CallState state;
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
Ref<GDScriptFunctionState> first_state;

View file

@ -351,7 +351,7 @@ public:
OP_COMP_GREATER_EQUAL,
};
OpType operation;
OpType operation = OpType::OP_ADDITION;
Variant::Operator variant_op = Variant::OP_MAX;
ExpressionNode *left_operand = nullptr;
ExpressionNode *right_operand = nullptr;
@ -753,7 +753,7 @@ public:
struct MatchBranchNode : public Node {
Vector<PatternNode *> patterns;
SuiteNode *block;
SuiteNode *block = nullptr;
bool has_wildcard = false;
MatchBranchNode() {
@ -1001,7 +1001,7 @@ public:
OP_LOGIC_NOT,
};
OpType operation;
OpType operation = OP_POSITIVE;
Variant::Operator variant_op = Variant::OP_MAX;
ExpressionNode *operand = nullptr;

View file

@ -178,7 +178,6 @@ public:
}
Token() {
type = EMPTY;
}
};

View file

@ -36,11 +36,6 @@
#include "editor/editor_node.h"
GDScriptLanguageServer::GDScriptLanguageServer() {
thread_running = false;
started = false;
use_thread = false;
port = 6008;
_EDITOR_DEF("network/language_server/remote_port", port);
_EDITOR_DEF("network/language_server/enable_smart_resolve", true);
_EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false);

View file

@ -41,10 +41,10 @@ class GDScriptLanguageServer : public EditorPlugin {
GDScriptLanguageProtocol protocol;
Thread thread;
bool thread_running;
bool started;
bool use_thread;
int port;
bool thread_running = false;
bool started = false;
bool use_thread = false;
int port = 6008;
static void thread_main(void *p_userdata);
private:

View file

@ -547,7 +547,7 @@ struct TextDocumentItem {
* The version number of this document (it will increase after each
* change, including undo/redo).
*/
int version;
int version = 0;
/**
* The content of the opened text document.
@ -584,7 +584,7 @@ struct TextDocumentContentChangeEvent {
/**
* The length of the range that got replaced.
*/
int rangeLength;
int rangeLength = 0;
/**
* The new text of the range/document.
@ -656,12 +656,12 @@ struct Diagnostic {
* The diagnostic's severity. Can be omitted. If omitted it is up to the
* client to interpret diagnostics as error, warning, info or hint.
*/
int severity;
int severity = 0;
/**
* The diagnostic's code, which might appear in the user interface.
*/
int code;
int code = 0;
/**
* A human-readable string describing the source of this
@ -833,7 +833,7 @@ struct CompletionItem {
* an icon is chosen by the editor. The standardized set
* of available values is defined in `CompletionItemKind`.
*/
int kind;
int kind = 0;
/**
* A human-readable string with additional information
@ -891,7 +891,7 @@ struct CompletionItem {
* The format of the insert text. The format applies to both the `insertText` property
* and the `newText` property of a provided `textEdit`.
*/
int insertTextFormat;
int insertTextFormat = 0;
/**
* An edit which is applied to a document when selecting this completion. When an edit is provided the value of
@ -1003,7 +1003,7 @@ struct CompletionList {
* This list it not complete. Further typing should result in recomputing
* this list.
*/
bool isIncomplete;
bool isIncomplete = false;
/**
* The completion items.

View file

@ -38,8 +38,8 @@ class GLTFCamera : public Resource {
private:
bool perspective = true;
float fov_size = 75;
float zfar = 4000;
float fov_size = 75.0;
float zfar = 4000.0;
float znear = 0.05;
protected:

View file

@ -2391,7 +2391,7 @@ Error GLTFDocument::_serialize_meshes(Ref<GLTFState> state) {
e["targetNames"] = target_names;
for (int j = 0; j < target_names.size(); j++) {
real_t weight = 0;
real_t weight = 0.0;
if (j < state->meshes.write[gltf_mesh_i]->get_blend_weights().size()) {
weight = state->meshes.write[gltf_mesh_i]->get_blend_weights()[j];
}
@ -5569,7 +5569,7 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
animation->set_loop(true);
}
float length = 0;
float length = 0.0;
for (Map<int, GLTFAnimation::Track>::Element *track_i = anim->get_tracks().front(); track_i; track_i = track_i->next()) {
const GLTFAnimation::Track &track = track_i->get();

View file

@ -1046,26 +1046,7 @@ RID GridMap::get_bake_mesh_instance(int p_idx) {
}
GridMap::GridMap() {
collision_layer = 1;
collision_mask = 1;
cell_size = Vector3(2, 2, 2);
octant_size = 8;
awaiting_update = false;
_in_tree = false;
center_x = true;
center_y = true;
center_z = true;
clip = false;
clip_floor = 0;
clip_axis = Vector3::AXIS_Z;
clip_above = true;
cell_scale = 1.0;
navigation = nullptr;
set_notify_transform(true);
recreating_octants = false;
}
GridMap::~GridMap() {

View file

@ -53,7 +53,7 @@ class GridMap : public Node3D {
int16_t y;
int16_t z;
};
uint64_t key;
uint64_t key = 0;
_FORCE_INLINE_ bool operator<(const IndexKey &p_key) const {
return key < p_key.key;
@ -68,7 +68,7 @@ class GridMap : public Node3D {
y = (int16_t)p_vector.y;
z = (int16_t)p_vector.z;
}
IndexKey() { key = 0; }
IndexKey() {}
};
/**
@ -80,13 +80,7 @@ class GridMap : public Node3D {
unsigned int rot : 5;
unsigned int layer : 8;
};
uint32_t cell;
Cell() {
item = 0;
rot = 0;
layer = 0;
}
uint32_t cell = 0;
};
/**
@ -103,7 +97,7 @@ class GridMap : public Node3D {
RID instance;
RID multimesh;
struct Item {
int index;
int index = 0;
Transform transform;
IndexKey key;
};
@ -116,7 +110,7 @@ class GridMap : public Node3D {
RID collision_debug;
RID collision_debug_instance;
bool dirty;
bool dirty = false;
RID static_body;
Map<IndexKey, NavMesh> navmesh_ids;
};
@ -129,35 +123,37 @@ class GridMap : public Node3D {
int16_t empty;
};
uint64_t key;
uint64_t key = 0;
_FORCE_INLINE_ bool operator<(const OctantKey &p_key) const {
return key < p_key.key;
}
//OctantKey(const IndexKey& p_k, int p_item) { indexkey=p_k.key; item=p_item; }
OctantKey() { key = 0; }
OctantKey() {}
};
uint32_t collision_layer;
uint32_t collision_mask;
uint32_t collision_layer = 1;
uint32_t collision_mask = 1;
Transform last_transform;
bool _in_tree;
Vector3 cell_size;
int octant_size;
bool center_x, center_y, center_z;
float cell_scale;
Navigation3D *navigation;
bool _in_tree = false;
Vector3 cell_size = Vector3(2, 2, 2);
int octant_size = 8;
bool center_x = true;
bool center_y = true;
bool center_z = true;
float cell_scale = 1.0;
Navigation3D *navigation = nullptr;
bool clip;
bool clip_above;
int clip_floor;
bool clip = false;
bool clip_above = true;
int clip_floor = 0;
bool recreating_octants;
bool recreating_octants = false;
Vector3::Axis clip_axis;
Vector3::Axis clip_axis = Vector3::AXIS_Z;
Ref<MeshLibrary> mesh_library;
@ -167,10 +163,10 @@ class GridMap : public Node3D {
void _recreate_octant_data();
struct BakeLight {
RS::LightType type;
RS::LightType type = RS::LightType::LIGHT_DIRECTIONAL;
Vector3 pos;
Vector3 dir;
float param[RS::LIGHT_PARAM_MAX];
float param[RS::LIGHT_PARAM_MAX] = {};
};
_FORCE_INLINE_ Vector3 _octant_get_offset(const OctantKey &p_key) const {
@ -183,7 +179,7 @@ class GridMap : public Node3D {
bool _octant_update(const OctantKey &p_key);
void _octant_clean_up(const OctantKey &p_key);
void _octant_transform(const OctantKey &p_key);
bool awaiting_update;
bool awaiting_update = false;
void _queue_octants_dirty();
void _update_octants_callback();

View file

@ -769,7 +769,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
struct _CGMEItemSort {
String name;
int id;
int id = 0;
_FORCE_INLINE_ bool operator<(const _CGMEItemSort &r_it) const { return name < r_it.name; }
};
@ -1151,7 +1151,6 @@ void GridMapEditor::_bind_methods() {
}
GridMapEditor::GridMapEditor(EditorNode *p_editor) {
input_action = INPUT_NONE;
editor = p_editor;
undo_redo = p_editor->get_undo_redo();
@ -1234,7 +1233,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
settings_pick_distance->set_value(EDITOR_DEF("editors/grid_map/pick_distance", 5000.0));
settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance);
clip_mode = CLIP_DISABLED;
options->get_popup()->connect("id_pressed", callable_mp(this, &GridMapEditor::_menu_option));
HBoxContainer *hb = memnew(HBoxContainer);
@ -1275,8 +1273,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
EDITOR_DEF("editors/grid_map/preview_size", 64);
display_mode = DISPLAY_THUMBNAIL;
mesh_library_palette = memnew(ItemList);
add_child(mesh_library_palette);
mesh_library_palette->set_v_size_flags(SIZE_EXPAND_FILL);
@ -1296,11 +1292,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
edit_floor[1] = -1;
edit_floor[2] = -1;
cursor_visible = false;
selected_palette = -1;
lock_view = false;
cursor_rot = 0;
selection_mesh = RenderingServer::get_singleton()->mesh_create();
paste_mesh = RenderingServer::get_singleton()->mesh_create();
@ -1418,8 +1409,6 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
}
_set_selection(false);
updating = false;
accumulated_floor_delta = 0.0;
indicator_mat.instance();
indicator_mat->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);

View file

@ -65,11 +65,11 @@ class GridMapEditor : public VBoxContainer {
};
UndoRedo *undo_redo;
InputAction input_action;
InputAction input_action = INPUT_NONE;
Panel *panel;
MenuButton *options;
SpinBox *floor;
double accumulated_floor_delta;
double accumulated_floor_delta = 0.0;
Button *mode_thumbnail;
Button *mode_list;
LineEdit *search_box;
@ -82,19 +82,19 @@ class GridMapEditor : public VBoxContainer {
struct SetItem {
Vector3i position;
int new_value;
int new_orientation;
int old_value;
int old_orientation;
int new_value = 0;
int new_orientation = 0;
int old_value = 0;
int old_orientation = 0;
};
List<SetItem> set_items;
GridMap *node = nullptr;
MeshLibrary *last_mesh_library;
ClipMode clip_mode;
ClipMode clip_mode = CLIP_DISABLED;
bool lock_view;
bool lock_view = false;
Transform grid_xform;
Transform edit_grid_xform;
Vector3::Axis edit_axis;
@ -112,9 +112,9 @@ class GridMapEditor : public VBoxContainer {
RID paste_instance;
struct ClipboardItem {
int cell_item;
int cell_item = 0;
Vector3 grid_offset;
int orientation;
int orientation = 0;
RID instance;
};
@ -125,14 +125,14 @@ class GridMapEditor : public VBoxContainer {
Ref<StandardMaterial3D> outer_mat;
Ref<StandardMaterial3D> selection_floor_mat;
bool updating;
bool updating = false;
struct Selection {
Vector3 click;
Vector3 current;
Vector3 begin;
Vector3 end;
bool active;
bool active = false;
} selection;
Selection last_selection;
@ -141,18 +141,18 @@ class GridMapEditor : public VBoxContainer {
Vector3 current;
Vector3 begin;
Vector3 end;
int orientation;
int orientation = 0;
};
PasteIndicator paste_indicator;
bool cursor_visible;
bool cursor_visible = false;
Transform cursor_transform;
Vector3 cursor_origin;
int display_mode;
int selected_palette;
int cursor_rot;
int display_mode = DISPLAY_THUMBNAIL;
int selected_palette = -1;
int cursor_rot = 0;
enum Menu {
MENU_OPTION_NEXT_LEVEL,

View file

@ -46,18 +46,18 @@ class LightmapperRD : public Lightmapper {
};
struct Light {
float position[3];
float position[3] = {};
uint32_t type = LIGHT_TYPE_DIRECTIONAL;
float direction[3];
float energy;
float color[3];
float size;
float range;
float attenuation;
float cos_spot_angle;
float inv_spot_attenuation;
uint32_t static_bake;
uint32_t pad[3];
float direction[3] = {};
float energy = 0.0;
float color[3] = {};
float size = 0.0;
float range = 0.0;
float attenuation = 0.0;
float cos_spot_angle = 0.0;
float inv_spot_attenuation = 0.0;
uint32_t static_bake = 0;
uint32_t pad[3] = {};
bool operator<(const Light &p_light) const {
return type < p_light.type;
@ -65,10 +65,10 @@ class LightmapperRD : public Lightmapper {
};
struct Vertex {
float position[3];
float normal_z;
float uv[2];
float normal_xy[2];
float position[3] = {};
float normal_z = 0.0;
float uv[2] = {};
float normal_xy[2] = {};
bool operator==(const Vertex &p_vtx) const {
return (position[0] == p_vtx.position[0]) &&
@ -102,7 +102,7 @@ class LightmapperRD : public Lightmapper {
};
struct Probe {
float position[4];
float position[4] = {};
};
Vector<Probe> probe_positions;
@ -158,15 +158,15 @@ class LightmapperRD : public Lightmapper {
};
struct Box {
float min_bounds[3];
float pad0;
float max_bounds[3];
float pad1;
float min_bounds[3] = {};
float pad0 = 0.0;
float max_bounds[3] = {};
float pad1 = 0.0;
};
struct Triangle {
uint32_t indices[3];
uint32_t slice;
uint32_t indices[3] = {};
uint32_t slice = 0;
bool operator<(const Triangle &p_triangle) const {
return slice < p_triangle.slice;
}
@ -177,8 +177,8 @@ class LightmapperRD : public Lightmapper {
Vector<Light> lights;
struct TriangleSort {
uint32_t cell_index;
uint32_t triangle_index;
uint32_t cell_index = 0;
uint32_t triangle_index = 0;
bool operator<(const TriangleSort &p_triangle_sort) const {
return cell_index < p_triangle_sort.cell_index; //sorting by triangle index in this case makes no sense
}
@ -187,44 +187,44 @@ class LightmapperRD : public Lightmapper {
void _plot_triangle_into_triangle_index_list(int p_size, const Vector3i &p_ofs, const AABB &p_bounds, const Vector3 p_points[], uint32_t p_triangle_index, LocalVector<TriangleSort> &triangles, uint32_t p_grid_size);
struct RasterPushConstant {
float atlas_size[2];
float uv_offset[2];
float to_cell_size[3];
uint32_t base_triangle;
float to_cell_offset[3];
float bias;
int32_t grid_size[3];
uint32_t pad2;
float atlas_size[2] = {};
float uv_offset[2] = {};
float to_cell_size[3] = {};
uint32_t base_triangle = 0;
float to_cell_offset[3] = {};
float bias = 0.0;
int32_t grid_size[3] = {};
uint32_t pad2 = 0;
};
struct RasterSeamsPushConstant {
uint32_t base_index;
uint32_t slice;
float uv_offset[2];
uint32_t debug;
float blend;
uint32_t pad[2];
uint32_t base_index = 0;
uint32_t slice = 0;
float uv_offset[2] = {};
uint32_t debug = 0;
float blend = 0.0;
uint32_t pad[2] = {};
};
struct PushConstant {
int32_t atlas_size[2];
uint32_t ray_count;
uint32_t ray_to;
int32_t atlas_size[2] = {};
uint32_t ray_count = 0;
uint32_t ray_to = 0;
float world_size[3];
float bias;
float world_size[3] = {};
float bias = 0.0;
float to_cell_offset[3];
uint32_t ray_from;
float to_cell_offset[3] = {};
uint32_t ray_from = 0;
float to_cell_size[3];
uint32_t light_count;
float to_cell_size[3] = {};
uint32_t light_count = 0;
int32_t grid_size;
int32_t atlas_slice;
int32_t region_ofs[2];
int32_t grid_size = 0;
int32_t atlas_slice = 0;
int32_t region_ofs[2] = {};
float environment_xform[12];
float environment_xform[12] = {};
};
Vector<Ref<Image>> bake_textures;

View file

@ -246,7 +246,6 @@ int PacketPeerMbedDTLS::get_max_packet_size() const {
PacketPeerMbedDTLS::PacketPeerMbedDTLS() {
ssl_ctx.instance();
status = STATUS_DISCONNECTED;
}
PacketPeerMbedDTLS::~PacketPeerMbedDTLS() {

View file

@ -44,7 +44,7 @@ private:
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
Status status;
Status status = STATUS_DISCONNECTED;
String hostname;
Ref<PacketPeerUDP> base;

View file

@ -76,7 +76,6 @@ void CookieContextMbedTLS::clear() {
}
CookieContextMbedTLS::CookieContextMbedTLS() {
inited = false;
}
CookieContextMbedTLS::~CookieContextMbedTLS() {
@ -205,7 +204,6 @@ mbedtls_ssl_context *SSLContextMbedTLS::get_context() {
}
SSLContextMbedTLS::SSLContextMbedTLS() {
inited = false;
}
SSLContextMbedTLS::~SSLContextMbedTLS() {

View file

@ -50,7 +50,7 @@ class CookieContextMbedTLS : public Reference {
friend class SSLContextMbedTLS;
protected:
bool inited;
bool inited = false;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_cookie_ctx cookie_ctx;
@ -65,7 +65,7 @@ public:
class SSLContextMbedTLS : public Reference {
protected:
bool inited;
bool inited = false;
static PackedByteArray _read_file(String p_path);

View file

@ -274,7 +274,6 @@ int StreamPeerMbedTLS::get_available_bytes() const {
StreamPeerMbedTLS::StreamPeerMbedTLS() {
ssl_ctx.instance();
status = STATUS_DISCONNECTED;
}
StreamPeerMbedTLS::~StreamPeerMbedTLS() {

View file

@ -36,7 +36,7 @@
class StreamPeerMbedTLS : public StreamPeerSSL {
private:
Status status;
Status status = STATUS_DISCONNECTED;
String hostname;
Ref<StreamPeer> base;

View file

@ -78,11 +78,11 @@ class AudioStreamMP3 : public AudioStream {
void *data = nullptr;
uint32_t data_len = 0;
float sample_rate = 1;
float sample_rate = 1.0;
int channels = 1;
float length = 0;
float length = 0.0;
bool loop = false;
float loop_offset = 0;
float loop_offset = 0.0;
void clear_data();
protected:

View file

@ -448,19 +448,7 @@ void MobileVRInterface::process() {
};
};
MobileVRInterface::MobileVRInterface() {
initialized = false;
// Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
eye_height = 1.85;
intraocular_dist = 6.0;
display_width = 14.5;
display_to_lens = 4.0;
oversample = 1.5;
k1 = 0.215;
k2 = 0.215;
last_ticks = 0;
};
MobileVRInterface::MobileVRInterface() {}
MobileVRInterface::~MobileVRInterface() {
// and make sure we cleanup if we haven't already

View file

@ -51,19 +51,21 @@ class MobileVRInterface : public XRInterface {
GDCLASS(MobileVRInterface, XRInterface);
private:
bool initialized;
bool initialized = false;
Basis orientation;
float eye_height;
uint64_t last_ticks;
real_t intraocular_dist;
real_t display_width;
real_t display_to_lens;
real_t oversample;
// Just set some defaults for these. At some point we need to look at adding a lookup table for common device + headset combos and/or support reading cardboard QR codes
float eye_height = 1.85;
uint64_t last_ticks = 0;
real_t intraocular_dist = 6.0;
real_t display_width = 14.5;
real_t display_to_lens = 4.0;
real_t oversample = 1.5;
//@TODO not yet used, these are needed in our distortion shader...
real_t k1;
real_t k2;
real_t k1 = 0.215;
real_t k2 = 0.215;
/*
logic for processing our sensor data, this was originally in our positional tracker logic but I think
@ -73,9 +75,9 @@ private:
Vector3 scale_magneto(const Vector3 &p_magnetometer);
Basis combine_acc_mag(const Vector3 &p_grav, const Vector3 &p_magneto);
int mag_count;
bool has_gyro;
bool sensor_first;
int mag_count = 0;
bool has_gyro = false;
bool sensor_first = false;
Vector3 last_accerometer_data;
Vector3 last_magnetometer_data;
Vector3 mag_current_min;

View file

@ -189,8 +189,6 @@ void GDMonoLog::initialize() {
GDMonoLog::GDMonoLog() {
singleton = this;
log_level_id = -1;
}
GDMonoLog::~GDMonoLog() {

View file

@ -46,9 +46,9 @@
class GDMonoLog {
#ifdef GD_MONO_LOG_ENABLED
int log_level_id;
int log_level_id = -1;
FileAccess *log_file;
FileAccess *log_file = nullptr;
String log_file_path;
bool _try_create_logs_dir(const String &p_logs_dir);

View file

@ -33,15 +33,6 @@
#include "core/core_string_names.h"
NoiseTexture::NoiseTexture() {
update_queued = false;
regen_queued = false;
first_time = true;
size = Vector2i(512, 512);
seamless = false;
as_normal_map = false;
bump_strength = 8.0;
noise = Ref<OpenSimplexNoise>();
_queue_update();

View file

@ -47,18 +47,18 @@ private:
Thread noise_thread;
bool first_time;
bool update_queued;
bool regen_queued;
bool first_time = true;
bool update_queued = false;
bool regen_queued = false;
mutable RID texture;
uint32_t flags;
uint32_t flags = 0;
Ref<OpenSimplexNoise> noise;
Vector2i size;
bool seamless;
bool as_normal_map;
float bump_strength;
Vector2i size = Vector2i(512, 512);
bool seamless = false;
bool as_normal_map = false;
float bump_strength = 8.0;
void _thread_done(const Ref<Image> &p_image);
static void _thread_function(void *p_ud);

View file

@ -33,12 +33,6 @@
#include "core/core_string_names.h"
OpenSimplexNoise::OpenSimplexNoise() {
seed = 0;
persistence = 0.5;
octaves = 3;
period = 64;
lacunarity = 2.0;
_init_seeds();
}

View file

@ -48,11 +48,11 @@ class OpenSimplexNoise : public Resource {
osn_context contexts[MAX_OCTAVES];
int seed;
float persistence; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness.
int octaves; // Number of noise layers
float period; // Distance above which we start to see similarities. The higher, the longer "hills" will be on a terrain.
float lacunarity; // Controls period change across octaves. 2 is usually a good value to address all detail levels.
int seed = 0;
float persistence = 0.5; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness.
int octaves = 3; // Number of noise layers
float period = 64.0; // Distance above which we start to see similarities. The higher, the longer "hills" will be on a terrain.
float lacunarity = 2.0; // Controls period change across octaves. 2 is usually a good value to address all detail levels.
public:
OpenSimplexNoise();

View file

@ -207,7 +207,7 @@ ResourceFormatPVR::ResourceFormatPVR() {
struct PVRTCBlock {
//blocks are 64 bits
uint32_t data[2];
uint32_t data[2] = {};
};
_FORCE_INLINE_ bool is_po2(uint32_t p_input) {

View file

@ -365,12 +365,10 @@ Array RegEx::get_names() const {
RegEx::RegEx() {
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
code = nullptr;
}
RegEx::RegEx(const String &p_pattern) {
general_ctx = pcre2_general_context_create_32(&_regex_malloc, &_regex_free, nullptr);
code = nullptr;
compile(p_pattern);
}

View file

@ -42,8 +42,8 @@ class RegExMatch : public Reference {
GDCLASS(RegExMatch, Reference);
struct Range {
int start;
int end;
int start = 0;
int end = 0;
};
String subject;
@ -72,7 +72,7 @@ class RegEx : public Reference {
GDCLASS(RegEx, Reference);
void *general_ctx;
void *code;
void *code = nullptr;
String pattern;
void _pattern_info(uint32_t what, void *where) const;

View file

@ -263,16 +263,7 @@ void AudioStreamOGGVorbis::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "loop_offset"), "set_loop_offset", "get_loop_offset");
}
AudioStreamOGGVorbis::AudioStreamOGGVorbis() {
data = nullptr;
data_len = 0;
length = 0;
sample_rate = 1;
channels = 1;
loop_offset = 0;
decode_mem_size = 0;
loop = false;
}
AudioStreamOGGVorbis::AudioStreamOGGVorbis() {}
AudioStreamOGGVorbis::~AudioStreamOGGVorbis() {
clear_data();

View file

@ -41,11 +41,11 @@ class AudioStreamOGGVorbis;
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
GDCLASS(AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled);
stb_vorbis *ogg_stream;
stb_vorbis *ogg_stream = nullptr;
stb_vorbis_alloc ogg_alloc;
uint32_t frames_mixed;
bool active;
int loops;
uint32_t frames_mixed = 0;
bool active = false;
int loops = 0;
friend class AudioStreamOGGVorbis;
@ -76,15 +76,15 @@ class AudioStreamOGGVorbis : public AudioStream {
friend class AudioStreamPlaybackOGGVorbis;
void *data;
uint32_t data_len;
void *data = nullptr;
uint32_t data_len = 0;
int decode_mem_size;
float sample_rate;
int channels;
float length;
bool loop;
float loop_offset;
int decode_mem_size = 0;
float sample_rate = 1.0;
int channels = 1;
float length = 0.0;
bool loop = false;
float loop_offset = 0.0;
void clear_data();
protected:

View file

@ -36,7 +36,7 @@
struct hb_bmp_font_t {
BitmapFontDataAdvanced *face = nullptr;
float font_size = 0;
float font_size = 0.0;
bool unref = false; /* Whether to destroy bm_face when done. */
};
@ -340,7 +340,7 @@ Error BitmapFontDataAdvanced::load_from_file(const String &p_filename, int p_bas
char_map[idx] = c;
} else if (type == "kerning") {
KerningPairKey kpk;
float k = 0;
float k = 0.0;
if (keys.has("first")) {
kpk.A = keys["first"].to_int();
}

View file

@ -74,14 +74,11 @@ private:
uint32_t size : 16;
uint32_t outline_size : 16;
};
uint32_t key;
uint32_t key = 0;
};
bool operator<(CacheID right) const {
return key < right.key;
}
CacheID() {
key = 0;
}
};
struct DataAtSize {
@ -91,10 +88,10 @@ private:
int size = 0;
float scale_color_font = 1.f;
float ascent = 0;
float descent = 0;
float underline_position = 0;
float underline_thickness = 0;
float ascent = 0.0;
float descent = 0.0;
float underline_position = 0.0;
float underline_thickness = 0.0;
Vector<CharTexture> textures;
HashMap<uint32_t, Character> glyph_map;

View file

@ -45,9 +45,9 @@
class ScriptIterator {
public:
struct ScriptRange {
int start;
int end;
hb_script_t script;
int start = 0;
int end = 0;
hb_script_t script = HB_SCRIPT_COMMON;
};
Vector<ScriptRange> script_ranges;

View file

@ -148,7 +148,7 @@ Error BitmapFontDataFallback::load_from_file(const String &p_filename, int p_bas
char_map[idx] = c;
} else if (type == "kerning") {
KerningPairKey kpk;
float k = 0;
float k = 0.0;
if (keys.has("first")) {
kpk.A = keys["first"].to_int();
}

View file

@ -70,14 +70,11 @@ private:
uint32_t size : 16;
uint32_t outline_size : 16;
};
uint32_t key;
uint32_t key = 0;
};
bool operator<(CacheID right) const {
return key < right.key;
}
CacheID() {
key = 0;
}
};
struct DataAtSize {
@ -86,10 +83,10 @@ private:
int size = 0;
float scale_color_font = 1.f;
float ascent = 0;
float descent = 0;
float underline_position = 0;
float underline_thickness = 0;
float ascent = 0.0;
float descent = 0.0;
float underline_position = 0.0;
float underline_thickness = 0.0;
Vector<CharTexture> textures;
HashMap<char32_t, Character> char_map;

View file

@ -57,20 +57,20 @@ class ImageLoaderTGA : public ImageFormatLoader {
};
struct tga_header_s {
uint8_t id_length;
uint8_t color_map_type;
uint8_t id_length = 0;
uint8_t color_map_type = 0;
tga_type_e image_type;
uint16_t first_color_entry;
uint16_t color_map_length;
uint8_t color_map_depth;
uint16_t first_color_entry = 0;
uint16_t color_map_length = 0;
uint8_t color_map_depth = 0;
uint16_t x_origin;
uint16_t y_origin;
uint16_t image_width;
uint16_t image_height;
uint8_t pixel_depth;
uint8_t image_descriptor;
uint16_t x_origin = 0;
uint16_t y_origin = 0;
uint16_t image_width = 0;
uint16_t image_height = 0;
uint8_t pixel_depth = 0;
uint8_t image_descriptor = 0;
};
static Error decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size);
static Error convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome, size_t p_output_size);

View file

@ -645,30 +645,13 @@ void VideoStreamPlaybackTheora::_streaming_thread(void *ud) {
#endif
VideoStreamPlaybackTheora::VideoStreamPlaybackTheora() {
file = nullptr;
theora_p = 0;
vorbis_p = 0;
videobuf_ready = 0;
playing = false;
frames_pending = 0;
videobuf_time = 0;
paused = false;
buffering = false;
texture = Ref<ImageTexture>(memnew(ImageTexture));
mix_callback = nullptr;
mix_udata = nullptr;
audio_track = 0;
delay_compensation = 0;
audio_frames_wrote = 0;
#ifdef THEORA_USE_THREAD_STREAMING
int rb_power = nearest_shift(RB_SIZE_KB * 1024);
ring_buffer.resize(rb_power);
read_buffer.resize(RB_SIZE_KB * 1024);
thread_sem = Semaphore::create();
thread_exit = false;
thread_eof = false;
#endif
};

View file

@ -52,12 +52,12 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
};
//Image frames[MAX_FRAMES];
Image::Format format;
Image::Format format = Image::Format::FORMAT_L8;
Vector<uint8_t> frame_data;
int frames_pending;
FileAccess *file;
int frames_pending = 0;
FileAccess *file = nullptr;
String file_name;
int audio_frames_wrote;
int audio_frames_wrote = 0;
Point2i size;
int buffer_data();
@ -65,8 +65,8 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
void video_write();
float get_time() const;
bool theora_eos;
bool vorbis_eos;
bool theora_eos = false;
bool vorbis_eos = false;
ogg_sync_state oy;
ogg_page og;
@ -74,33 +74,33 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
ogg_stream_state to;
th_info ti;
th_comment tc;
th_dec_ctx *td;
th_dec_ctx *td = nullptr;
vorbis_info vi;
vorbis_dsp_state vd;
vorbis_block vb;
vorbis_comment vc;
th_pixel_fmt px_fmt;
double videobuf_time;
int pp_inc;
double videobuf_time = 0;
int pp_inc = 0;
int theora_p;
int vorbis_p;
int pp_level_max;
int pp_level;
int videobuf_ready;
int theora_p = 0;
int vorbis_p = 0;
int pp_level_max = 0;
int pp_level = 0;
int videobuf_ready = 0;
bool playing;
bool buffering;
bool playing = false;
bool buffering = false;
double last_update_time;
double time;
double delay_compensation;
double last_update_time = 0;
double time = 0;
double delay_compensation = 0;
Ref<ImageTexture> texture;
AudioMixCallback mix_callback;
void *mix_udata;
bool paused;
void *mix_udata = nullptr;
bool paused = false;
#ifdef THEORA_USE_THREAD_STREAMING
@ -110,16 +110,16 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
RingBuffer<uint8_t> ring_buffer;
Vector<uint8_t> read_buffer;
bool thread_eof;
bool thread_eof = false;
Semaphore *thread_sem;
Thread thread;
volatile bool thread_exit;
volatile bool thread_exit = false;
static void _streaming_thread(void *ud);
#endif
int audio_track;
int audio_track = 0;
protected:
void clear();

View file

@ -393,9 +393,6 @@ void UPNP::_bind_methods() {
}
UPNP::UPNP() {
discover_multicast_if = "";
discover_local_port = 0;
discover_ipv6 = false;
}
UPNP::~UPNP() {

View file

@ -41,9 +41,9 @@ class UPNP : public Reference {
GDCLASS(UPNP, Reference);
private:
String discover_multicast_if;
int discover_local_port;
bool discover_ipv6;
String discover_multicast_if = "";
int discover_local_port = 0;
bool discover_ipv6 = false;
Vector<Ref<UPNPDevice>> devices;

View file

@ -137,7 +137,6 @@ Ref<VisualScript> VisualScriptNode::get_visual_script() const {
}
VisualScriptNode::VisualScriptNode() {
breakpoint = false;
}
////////////////
@ -145,8 +144,6 @@ VisualScriptNode::VisualScriptNode() {
/////////////////////
VisualScriptNodeInstance::VisualScriptNodeInstance() {
sequence_outputs = nullptr;
input_ports = nullptr;
}
VisualScriptNodeInstance::~VisualScriptNodeInstance() {
@ -2623,14 +2620,8 @@ void VisualScriptLanguage::get_registered_node_names(List<String> *r_names) {
}
VisualScriptLanguage::VisualScriptLanguage() {
notification = "_notification";
_step = "_step";
_subcall = "_subcall";
singleton = this;
_debug_parse_err_node = -1;
_debug_parse_err_file = "";
_debug_call_stack_pos = 0;
int dmcs = GLOBAL_DEF("debug/settings/visual_script/max_call_stack", 1024);
ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/visual_script/max_call_stack", PropertyInfo(Variant::INT, "debug/settings/visual_script/max_call_stack", PROPERTY_HINT_RANGE, "1024,4096,1,or_greater")); //minimum is 1024

View file

@ -49,7 +49,7 @@ class VisualScriptNode : public Resource {
Ref<VisualScript> script_used;
Array default_input_values;
bool breakpoint;
bool breakpoint = false;
void _set_default_input_values(Array p_values);
Array _get_default_input_values() const;
@ -90,13 +90,9 @@ public:
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance) = 0;
struct TypeGuess {
Variant::Type type;
Variant::Type type = Variant::NIL;
StringName gdclass;
Ref<Script> script;
TypeGuess() {
type = Variant::NIL;
}
};
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const;
@ -114,19 +110,19 @@ class VisualScriptNodeInstance {
INPUT_DEFAULT_VALUE_BIT = INPUT_SHIFT, // from unassigned input port, using default value (edited by user)
};
int id;
int sequence_index;
VisualScriptNodeInstance **sequence_outputs;
int sequence_output_count;
int id = 0;
int sequence_index = 0;
VisualScriptNodeInstance **sequence_outputs = nullptr;
int sequence_output_count = 0;
Vector<VisualScriptNodeInstance *> dependencies;
int *input_ports;
int input_port_count;
int *output_ports;
int output_port_count;
int working_mem_idx;
int pass_idx;
int *input_ports = nullptr;
int input_port_count = 0;
int *output_ports = nullptr;
int output_port_count = 0;
int working_mem_idx = 0;
int pass_idx = 0;
VisualScriptNode *base;
VisualScriptNode *base = nullptr;
public:
enum StartMode {
@ -178,7 +174,7 @@ public:
uint64_t from_output : 16;
uint64_t to_node : 24;
};
uint64_t id;
uint64_t id = 0;
};
bool operator<(const SequenceConnection &p_connection) const {
@ -194,7 +190,7 @@ public:
uint64_t to_node : 24;
uint64_t to_port : 8;
};
uint64_t id;
uint64_t id = 0;
};
bool operator<(const DataConnection &p_connection) const {
@ -208,7 +204,7 @@ private:
StringName base_type;
struct Argument {
String name;
Variant::Type type;
Variant::Type type = Variant::Type::NIL;
};
struct NodeData {
@ -231,7 +227,7 @@ private:
struct Variable {
PropertyInfo info;
Variant default_value;
bool _export;
bool _export = false;
// Add getter & setter options here.
};
@ -388,26 +384,27 @@ public:
};
class VisualScriptInstance : public ScriptInstance {
Object *owner;
Object *owner = nullptr;
Ref<VisualScript> script;
Map<StringName, Variant> variables; // Using variable path, not script.
Map<int, VisualScriptNodeInstance *> instances;
struct Function {
int node;
int max_stack;
int trash_pos;
int flow_stack_size;
int pass_stack_size;
int node_count;
int argument_count;
int node = 0;
int max_stack = 0;
int trash_pos = 0;
int flow_stack_size = 0;
int pass_stack_size = 0;
int node_count = 0;
int argument_count = 0;
};
Map<StringName, Function> functions;
Vector<Variant> default_values;
int max_input_args, max_output_args;
int max_input_args = 0;
int max_output_args = 0;
StringName source;
@ -479,14 +476,14 @@ class VisualScriptFunctionState : public Reference {
ObjectID instance_id;
ObjectID script_id;
VisualScriptInstance *instance;
VisualScriptInstance *instance = nullptr;
StringName function;
Vector<uint8_t> stack;
int working_mem_index;
int variant_stack_size;
VisualScriptNodeInstance *node;
int flow_stack_pos;
int pass;
int working_mem_index = 0;
int variant_stack_size = 0;
VisualScriptNodeInstance *node = nullptr;
int flow_stack_pos = 0;
int pass = 0;
Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
@ -507,25 +504,25 @@ class VisualScriptLanguage : public ScriptLanguage {
Map<String, VisualScriptNodeRegisterFunc> register_funcs;
struct CallLevel {
Variant *stack;
Variant **work_mem;
const StringName *function;
VisualScriptInstance *instance;
int *current_id;
Variant *stack = nullptr;
Variant **work_mem = nullptr;
const StringName *function = nullptr;
VisualScriptInstance *instance = nullptr;
int *current_id = nullptr;
};
int _debug_parse_err_node;
String _debug_parse_err_file;
int _debug_parse_err_node = -1;
String _debug_parse_err_file = "";
String _debug_error;
int _debug_call_stack_pos;
int _debug_call_stack_pos = 0;
int _debug_max_call_stack;
CallLevel *_call_stack;
public:
StringName notification;
StringName notification = "_notification";
StringName _get_output_port_unsequenced;
StringName _step;
StringName _subcall;
StringName _step = "_step";
StringName _subcall = "_subcall";
static VisualScriptLanguage *singleton;

View file

@ -1507,12 +1507,6 @@ VisualScriptNodeInstance *VisualScriptExpression::instance(VisualScriptInstance
}
VisualScriptExpression::VisualScriptExpression() {
output_type = Variant::NIL;
expression_dirty = true;
error_set = true;
root = nullptr;
nodes = nullptr;
sequenced = false;
}
VisualScriptExpression::~VisualScriptExpression() {

View file

@ -39,20 +39,18 @@ class VisualScriptExpression : public VisualScriptNode {
friend class VisualScriptNodeInstanceExpression;
struct Input {
Variant::Type type;
Variant::Type type = Variant::NIL;
String name;
Input() { type = Variant::NIL; }
};
Vector<Input> inputs;
Variant::Type output_type;
Variant::Type output_type = Variant::NIL;
String expression;
bool sequenced;
int str_ofs;
bool expression_dirty;
bool sequenced = false;
int str_ofs = 0;
bool expression_dirty = true;
bool _compile_expression();
@ -114,7 +112,7 @@ class VisualScriptExpression : public VisualScriptNode {
Error _get_token(Token &r_token);
String error_str;
bool error_set;
bool error_set = true;
struct ENode {
enum Type {
@ -131,11 +129,10 @@ class VisualScriptExpression : public VisualScriptNode {
TYPE_CALL
};
ENode *next;
ENode *next = nullptr;
Type type;
Type type = Type::TYPE_SELF;
ENode() { next = nullptr; }
virtual ~ENode() {
if (next) {
memdelete(next);
@ -144,17 +141,17 @@ class VisualScriptExpression : public VisualScriptNode {
};
struct Expression {
bool is_op;
bool is_op = false;
union {
Variant::Operator op;
ENode *node;
ENode *node = nullptr;
};
};
ENode *_parse_expression();
struct InputNode : public ENode {
int index;
int index = 0;
InputNode() {
type = TYPE_INPUT;
}
@ -168,9 +165,9 @@ class VisualScriptExpression : public VisualScriptNode {
};
struct OperatorNode : public ENode {
Variant::Operator op;
Variant::Operator op = Variant::Operator::OP_ADD;
ENode *nodes[2];
ENode *nodes[2] = { nullptr, nullptr };
OperatorNode() {
type = TYPE_OPERATOR;
@ -184,8 +181,8 @@ class VisualScriptExpression : public VisualScriptNode {
};
struct IndexNode : public ENode {
ENode *base;
ENode *index;
ENode *base = nullptr;
ENode *index = nullptr;
IndexNode() {
type = TYPE_INDEX;
@ -193,7 +190,7 @@ class VisualScriptExpression : public VisualScriptNode {
};
struct NamedIndexNode : public ENode {
ENode *base;
ENode *base = nullptr;
StringName name;
NamedIndexNode() {
@ -202,7 +199,7 @@ class VisualScriptExpression : public VisualScriptNode {
};
struct ConstructorNode : public ENode {
Variant::Type data_type;
Variant::Type data_type = Variant::Type::NIL;
Vector<ENode *> arguments;
ConstructorNode() {
@ -211,7 +208,7 @@ class VisualScriptExpression : public VisualScriptNode {
};
struct CallNode : public ENode {
ENode *base;
ENode *base = nullptr;
StringName method;
Vector<ENode *> arguments;
@ -235,7 +232,7 @@ class VisualScriptExpression : public VisualScriptNode {
};
struct BuiltinFuncNode : public ENode {
VisualScriptBuiltinFunc::BuiltinFunc func;
VisualScriptBuiltinFunc::BuiltinFunc func = VisualScriptBuiltinFunc::BuiltinFunc::BYTES_TO_VAR;
Vector<ENode *> arguments;
BuiltinFuncNode() {
type = TYPE_BUILTIN_FUNC;
@ -250,8 +247,8 @@ class VisualScriptExpression : public VisualScriptNode {
return node;
}
ENode *root;
ENode *nodes;
ENode *root = nullptr;
ENode *nodes = nullptr;
protected:
bool _set(const StringName &p_name, const Variant &p_value);

View file

@ -182,16 +182,9 @@ bool WebRTCDataChannelJS::is_negotiated() const {
}
WebRTCDataChannelJS::WebRTCDataChannelJS() {
queue_count = 0;
_was_string = false;
_write_mode = WRITE_MODE_BINARY;
_js_id = 0;
}
WebRTCDataChannelJS::WebRTCDataChannelJS(int js_id) {
queue_count = 0;
_was_string = false;
_write_mode = WRITE_MODE_BINARY;
_js_id = js_id;
godot_js_rtc_datachannel_connect(js_id, this, &_on_open, &_on_message, &_on_error, &_on_close);

View file

@ -42,16 +42,16 @@ private:
String _label;
String _protocol;
bool _was_string;
WriteMode _write_mode;
bool _was_string = false;
WriteMode _write_mode = WRITE_MODE_BINARY;
enum {
PACKET_BUFFER_SIZE = 65536 - 5 // 4 bytes for the size, 1 for for type
};
int _js_id;
int _js_id = 0;
RingBuffer<uint8_t> in_buffer;
int queue_count;
int queue_count = 0;
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
static void _on_open(void *p_obj);

View file

@ -140,11 +140,7 @@ Error EMWSClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffe
}
EMWSClient::EMWSClient() {
_in_buf_size = DEF_BUF_SHIFT;
_in_pkt_size = DEF_PKT_SHIFT;
_is_connecting = false;
_peer = Ref<EMWSPeer>(memnew(EMWSPeer));
_js_id = 0;
}
EMWSClient::~EMWSClient() {

View file

@ -41,10 +41,10 @@ class EMWSClient : public WebSocketClient {
GDCIIMPL(EMWSClient, WebSocketClient);
private:
int _js_id;
bool _is_connecting;
int _in_buf_size;
int _in_pkt_size;
int _js_id = 0;
bool _is_connecting = false;
int _in_buf_size = DEF_BUF_SHIFT;
int _in_pkt_size = DEF_PKT_SHIFT;
static void _esws_on_connect(void *obj, char *proto);
static void _esws_on_message(void *obj, const uint8_t *p_data, int p_data_size, int p_is_string);

View file

@ -106,8 +106,6 @@ void EMWSPeer::set_no_delay(bool p_enabled) {
}
EMWSPeer::EMWSPeer() {
peer_sock = -1;
write_mode = WRITE_MODE_BINARY;
close();
};

View file

@ -56,12 +56,12 @@ class EMWSPeer : public WebSocketPeer {
GDCIIMPL(EMWSPeer, WebSocketPeer);
private:
int peer_sock;
WriteMode write_mode;
int peer_sock = -1;
WriteMode write_mode = WRITE_MODE_BINARY;
Vector<uint8_t> _packet_buffer;
PacketBuffer<uint8_t> _in_buffer;
uint8_t _is_string;
uint8_t _is_string = 0;
public:
Error read_msg(const uint8_t *p_data, uint32_t p_size, bool p_is_string);

View file

@ -33,7 +33,6 @@
GDCINULL(WebSocketClient);
WebSocketClient::WebSocketClient() {
verify_ssl = true;
}
WebSocketClient::~WebSocketClient() {

View file

@ -42,7 +42,7 @@ class WebSocketClient : public WebSocketMultiplayerPeer {
protected:
Ref<WebSocketPeer> _peer;
bool verify_ssl;
bool verify_ssl = true;
Ref<X509Certificate> ssl_cert;
static void _bind_methods();

View file

@ -33,15 +33,6 @@
#include "core/os/os.h"
WebSocketMultiplayerPeer::WebSocketMultiplayerPeer() {
_is_multiplayer = false;
_peer_id = 0;
_target_peer = 0;
_refusing = false;
_current_packet.source = 0;
_current_packet.destination = 0;
_current_packet.size = 0;
_current_packet.data = nullptr;
}
WebSocketMultiplayerPeer::~WebSocketMultiplayerPeer() {

View file

@ -55,20 +55,20 @@ protected:
};
struct Packet {
int source;
int destination;
uint8_t *data;
uint32_t size;
int source = 0;
int destination = 0;
uint8_t *data = nullptr;
uint32_t size = 0;
};
List<Packet> _incoming_packets;
Map<int, Ref<WebSocketPeer>> _peer_map;
Packet _current_packet;
bool _is_multiplayer;
int _target_peer;
int _peer_id;
int _refusing;
bool _is_multiplayer = false;
int _target_peer = 0;
int _peer_id = 0;
int _refusing = false;
static void _bind_methods();

View file

@ -337,11 +337,6 @@ Error WSLClient::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer
}
WSLClient::WSLClient() {
_in_buf_size = DEF_BUF_SHIFT;
_in_pkt_size = DEF_PKT_SHIFT;
_out_buf_size = DEF_BUF_SHIFT;
_out_pkt_size = DEF_PKT_SHIFT;
_peer.instance();
_tcp.instance();
disconnect_from_host();

View file

@ -44,27 +44,27 @@ class WSLClient : public WebSocketClient {
GDCIIMPL(WSLClient, WebSocketClient);
private:
int _in_buf_size;
int _in_pkt_size;
int _out_buf_size;
int _out_pkt_size;
int _in_buf_size = DEF_BUF_SHIFT;
int _in_pkt_size = DEF_PKT_SHIFT;
int _out_buf_size = DEF_BUF_SHIFT;
int _out_pkt_size = DEF_PKT_SHIFT;
Ref<WSLPeer> _peer;
Ref<StreamPeerTCP> _tcp;
Ref<StreamPeer> _connection;
CharString _request;
int _requested;
int _requested = 0;
uint8_t _resp_buf[WSL_MAX_HEADER_SIZE];
int _resp_pos;
int _resp_pos = 0;
String _response;
String _key;
String _host;
Vector<String> _protocols;
bool _use_ssl;
bool _use_ssl = false;
void _do_handshake();
bool _verify_headers(String &r_protocol);

View file

@ -329,10 +329,6 @@ void WSLPeer::invalidate() {
}
WSLPeer::WSLPeer() {
_data = nullptr;
_is_string = 0;
close_code = -1;
write_mode = WRITE_MODE_BINARY;
}
WSLPeer::~WSLPeer() {

View file

@ -48,29 +48,17 @@ class WSLPeer : public WebSocketPeer {
public:
struct PeerData {
bool polling;
bool destroy;
bool valid;
bool is_server;
bool closing;
void *obj;
void *peer;
bool polling = false;
bool destroy = false;
bool valid = false;
bool is_server = false;
bool closing = false;
void *obj = nullptr;
void *peer = nullptr;
Ref<StreamPeer> conn;
Ref<StreamPeerTCP> tcp;
int id;
wslay_event_context_ptr ctx;
PeerData() {
polling = false;
destroy = false;
valid = false;
is_server = false;
id = 1;
ctx = nullptr;
obj = nullptr;
closing = false;
peer = nullptr;
}
int id = 1;
wslay_event_context_ptr ctx = nullptr;
};
static String compute_key_response(String p_key);
@ -80,17 +68,17 @@ private:
static bool _wsl_poll(struct PeerData *p_data);
static void _wsl_destroy(struct PeerData **p_data);
struct PeerData *_data;
uint8_t _is_string;
struct PeerData *_data = nullptr;
uint8_t _is_string = 0;
// Our packet info is just a boolean (is_string), using uint8_t for it.
PacketBuffer<uint8_t> _in_buffer;
Vector<uint8_t> _packet_buffer;
WriteMode write_mode;
WriteMode write_mode = WRITE_MODE_BINARY;
public:
int close_code;
int close_code = -1;
String close_reason;
void poll(); // Used by client and server.

View file

@ -34,15 +34,6 @@
#include "core/config/project_settings.h"
#include "core/os/os.h"
WSLServer::PendingPeer::PendingPeer() {
use_ssl = false;
time = 0;
has_request = false;
response_sent = 0;
req_pos = 0;
memset(req_buf, 0, sizeof(req_buf));
}
bool WSLServer::PendingPeer::_parse_request(const Vector<String> p_protocols) {
Vector<String> psa = String((char *)req_buf).split("\r\n");
int len = psa.size();
@ -310,10 +301,6 @@ Error WSLServer::set_buffers(int p_in_buffer, int p_in_packets, int p_out_buffer
}
WSLServer::WSLServer() {
_in_buf_size = DEF_BUF_SHIFT;
_in_pkt_size = DEF_PKT_SHIFT;
_out_buf_size = DEF_BUF_SHIFT;
_out_pkt_size = DEF_PKT_SHIFT;
_server.instance();
}

View file

@ -53,26 +53,24 @@ private:
public:
Ref<StreamPeerTCP> tcp;
Ref<StreamPeer> connection;
bool use_ssl;
bool use_ssl = false;
int time;
uint8_t req_buf[WSL_MAX_HEADER_SIZE];
int req_pos;
int time = 0;
uint8_t req_buf[WSL_MAX_HEADER_SIZE] = {};
int req_pos = 0;
String key;
String protocol;
bool has_request;
bool has_request = false;
CharString response;
int response_sent;
PendingPeer();
int response_sent = 0;
Error do_handshake(const Vector<String> p_protocols);
};
int _in_buf_size;
int _in_pkt_size;
int _out_buf_size;
int _out_pkt_size;
int _in_buf_size = DEF_BUF_SHIFT;
int _in_pkt_size = DEF_PKT_SHIFT;
int _out_buf_size = DEF_BUF_SHIFT;
int _out_pkt_size = DEF_PKT_SHIFT;
List<Ref<PendingPeer>> _pending;
Ref<TCP_Server> _server;

View file

@ -163,8 +163,8 @@ bool xatlas_mesh_lightmap_unwrap_callback(float p_texel_size, const float *p_ver
*r_uvs = (float *)malloc(sizeof(float) * output.vertexCount * 2);
*r_indices = (int *)malloc(sizeof(int) * output.indexCount);
float max_x = 0;
float max_y = 0;
float max_x = 0.0;
float max_y = 0.0;
for (uint32_t i = 0; i < output.vertexCount; i++) {
(*r_vertices)[i] = output.vertexArray[i].xref;
(*r_uvs)[i * 2 + 0] = output.vertexArray[i].uv[0] / w;