Change unit facing submenu for the scenario editor.
This commit is contained in:
parent
11a7b22381
commit
84baedf4d3
5 changed files with 35 additions and 3 deletions
|
@ -38,7 +38,7 @@
|
|||
[menu]
|
||||
id=menu-editor-paste-context
|
||||
is_context_menu=true
|
||||
items=editor-unit-toggle-loyal,editor-change-unitid,editor-unit-recruit,renameunit,describeunit,editor-deleteunit,editor-toggle-renameable,editor-toggle-canrecruit,editor-cut,editor-copy,editor-paste,editor-tool-select,editor-select-all,editor-select-inverse,editor-select-none,editor-clipboard-rotate-cw,editor-clipboard-rotate-ccw,editor-clipboard-flip-horizontal,editor-clipboard-flip-vertical,editor-selection-fill,editor-selection-rotate,editor-selection-flip, editor-selection-generate,editor-selection-randomize,editor-save-area
|
||||
items=menu-unit-facing,editor-unit-toggle-loyal,editor-change-unitid,editor-unit-recruit,renameunit,describeunit,editor-deleteunit,editor-toggle-renameable,editor-toggle-canrecruit,editor-cut,editor-copy,editor-paste,editor-tool-select,editor-select-all,editor-select-inverse,editor-select-none,editor-clipboard-rotate-cw,editor-clipboard-rotate-ccw,editor-clipboard-flip-horizontal,editor-clipboard-flip-vertical,editor-selection-fill,editor-selection-rotate,editor-selection-flip, editor-selection-generate,editor-selection-randomize,editor-save-area
|
||||
[/menu]
|
||||
|
||||
####### Menu Bar
|
||||
|
@ -88,6 +88,12 @@
|
|||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
[/menu]
|
||||
[menu]
|
||||
title= _ "Unit Facing"
|
||||
button=false
|
||||
id=menu-unit-facing
|
||||
items=menu-unit-facings
|
||||
[/menu]
|
||||
[menu]
|
||||
title= _ "Transition Update"
|
||||
button=false
|
||||
|
|
|
@ -256,6 +256,7 @@ bool editor_controller::can_execute_command(const hotkey::hotkey_command& cmd, i
|
|||
case editor::LOCAL_SCHEDULE:
|
||||
case editor::MUSIC:
|
||||
case editor::LOCAL_TIME:
|
||||
case editor::UNIT_FACING:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -299,6 +300,7 @@ bool editor_controller::can_execute_command(const hotkey::hotkey_command& cmd, i
|
|||
case HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE:
|
||||
case HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL:
|
||||
case HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN:
|
||||
case HOTKEY_EDITOR_UNIT_FACING:
|
||||
{
|
||||
map_location loc = gui_->mouseover_hex();
|
||||
const unit_map& units = context_manager_->get_map_context().get_units();
|
||||
|
@ -558,6 +560,13 @@ hotkey::ACTION_STATE editor_controller::get_action_state(hotkey::HOTKEY_COMMAND
|
|||
const std::vector<time_of_day>& times2 = context_manager_->get_map_context().get_time_manager()->times(active_area);
|
||||
return (times1 == times2) ? ACTION_SELECTED : ACTION_DESELECTED;
|
||||
}
|
||||
case editor::UNIT_FACING:
|
||||
{
|
||||
unit_map::const_unit_iterator un =
|
||||
resources::units->find(gui_->mouseover_hex());
|
||||
assert(un != resources::units->end());
|
||||
return un->facing() == index ? ACTION_SELECTED : ACTION_DESELECTED;
|
||||
}
|
||||
}
|
||||
return ACTION_ON;
|
||||
default:
|
||||
|
@ -643,6 +652,15 @@ bool editor_controller::execute_command(const hotkey::hotkey_command& cmd, int i
|
|||
context_manager_->get_map_context().replace_local_schedule(iter->second.second);
|
||||
return true;
|
||||
}
|
||||
case UNIT_FACING:
|
||||
{
|
||||
unit_map::unit_iterator un =
|
||||
resources::units->find(gui_->mouseover_hex());
|
||||
assert(un != resources::units->end());
|
||||
un->set_facing(map_location::DIRECTION(index));
|
||||
un->set_standing();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
|
@ -991,7 +1009,12 @@ void editor_controller::show_menu(const std::vector<std::string>& items_arg, int
|
|||
active_menu_ = editor::LOCAL_TIME;
|
||||
context_manager_->expand_local_time_menu(items);
|
||||
}
|
||||
|
||||
if (!items.empty() && items.front() == "menu-unit-facings") {
|
||||
active_menu_ = editor::UNIT_FACING;
|
||||
items.erase(items.begin());
|
||||
for (int dir = 0; dir != map_location::NDIRECTIONS; dir++)
|
||||
items.push_back(map_location::write_translated_direction(map_location::DIRECTION(dir)));
|
||||
}
|
||||
if (!items.empty() && items.front() == "editor-playlist") {
|
||||
active_menu_ = editor::MUSIC;
|
||||
items.erase(items.begin());
|
||||
|
|
|
@ -62,7 +62,8 @@ enum menu_type {
|
|||
LOCAL_TIME,
|
||||
SCHEDULE,
|
||||
LOCAL_SCHEDULE,
|
||||
MUSIC
|
||||
MUSIC,
|
||||
UNIT_FACING
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -163,6 +163,7 @@ hotkey::hotkey_command_temp hotkey_list_[] = {
|
|||
|
||||
{ hotkey::HOTKEY_EDITOR_UNIT_CHANGE_ID, "editor-change-unitid", N_("Change Unit ID"), false, hotkey::SCOPE_EDITOR, "" },
|
||||
{ hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, "editor-unit-toggle-loyal", N_("Loyal"), false, hotkey::SCOPE_EDITOR, "" },
|
||||
{ hotkey::HOTKEY_EDITOR_UNIT_FACING, "menu-unit-facing", "", true, hotkey::SCOPE_EDITOR, "" },
|
||||
|
||||
{ hotkey::HOTKEY_MINIMAP_CODING_UNIT, "minimap-unit-coding", N_("Toggle Minimap Unit Coding"), false, hotkey::SCOPE_GENERAL, "" },
|
||||
{ hotkey::HOTKEY_MINIMAP_CODING_TERRAIN, "minimap-terrain-coding", N_("Toggle Minimap Terrain Coding"), false, hotkey::SCOPE_GENERAL, "" },
|
||||
|
|
|
@ -110,6 +110,7 @@ enum HOTKEY_COMMAND {
|
|||
|
||||
HOTKEY_EDITOR_PLAYLIST,
|
||||
HOTKEY_EDITOR_LOCAL_TIME,
|
||||
HOTKEY_EDITOR_UNIT_FACING,
|
||||
|
||||
// Unit
|
||||
HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE,
|
||||
|
|
Loading…
Add table
Reference in a new issue