Skip to content

Commit

Permalink
Enabled the terrain description dialog in the editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
fendrin committed Jun 6, 2014
1 parent cc5c779 commit 6a2c1a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data/themes/editor.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
[menu]
id=menu-editor-paste-context
is_context_menu=true
items=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=describeterrain,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
Expand Down
16 changes: 14 additions & 2 deletions src/editor/editor_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,18 @@ bool editor_controller::can_execute_command(const hotkey::hotkey_command& cmd, i
case HOTKEY_STATUS_TABLE:
return !context_manager_->get_map_context().get_teams().empty();

case HOTKEY_TERRAIN_DESCRIPTION:
return gui().mouseover_hex().valid();

// unit tool related
case HOTKEY_UNIT_DESCRIPTION:
return toolkit_->is_mouse_action_set(HOTKEY_EDITOR_TOOL_UNIT);
case HOTKEY_DELETE_UNIT:
case HOTKEY_RENAME_UNIT:
case HOTKEY_EDITOR_UNIT_CHANGE_ID:
case HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT:
case HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE:
case HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL:
case HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN:
case HOTKEY_UNIT_DESCRIPTION:
{
map_location loc = gui_->mouseover_hex();
const unit_map& units = context_manager_->get_map_context().get_units();
Expand Down Expand Up @@ -1290,6 +1292,16 @@ void editor_controller::right_mouse_up(int x, int y, const bool /*browse*/)
context_manager_->refresh_after_action();
}

void editor_controller::terrain_description()
{
const map_location& loc = gui().mouseover_hex();
if (resources::game_map->on_board(loc) == false)
return;

const terrain_type& type = resources::game_map->get_terrain_info(loc);
dialogs::show_terrain_description(type);
}

void editor_controller::process_keyup_event(const SDL_Event& event)
{
editor_action* a = toolkit_->get_mouse_action()->key_event(gui(), event);
Expand Down
1 change: 1 addition & 0 deletions src/editor/editor_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class editor_controller : public controller_base,
/** Grid toggle */
void toggle_grid();

void terrain_description();
void unit_description();
void change_unit_id();
void rename_unit();
Expand Down

0 comments on commit 6a2c1a0

Please sign in to comment.