diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-12 14:24:06 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2020-02-12 14:24:54 -0300 |
commit | cf8c679a23b21d6c6f29cba6a54eaa2eed88bf92 (patch) | |
tree | 52aca947b395362b2addec4843915b15947c32ca /scene/2d | |
parent | 4aa31a2851e3dd5b67193194f899850239b2669d (diff) |
ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits.
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/area_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/area_2d.h | 4 | ||||
-rw-r--r-- | scene/2d/camera_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/canvas_item.cpp | 2 | ||||
-rw-r--r-- | scene/2d/collision_object_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/polygon_2d.cpp | 4 | ||||
-rw-r--r-- | scene/2d/ray_cast_2d.cpp | 6 | ||||
-rw-r--r-- | scene/2d/remote_transform_2d.cpp | 7 |
9 files changed, 19 insertions, 20 deletions
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index 8302ba5336..b661db2e52 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -148,7 +148,7 @@ void Area2D::_body_exit_tree(ObjectID p_id) { } } -void Area2D::_body_inout(int p_status, const RID &p_body, int p_instance, int p_body_shape, int p_area_shape) { +void Area2D::_body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape) { bool body_in = p_status == Physics2DServer::AREA_BODY_ADDED; ObjectID objid = p_instance; @@ -251,7 +251,7 @@ void Area2D::_area_exit_tree(ObjectID p_id) { } } -void Area2D::_area_inout(int p_status, const RID &p_area, int p_instance, int p_area_shape, int p_self_shape) { +void Area2D::_area_inout(int p_status, const RID &p_area, ObjectID p_instance, int p_area_shape, int p_self_shape) { bool area_in = p_status == Physics2DServer::AREA_BODY_ADDED; ObjectID objid = p_instance; diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h index 6d9386c535..c5e6635412 100644 --- a/scene/2d/area_2d.h +++ b/scene/2d/area_2d.h @@ -62,7 +62,7 @@ private: bool monitorable; bool locked; - void _body_inout(int p_status, const RID &p_body, int p_instance, int p_body_shape, int p_area_shape); + void _body_inout(int p_status, const RID &p_body, ObjectID p_instance, int p_body_shape, int p_area_shape); void _body_enter_tree(ObjectID p_id); void _body_exit_tree(ObjectID p_id); @@ -94,7 +94,7 @@ private: Map<ObjectID, BodyState> body_map; - void _area_inout(int p_status, const RID &p_area, int p_instance, int p_area_shape, int p_self_shape); + void _area_inout(int p_status, const RID &p_area, ObjectID p_instance, int p_area_shape, int p_self_shape); void _area_enter_tree(ObjectID p_id); void _area_exit_tree(ObjectID p_id); diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index e9f8c5dff2..7ec770597e 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -608,7 +608,7 @@ void Camera2D::set_custom_viewport(Node *p_viewport) { if (custom_viewport) { custom_viewport_id = custom_viewport->get_instance_id(); } else { - custom_viewport_id = 0; + custom_viewport_id = ObjectID(); } if (is_inside_tree()) { @@ -795,7 +795,7 @@ Camera2D::Camera2D() { smoothing_enabled = false; limit_smoothing_enabled = false; custom_viewport = NULL; - custom_viewport_id = 0; + process_mode = CAMERA2D_PROCESS_IDLE; smoothing = 5.0; diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index eff58a4fb3..aca0c4c959 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -997,7 +997,7 @@ ObjectID CanvasItem::get_canvas_layer_instance_id() const { if (canvas_layer) { return canvas_layer->get_instance_id(); } else { - return 0; + return ObjectID(); } } diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 3e9e63a7f0..4af2e846f7 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -95,9 +95,9 @@ void CollisionObject2D::_notification(int p_what) { case NOTIFICATION_EXIT_CANVAS: { if (area) - Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, 0); + Physics2DServer::get_singleton()->area_attach_canvas_instance_id(rid, ObjectID()); else - Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, 0); + Physics2DServer::get_singleton()->body_attach_canvas_instance_id(rid, ObjectID()); } break; } } diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index d42bd6adaf..d1fe5caf7e 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1544,7 +1544,7 @@ Object *KinematicCollision2D::get_local_shape() const { Object *KinematicCollision2D::get_collider() const { - if (collision.collider) { + if (collision.collider.is_valid()) { return ObjectDB::get_instance(collision.collider); } @@ -1608,7 +1608,7 @@ void KinematicCollision2D::_bind_methods() { } KinematicCollision2D::KinematicCollision2D() { - collision.collider = 0; + collision.collider_shape = 0; collision.local_shape = 0; owner = NULL; diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index dc953b2d7d..ba5b7d29e7 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -108,7 +108,7 @@ void Polygon2D::_notification(int p_what) { skeleton_node = Object::cast_to<Skeleton2D>(get_node(skeleton)); } - ObjectID new_skeleton_id = 0; + ObjectID new_skeleton_id; if (skeleton_node) { VS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), skeleton_node->get_skeleton()); @@ -734,7 +734,7 @@ Polygon2D::Polygon2D() { color = Color(1, 1, 1); rect_cache_dirty = true; internal_vertices = 0; - current_skeleton_id = 0; + specular_color = Color(1, 1, 1, 1); shininess = 1.0; } diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index 3252e02e38..fd6e0aebcc 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -78,7 +78,7 @@ bool RayCast2D::is_colliding() const { } Object *RayCast2D::get_collider() const { - if (against == 0) + if (against.is_null()) return NULL; return ObjectDB::get_instance(against); @@ -225,7 +225,7 @@ void RayCast2D::_update_raycast_state() { against_shape = rr.shape; } else { collided = false; - against = 0; + against = ObjectID(); against_shape = 0; } } @@ -339,7 +339,7 @@ void RayCast2D::_bind_methods() { RayCast2D::RayCast2D() { enabled = false; - against = 0; + collided = false; against_shape = 0; collision_mask = 1; diff --git a/scene/2d/remote_transform_2d.cpp b/scene/2d/remote_transform_2d.cpp index 53072f942d..ec50f5f922 100644 --- a/scene/2d/remote_transform_2d.cpp +++ b/scene/2d/remote_transform_2d.cpp @@ -33,7 +33,7 @@ void RemoteTransform2D::_update_cache() { - cache = 0; + cache = ObjectID(); if (has_node(remote_node)) { Node *node = get_node(remote_node); if (!node || this == node || node->is_a_parent_of(this) || this->is_a_parent_of(node)) { @@ -49,7 +49,7 @@ void RemoteTransform2D::_update_remote() { if (!is_inside_tree()) return; - if (!cache) + if (cache.is_null()) return; Node2D *n = Object::cast_to<Node2D>(ObjectDB::get_instance(cache)); @@ -119,7 +119,7 @@ void RemoteTransform2D::_notification(int p_what) { if (!is_inside_tree()) break; - if (cache) { + if (cache.is_valid()) { _update_remote(); } @@ -225,6 +225,5 @@ RemoteTransform2D::RemoteTransform2D() { update_remote_rotation = true; update_remote_scale = true; - cache = 0; set_notify_transform(true); } |