gel.world.rid: Complete rid sprite procedure.

This commit is contained in:
Rod Kay
2025-11-14 14:57:56 +11:00
parent a4f1406b4c
commit 519c388bbd

View File

@@ -760,6 +760,7 @@ is
the_Sprite.apply (add_single_Sprite'unrestricted_Access); the_Sprite.apply (add_single_Sprite'unrestricted_Access);
the_Sprite.apply (add_the_Joint 'unrestricted_Access); the_Sprite.apply (add_the_Joint 'unrestricted_Access);
end; end;
else else
add_single_Sprite (the_Sprite.all); add_single_Sprite (the_Sprite.all);
end if; end if;
@@ -773,9 +774,10 @@ is
procedure rid_single_Sprite (Single : in out Sprite.item'Class) procedure rid_single_Sprite (Single : in out Sprite.item'Class)
is is
begin begin
-- Self.Commands.add ((Kind => rid_Sprite, if Single.physics_Model.is_Tangible
-- Sprite => the_Sprite'unchecked_Access, then
-- rid_Children => False)); Self.physics_Space.rid (physics.Object.view (Single.Solid));
end if;
Self.all_Sprites.rid (Single'unchecked_Access); -- TODO: Handle grandchildren and so on. Self.all_Sprites.rid (Single'unchecked_Access); -- TODO: Handle grandchildren and so on.
end rid_single_Sprite; end rid_single_Sprite;
@@ -783,7 +785,22 @@ is
begin begin
if and_Children if and_Children
then then
declare
procedure rid_the_Joint (the_Sprite : in out Sprite.item'Class)
is
use type gel.Joint.view;
the_Joint : constant gel.Joint.view := the_Sprite.parent_Joint;
begin
if the_Joint /= null
then
Self.physics_Space.rid (the_Joint.Physics.all'Access);
end if;
end rid_the_Joint;
begin
the_Sprite.apply (rid_single_Sprite'unrestricted_Access); the_Sprite.apply (rid_single_Sprite'unrestricted_Access);
the_Sprite.apply (rid_the_Joint 'unrestricted_Access);
end;
else else
rid_single_Sprite (the_Sprite.all); rid_single_Sprite (the_Sprite.all);
end if; end if;