Whiteboard: delete latest defined action with 'h' key.
(Choice of hotkeys is temporary.) Also, renamed a method.
This commit is contained in:
parent
8b2463d21a
commit
16efa6f710
10 changed files with 31 additions and 3 deletions
|
@ -257,5 +257,9 @@
|
|||
command=executenextaction
|
||||
key=y
|
||||
[/hotkey]
|
||||
[hotkey]
|
||||
command=deletelastaction
|
||||
key=h
|
||||
[/hotkey]
|
||||
|
||||
#undef IF_APPLE_CMD_ELSE_CTRL
|
||||
|
|
|
@ -102,6 +102,7 @@ const struct {
|
|||
{ hotkey::HOTKEY_REPLAY_SKIP_ANIMATION, "replayskipanimation", N_("Skip animation"), false, hotkey::SCOPE_GAME },
|
||||
// Whiteboard commands
|
||||
{ hotkey::HOTKEY_EXECUTE_NEXT_ACTION, "executenextaction", N_("Execute next planned action"), false, hotkey::SCOPE_GAME },
|
||||
{ hotkey::HOTKEY_DELETE_LAST_ACTION, "deletelastaction", N_("Delete last planned action"), false, hotkey::SCOPE_GAME },
|
||||
|
||||
#ifndef DISABLE_EDITOR
|
||||
{ hotkey::HOTKEY_EDITOR_QUIT_TO_DESKTOP, "editor-quit-to-desktop", N_("Quit to Desktop"), false, hotkey::SCOPE_EDITOR },
|
||||
|
@ -861,6 +862,9 @@ bool command_executor::execute_command(HOTKEY_COMMAND command, int /*index*/)
|
|||
case HOTKEY_EXECUTE_NEXT_ACTION:
|
||||
execute_next_action();
|
||||
break;
|
||||
case HOTKEY_DELETE_LAST_ACTION:
|
||||
delete_last_action();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ enum HOTKEY_COMMAND {
|
|||
|
||||
// Whiteboard commands
|
||||
HOTKEY_EXECUTE_NEXT_ACTION,
|
||||
HOTKEY_DELETE_LAST_ACTION,
|
||||
|
||||
#ifndef DISABLE_EDITOR
|
||||
HOTKEY_EDITOR_QUIT_TO_DESKTOP,
|
||||
|
@ -300,6 +301,7 @@ public:
|
|||
virtual void replay_show_team1() {}
|
||||
virtual void replay_skip_animation() {}
|
||||
virtual void execute_next_action() {}
|
||||
virtual void delete_last_action() {}
|
||||
|
||||
//Gets the action's image (if any). Displayed left of the action text in menus.
|
||||
virtual std::string get_action_image(hotkey::HOTKEY_COMMAND /*command*/, int /*index*/) const { return ""; }
|
||||
|
|
|
@ -451,6 +451,10 @@ void play_controller::execute_next_action(){
|
|||
whiteboard_manager_->execute_next();
|
||||
}
|
||||
|
||||
void play_controller::delete_last_action(){
|
||||
whiteboard_manager_->delete_last();
|
||||
}
|
||||
|
||||
void play_controller::fire_prestart(bool execute){
|
||||
// Run initialization scripts, even if loading from a snapshot.
|
||||
game_events::fire("preload");
|
||||
|
@ -775,6 +779,7 @@ bool play_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int in
|
|||
teams_[menu_handler_.current_unit(mouse_handler_)->side() - 1].is_human();
|
||||
|
||||
case hotkey::HOTKEY_EXECUTE_NEXT_ACTION:
|
||||
case hotkey::HOTKEY_DELETE_LAST_ACTION:
|
||||
return resources::whiteboard->active();
|
||||
|
||||
default:
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
virtual void toggle_grid();
|
||||
virtual void search();
|
||||
virtual void execute_next_action(); //part of whiteboard
|
||||
virtual void delete_last_action(); //part of whiteboard
|
||||
|
||||
virtual void do_init_side(const unsigned int team_index);
|
||||
virtual void play_side(const unsigned int team_num, bool save) = 0;
|
||||
|
|
|
@ -255,7 +255,14 @@ void manager::save_temp_move()
|
|||
void manager::execute_next()
|
||||
{
|
||||
remove_temp_modifiers();
|
||||
get_current_side_actions()->execute_first();
|
||||
get_current_side_actions()->execute_next();
|
||||
apply_temp_modifiers();
|
||||
}
|
||||
|
||||
void manager::delete_last()
|
||||
{
|
||||
remove_temp_modifiers();
|
||||
get_current_side_actions()->remove_action(get_current_side_actions()->end() - 1);
|
||||
apply_temp_modifiers();
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,9 @@ public:
|
|||
/** Executes first action in the queue for current side */
|
||||
void execute_next();
|
||||
|
||||
/** Deletes last action in the queue for current side */
|
||||
void delete_last();
|
||||
|
||||
/** Checks whether the specified unit has at least one planned action,
|
||||
* and returns the first action found. */
|
||||
boost::shared_ptr<action> has_action(const unit& unit) const;
|
||||
|
|
|
@ -50,6 +50,8 @@ move::~move()
|
|||
{
|
||||
resources::screen->remove_temporary_unit(fake_unit_.get());
|
||||
}
|
||||
resources::screen->invalidate(orig_hex_);
|
||||
unit_.set_standing();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ const action_set& side_actions::actions() const
|
|||
return actions_;
|
||||
}
|
||||
|
||||
void side_actions::execute_first()
|
||||
void side_actions::execute_next()
|
||||
{
|
||||
if (!actions_.empty())
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
* Executes the first action in the queue, and then deletes it.
|
||||
* TODO: Validate all subsequent actions after doing this!
|
||||
*/
|
||||
void execute_first();
|
||||
void execute_next();
|
||||
|
||||
/**
|
||||
* Executes the specified action, if it exists in the queue.
|
||||
|
|
Loading…
Add table
Reference in a new issue