note description: "[ One of the classes that decompose the numourous VITP widgets into more managable groups. This class models the widgets that contain the attack units. ]" author: "Jimmy J. Johnson" date: "5/15/24" copyright: "Copyright (c) 2024, Jimmy J. Johnson" license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)" class ATTACK_WIDGETS_FACTORY inherit JAPANESE_FORCES_FACTORY redefine make_widgets, extend_widgets, pair_widgets, fill_widgets end ALLIED_FORCES_WIDGET_FACTORY redefine make_widgets, extend_widgets, pair_widgets, fill_widgets end create make feature -- Initialization make_widgets -- Create the widgets in Current do print ("ATTACK_WIDGET_FACTORY.make_widgets %N") create attack_widgets.make (100) Precursor {JAPANESE_FORCES_FACTORY} print ("ATTACK_WIDGET_FACTORY.make_widgets after first Precuror call%N") Precursor {ALLIED_FORCES_WIDGET_FACTORY} print ("%T end ATTACK_WIDGET_FACTORY.make_widgets %N") end feature -- Access attack_widgets: VITP_WIDGET_TABLE [ATTACK_UNIT_WIDGET, ATTACK_UNIT] -- Keeps track of widgets feature {NONE} -- Implementation extend_widgets -- Put each widget into `world'. do -- The first two line `merge' into `widgets' Precursor {JAPANESE_FORCES_FACTORY} Precursor {ALLIED_FORCES_WIDGET_FACTORY} -- But also need to merge into `attack_widges' attack_widgets.merge (japanese_forces_widgets) attack_widgets.merge (allied_forces_widgets) end pair_widgets -- Associate each widget with a unit do Precursor {JAPANESE_FORCES_FACTORY} Precursor {ALLIED_FORCES_WIDGET_FACTORY} end fill_widgets -- Call `set_target' to give each widget a target. do Precursor {JAPANESE_FORCES_FACTORY} Precursor {ALLIED_FORCES_WIDGET_FACTORY} end end