note
	description: "[
		One of the classes that decomposes the numourous VITP widgets 
		into more managable groups.  This class models the widgets
		that contain the Allied starting-forces units (i.e. the
		Allied units that appear on turn 1).
		]"
	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
	ALLIED_STARTING_FORCES_WORLD

inherit

	WIDGET_FACTORY
		redefine
			make_widgets,
			widgets,
			extend_widgets,
			pair_widgets,
			fill_widgets
		end

create
	make

create {ALLIED_STARTING_FORCES_WORLD}
	list_make

feature {NONE} -- Initialization

	make_widgets
			-- Create widgets for the corresponding game item
		do
				-- Turn 1, on battleship row (Pearl Harbor)
			create nevada_widget.make (game.nevada)
			create arizona_widget.make (game.arizona)
			create west_virginia_widget.make (game.west_virginia)
			create tennessee_widget.make (game.tennessee)
			create oklahoma_widget.make (game.oklahoma)
			create maryland_widget.make (game.maryland)
			create california_widget.make (game.california)
			create pennsylvania_widget.make (game.pennsylvania)
			create new_orleans_widget.make (game.new_orleans)
			create san_francisco_widget.make (game.san_francisco)
			create seventh_af_widget.make (game.seventh_af)
				-- Turn 1, at sea (cannot move)
			create hermes_widget.make (game.hermes)
			create revenge_widget.make (game.revenge)
			create prince_of_wales_widget.make (game.prince_of_wales)
			create repulse_widget.make (game.repulse)
			create fifth_af_widget.make (game.fifth_af)
			create louisville_widget.make (game.louisville)
			create pensacola_widget.make (game.pensacola)
			create indianapolis_widget.make (game.indianapolis)
			create minneapolis_widget.make (game.minneapolis)
				-- Turn 1, in port (may move)
			create houston_widget.make (game.houston)
			create exeter_widget.make (game.exeter)
			create de_ruyter_widget.make (game.de_ruyter)
			create australia_ship_widget.make (game.australia_ship)
			create canberra_widget.make (game.canberra)
				-- Turn 1, Location uncertain (group W)
			create enterprise_widget.make (game.enterprise)
			create salt_lake_city_widget.make (game.salt_lake_city)
			create northampton_widget.make (game.northampton)
			create chester_widget.make (game.chester)
				-- Turn 1, Location uncertain (group X)
			create lexington_widget.make (game.lexington)
			create chicago_widget.make (game.chicago)
			create portland_widget.make (game.portland)
			create astoria_widget.make (game.astoria)
				-- Turn 1, Location uncertain (group Y)
			create saratoga_widget.make (game.saratoga)
				-- Turn 1, Location uncertain (group Z)
			create hornet_widget.make (game.hornet)
			create yorktown_widget.make (game.yorktown)
			create vincennes_widget.make (game.vincennes)
			create quincy_widget.make (game.quincy)
		end

feature -- Access (tables)

	widgets: VITP_WIDGET_TABLE [ATTACK_UNIT_WIDGET, ATTACK_UNIT]
			-- Keeps track of widgets

feature -- Access (allied starting forces widgets)

		-- On Battleship Row (Pearl Harbor)
	nevada_widget: SHIP_WIDGET
	arizona_widget: SHIP_WIDGET
	west_virginia_widget: SHIP_WIDGET
	tennessee_widget: SHIP_WIDGET
	oklahoma_widget: SHIP_WIDGET
	maryland_widget: SHIP_WIDGET
	california_widget: SHIP_WIDGET
	pennsylvania_widget: SHIP_WIDGET
	new_orleans_widget: SHIP_WIDGET
	san_francisco_widget: SHIP_WIDGET
	seventh_af_widget: ALLIED_AIR_UNIT_WIDGET
		-- At sea (cannot move)
	hermes_widget: SHIP_WIDGET
	revenge_widget: SHIP_WIDGET
	prince_of_wales_widget: SHIP_WIDGET
	repulse_widget: SHIP_WIDGET
	fifth_af_widget: ALLIED_AIR_UNIT_WIDGET
	louisville_widget: SHIP_WIDGET
	pensacola_widget: SHIP_WIDGET
	indianapolis_widget: SHIP_WIDGET
	minneapolis_widget: SHIP_WIDGET
		-- In port (may move)
	houston_widget: SHIP_WIDGET
	exeter_widget: SHIP_WIDGET
	de_ruyter_widget: SHIP_WIDGET
	australia_ship_widget: SHIP_WIDGET
	canberra_widget: SHIP_WIDGET
		-- Location Uncertain, group W
	enterprise_widget: SHIP_WIDGET
	salt_lake_city_widget: SHIP_WIDGET
	northampton_widget: SHIP_WIDGET
	chester_widget: SHIP_WIDGET
		-- Location Uncertain, group X
	lexington_widget: SHIP_WIDGET
	chicago_widget: SHIP_WIDGET
	portland_widget: SHIP_WIDGET
	astoria_widget: SHIP_WIDGET
		-- Location Uncertain, group Y
	saratoga_widget: SHIP_WIDGET
		-- Location Uncertain, group W
	hornet_widget: SHIP_WIDGET
	yorktown_widget: SHIP_WIDGET
	vincennes_widget: SHIP_WIDGET
	quincy_widget: SHIP_WIDGET

feature {NONE} -- Implementation

	extend_widgets
			-- Put each widget {ATTACK_UNIT_WIDGET} into `world'.
		do
				-- On Battleship Row (Pearl Harbor)
			extend (nevada_widget)
			extend (arizona_widget)
			extend (west_virginia_widget)
			extend (tennessee_widget)
			extend (oklahoma_widget)
			extend (maryland_widget)
			extend (california_widget)
			extend (pennsylvania_widget)
			extend (new_orleans_widget)
			extend (san_francisco_widget)
			extend (seventh_af_widget)
				-- At sea (cannot move)
			extend (hermes_widget)
			extend (revenge_widget)
			extend (prince_of_wales_widget)
			extend (repulse_widget)
			extend (fifth_af_widget)
			extend (louisville_widget)
			extend (pensacola_widget)
			extend (indianapolis_widget)
			extend (minneapolis_widget)
				-- In port (may move)
			extend (houston_widget)
			extend (exeter_widget)
			extend (de_ruyter_widget)
			extend (australia_ship_widget)
			extend (canberra_widget)
				-- Location Uncertain, group W
			extend (enterprise_widget)
			extend (salt_lake_city_widget)
			extend (northampton_widget)
			extend (chester_widget)
				-- Location Uncertain, group X
			extend (lexington_widget)
			extend (chicago_widget)
			extend (portland_widget)
			extend (astoria_widget)
				-- Location Uncertain, group Y
			extend (saratoga_widget)
				-- Location Uncertain, group W
			extend (hornet_widget)
			extend (yorktown_widget)
			extend (vincennes_widget)
			extend (quincy_widget)
		end

	pair_widgets
			-- Associate each widget with a unit
		do
				-- On Battleship Row (Pearl Harbor)
			widgets.force (nevada_widget, game.nevada)
			widgets.force (arizona_widget, game.arizona)
			widgets.force (west_virginia_widget, game.west_virginia)
			widgets.force (tennessee_widget, game.tennessee)
			widgets.force (oklahoma_widget, game.oklahoma)
			widgets.force (maryland_widget, game.maryland)
			widgets.force (california_widget, game.california)
			widgets.force (pennsylvania_widget, game.pennsylvania)
			widgets.force (new_orleans_widget, game.new_orleans)
			widgets.force (san_francisco_widget, game.san_francisco)
			widgets.force (seventh_af_widget, game.seventh_af)
				-- At sea (cannot move)
			widgets.force (hermes_widget, game.hermes)
			widgets.force (revenge_widget, game.revenge)
			widgets.force (prince_of_wales_widget, game.prince_of_wales)
			widgets.force (repulse_widget, game.repulse)
			widgets.force (fifth_af_widget, game.fifth_af)
			widgets.force (louisville_widget, game.louisville)
			widgets.force (pensacola_widget, game.pensacola)
			widgets.force (indianapolis_widget, game.indianapolis)
			widgets.force (minneapolis_widget, game.minneapolis)
				-- In port (may move)
			widgets.force (houston_widget, game.houston)
			widgets.force (exeter_widget, game.exeter)
			widgets.force (de_ruyter_widget, game.de_ruyter)
			widgets.force (australia_ship_widget, game.australia_ship)
			widgets.force (canberra_widget, game.canberra)
				-- Location Uncertain, group W
			widgets.force (enterprise_widget, game.enterprise)
			widgets.force (salt_lake_city_widget, game.salt_lake_city)
			widgets.force (northampton_widget, game.northampton)
			widgets.force (chester_widget, game.chester)
				-- Location Uncertain, group X
			widgets.force (lexington_widget, game.lexington)
			widgets.force (chicago_widget, game.chicago)
			widgets.force (portland_widget, game.portland)
			widgets.force (astoria_widget, game.astoria)
				-- Location Uncertain, group Y
			widgets.force (saratoga_widget, game.saratoga)
				-- Location Uncertain (group Z
			widgets.force (hornet_widget, game.hornet)
			widgets.force (yorktown_widget, game.yorktown)
			widgets.force (vincennes_widget, game.vincennes)
			widgets.force (quincy_widget, game.quincy)
		end

	fill_widgets
			-- Call `set_target' to give each widget a target.
		do
				-- On Battleship Row (Pearl Harbor)
			nevada_widget.set_target (game.nevada)
			arizona_widget.set_target (game.arizona)
			west_virginia_widget.set_target (game.west_virginia)
			tennessee_widget.set_target (game.tennessee)
			oklahoma_widget.set_target (game.oklahoma)
			maryland_widget.set_target (game.maryland)
			california_widget.set_target (game.california)
			pennsylvania_widget.set_target (game.pennsylvania)
			new_orleans_widget.set_target (game.new_orleans)
			san_francisco_widget.set_target (game.san_francisco)
			seventh_af_widget.set_target (game.seventh_af)
				-- At sea (cannot move)
			hermes_widget.set_target (game.hermes)
			revenge_widget.set_target (game.revenge)
			prince_of_wales_widget.set_target (game.prince_of_wales)
			repulse_widget.set_target (game.repulse)
			fifth_af_widget.set_target (game.fifth_af)
			louisville_widget.set_target (game.louisville)
			pensacola_widget.set_target (game.pensacola)
			indianapolis_widget.set_target (game.indianapolis)
			minneapolis_widget.set_target (game.minneapolis)
				-- In port (may move)
			houston_widget.set_target (game.houston)
			exeter_widget.set_target (game.exeter)
			de_ruyter_widget.set_target (game.de_ruyter)
			australia_ship_widget.set_target (game.australia_ship)
			canberra_widget.set_target (game.canberra)
				-- Location Uncertain, group W
			enterprise_widget.set_target (game.enterprise)
			salt_lake_city_widget.set_target (game.salt_lake_city)
			northampton_widget.set_target (game.northampton)
			chester_widget.set_target (game.chester)
				-- Location Uncertain, group X
			lexington_widget.set_target (game.lexington)
			chicago_widget.set_target (game.chicago)
			portland_widget.set_target (game.portland)
			astoria_widget.set_target (game.astoria)
				-- Location Uncertain, group Y
			saratoga_widget.set_target (game.saratoga)
				-- Location Uncertain, group W
			hornet_widget.set_target (game.hornet)
			yorktown_widget.set_target (game.yorktown)
			vincennes_widget.set_target (game.vincennes)
			quincy_widget.set_target (game.quincy)
		end

end
