indexing description: "[ Removes an object. ]" date: "$Date$" revision: "$Revision$" class REMOVE_OBJECT inherit COMMAND create make feature -- Initialization make is -- creation procedure. do end feature {HISTORY} -- Access execute (args: TUPLE) is -- remove an object -- args.item (1) :: object_list: DS_LINKED_LIST [OBJECT] -- args.item (2) :: object: OBJECT -- Note: the object_list must actually be the list, in which the item is. -- e.g. `circles' for a CIRCLE object local i: INTEGER do execute_successful := False if args.count = 2 then object_list ?= args.item (1) object ?= args.item (2) if object_list /= Void and object /= Void then -- remove the item from the list i := object_list.count object_list.delete (object) if object_list.count < i then -- the object was delted execute_successful := True -- remove collidable from collision detector object.prepare_deletion end end end end undo (args: TUPLE) is -- Undo command require else object_list_not_void: object_list /= Void object_not_void: object /= Void do -- create object again object.set_changed object.recreate_collidable object.add_collidable_to_scene object_list.force_last (object) execute_successful := False undo_successful := True redo_successful := False end redo (args: TUPLE) is -- Redo command require else object_list_not_void: object_list /= Void object_not_void: object /= Void do object.prepare_deletion object_list.delete (object) execute_successful := False undo_successful := False redo_successful := True end name: STRING is "remove object" -- The name of the current command feature -- Implementation object_list: DS_LINKED_LIST [OBJECT] -- reference to `objects' object: OBJECT -- reference to the object end