19928/jj_vitp/Interface/widgets/unit_widgets/ship_widget.e

75 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-06-17 07:09:33 +00:00
note
description: "[
A widget connecting interface to a SHIP for use in Victory
in the Pacific.
]"
author: "Jimmy J. Johnson"
class
SHIP_WIDGET
inherit
ATTACK_UNIT_WIDGET
rename
unit as ship
redefine
position_widgets,
add_actions,
target_imp
end
create
make
feature {NONE} -- Initialization
position_widgets
-- Move Current and contained widgets to correct
-- location and set their sizes
do
Precursor {ATTACK_UNIT_WIDGET}
picture.scale (0.1)
end
feature -- Status setting
set_raiding
-- Change status of this `ship' to `is_raiding'.
do
ship.set_raiding
draw_views (ship)
end
set_patrolling
-- Change the status of the `ship' to not `is_raiding'
do
ship.set_patrolling
draw_views (ship)
end
feature -- Basic operations
feature {NONE} -- Implementation
add_actions
-- Add agent (i.e. actions) to the ship widget
do
Precursor {ATTACK_UNIT_WIDGET}
-- set_pebble_function (agent on_get_pebble)
-- No, do not add action to flip raider here,
-- do it in the {BOARD_VIEW}
-- pointer_double_press_actions.force_extend (agent flip_tile)
end
target_imp: detachable SHIP
-- Anchor for the `target' represented by Current
invariant
-- is_flipped_implication: is_flipped implies ship.is_raiding
end