Merge pull request #62 from bumbadadabum/personal

Added a notification when toggling accelerated speed
This commit is contained in:
lipk 2013-08-14 12:06:34 -07:00
commit cfed346a20
4 changed files with 22 additions and 3 deletions

View file

@ -1150,6 +1150,9 @@ bool command_executor::execute_command(HOTKEY_COMMAND command, int /*index*/)
case HOTKEY_RIGHT_MOUSE_CLICK:
right_mouse_click();
break;
case HOTKEY_ACCELERATED:
toggle_accelerated_speed();
break;
default:
return false;
}
@ -1210,9 +1213,6 @@ void execute_command(display& disp, HOTKEY_COMMAND command, command_executor* ex
case HOTKEY_MOUSE_SCROLL:
preferences::enable_mouse_scroll(!preferences::mouse_scroll_enabled());
break;
case HOTKEY_ACCELERATED:
preferences::set_turbo(!preferences::turbo());
break;
case HOTKEY_MUTE:
{
// look if both is not playing

View file

@ -392,6 +392,7 @@ public:
virtual void whiteboard_suppose_dead() {}
virtual void left_mouse_click() {}
virtual void right_mouse_click() {}
virtual void toggle_accelerated_speed() {}
// 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 ""; }

View file

@ -1429,3 +1429,20 @@ void play_controller::update_gui_to_player(const int team_index, const bool obse
gui_->draw(true,true);
}
void play_controller::toggle_accelerated_speed()
{
preferences::set_turbo(!preferences::turbo());
if (preferences::turbo())
{
std::string hk = hotkey::get_names(hotkey::HOTKEY_ACCELERATED);
utils::string_map symbols;
symbols["hk"] = hk;
gui_->announce(_("Accelerated speed enabled!"), font::NORMAL_COLOR);
gui_->announce("\n" + vgettext("(press $hk to disable)", symbols), font::NORMAL_COLOR);
}
else
{
gui_->announce(_("Accelerated speed disabled!"), font::NORMAL_COLOR);
}
}

View file

@ -102,6 +102,7 @@ public:
virtual void toggle_ellipses();
virtual void toggle_grid();
virtual void search();
virtual void toggle_accelerated_speed();
virtual void maybe_do_init_side(const unsigned int team_index, bool is_replay = false);
virtual void do_init_side(const unsigned int team_index, bool is_replay = false);