81 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			81 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| note
 | |
| 	description: "[
 | |
| 		Describes this particular port
 | |
| 		]"
 | |
| 	author: "Jimmy J. Johnson"
 | |
| 
 | |
| class
 | |
| 	AUSTRALIA
 | |
| 
 | |
| inherit
 | |
| 
 | |
| 	REPAIR_PORT
 | |
| 		undefine
 | |
| 			distance_to
 | |
| 		redefine
 | |
| 			make
 | |
| 		end
 | |
| 
 | |
| 	RED_PORT
 | |
| 		redefine
 | |
| 			make,
 | |
| 			distance_to
 | |
| 		end
 | |
| 
 | |
| create
 | |
| 	make
 | |
| 
 | |
| feature {NONE} -- Initialization
 | |
| 
 | |
| 	make (a_game: like game)
 | |
| 			-- Set up Current
 | |
| 		do
 | |
| 			Precursor {REPAIR_PORT} (a_game)
 | |
| 			Precursor {RED_PORT} (a_game)
 | |
| 			nationality := {NATIONALITY_CONSTANTS}.us
 | |
| 			defining_position := [300, 470]
 | |
| 		end
 | |
| 
 | |
| feature -- Access
 | |
| 
 | |
| 	name: STRING_8 = "Australia"
 | |
| 			-- This name of this item.
 | |
| 
 | |
| 	defining_position: TUPLE [x, y: INTEGER_32]
 | |
| 			-- The x- and y-coordinate (in millimeters) of Current's
 | |
| 			-- position relative to the top-left corner of the board.
 | |
| 
 | |
| 	repair_points: INTEGER
 | |
| 			-- Number of repair points
 | |
| 		do
 | |
| 			if is_allied then
 | |
| 				Result := 1
 | |
| 			end
 | |
| 		end
 | |
| 
 | |
| 	adjacent_sea_areas: LINEAR [SEA_AREA]
 | |
| 			-- A list of all sea areas that touch this location
 | |
| 		local
 | |
| 			s: LINKED_SET [SEA_AREA]
 | |
| 		once
 | |
| 			create s.make
 | |
| 			s.extend (game.coral_sea)
 | |
| 			s.extend (game.indian_ocean)
 | |
| 			Result := s.linear_representation
 | |
| 		end
 | |
| 
 | |
| 	distance_to (other: LOCATION): INTEGER
 | |
| 			-- The distance between Current and `other'
 | |
| 		do
 | |
| 			io.put_string (generating_type.name + ".distance_to:  fix me %N")
 | |
| --			if game.phase = game.movement_phase then
 | |
| --				if other = game.indian_ocean or other = game.coral_sea then
 | |
| --					Result := 1
 | |
| --				end
 | |
| --			else
 | |
| --				Result := Precursor {RED_PORT} (other)
 | |
| --			end
 | |
| 		end
 | |
| 
 | |
| end
 | 
