Skip to content

Commit

Permalink
Added a preference to disable automatic movements at the begining of a
Browse files Browse the repository at this point in the history
turn.

It was a feature in the "Engine related features" of the EasyCoding section
  • Loading branch information
LovCAPONE committed Jul 28, 2014
1 parent 74fe722 commit 826c591
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelog
Expand Up @@ -105,6 +105,8 @@ Version 1.13.0-dev:
* Fixed AI engine names in the MP game setup screen being translated to the
language selected when Wesnoth was started rather than the current
language (bug #22092).
* Added a "Disable automatic moves" preference to disable automatic movements
at the begining of a turn.
* WML engine:
* Added customizable recall costs for unit types and individual units,
using the new recall_cost attribute in [unit_type] and [unit].
Expand Down
3 changes: 3 additions & 0 deletions data/core/about.cfg
Expand Up @@ -1137,6 +1137,9 @@
[entry]
name = "Laurent Birtz"
[/entry]
[entry]
name = "Lovens Weche (LovCAPONE)"
[/entry]
[entry]
name = "Luiz Fernando de Faria Pereira (lfernando)"
[/entry]
Expand Down
10 changes: 10 additions & 0 deletions src/game_preferences_display.cpp
Expand Up @@ -141,6 +141,7 @@ class preferences_dialog : public gui::preview_pane
confirm_sound_button_, idle_anim_button_,
standing_anim_button_,
animate_map_button_,
disable_auto_move_button_,

// color tab
orb_colors_defaults_,
Expand Down Expand Up @@ -249,6 +250,7 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
orb_colors_unmoved_toggle_(disp.video(), _("Show unmoved orb"), gui::button::TYPE_CHECK),
orb_colors_partial_toggle_(disp.video(), _("Show partial moved orb"), gui::button::TYPE_CHECK),
orb_colors_moved_toggle_(disp.video(), _("Show moved orb"), gui::button::TYPE_CHECK),
disable_auto_move_button_(disp.video(), _("Disable automatic moves"), gui::button::TYPE_CHECK),

//colors tab buttons
orb_colors_ally_buttons_(),
Expand Down Expand Up @@ -515,6 +517,9 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
colors_button_.set_help_string(_("Adjust orb colors"));
cache_button_.set_help_string(_("Manage the game WML cache"));

disable_auto_move_button_.set_check(disable_auto_moves());
disable_auto_move_button_.set_help_string(_("Do not allow automatic movements at the begining of a turn"));

set_advanced_menu();
set_friends_menu();
}
Expand Down Expand Up @@ -596,6 +601,7 @@ handler_vector preferences_dialog::handler_members()
h.push_back(&sample_rate_input_);
h.push_back(&advanced_);
h.push_back(&friends_);
h.push_back(&disable_auto_move_button_);

// Colors tab
for (unsigned i = 0; i < color_ids_.size(); i++) {
Expand Down Expand Up @@ -650,6 +656,7 @@ void preferences_dialog::update_location(SDL_Rect const &rect)

turbo_slider_.set_location(turbo_rect);
ypos += item_interline; show_ai_moves_button_.set_location(rect.x, ypos);
ypos += short_interline; disable_auto_move_button_.set_location(rect.x, ypos);
ypos += short_interline; turn_dialog_button_.set_location(rect.x, ypos);
ypos += short_interline; whiteboard_on_start_button_.set_location(rect.x, ypos);
ypos += short_interline; hide_whiteboard_button_.set_location(rect.x, ypos);
Expand Down Expand Up @@ -905,6 +912,8 @@ void preferences_dialog::process_event()
}
if (show_ai_moves_button_.pressed())
set_show_ai_moves(!show_ai_moves_button_.checked());
if (disable_auto_move_button_.pressed())
set_disable_auto_moves(disable_auto_move_button_.checked());
if (interrupt_when_ally_sighted_button_.pressed())
set_interrupt_when_ally_sighted(interrupt_when_ally_sighted_button_.checked());
if (save_replays_button_.pressed())
Expand Down Expand Up @@ -1554,6 +1563,7 @@ void preferences_dialog::set_selection(int index)
turbo_slider_label_.enable(turbo());
turbo_slider_.enable(turbo());
show_ai_moves_button_.hide(hide_general);
disable_auto_move_button_.hide(hide_general);
turn_dialog_button_.hide(hide_general);
whiteboard_on_start_button_.hide(hide_general);
hide_whiteboard_button_.hide(hide_general);
Expand Down
5 changes: 4 additions & 1 deletion src/playmp_controller.cpp
Expand Up @@ -174,7 +174,10 @@ possible_end_play_signal playmp_controller::play_human_turn(){
remove_blindfold();
int cur_ticks = SDL_GetTicks();
show_turn_dialog();
HANDLE_END_PLAY_SIGNAL( execute_gotos() );

if (!preferences::disable_auto_moves()) {
HANDLE_END_PLAY_SIGNAL(execute_gotos());
}

if (!linger_ || is_host()) {
end_turn_enable(true);
Expand Down
5 changes: 4 additions & 1 deletion src/playsingle_controller.cpp
Expand Up @@ -860,7 +860,10 @@ void playsingle_controller::execute_gotos(){

possible_end_play_signal playsingle_controller::play_human_turn() {
show_turn_dialog();
HANDLE_END_PLAY_SIGNAL( execute_gotos() );

if (!preferences::disable_auto_moves()) {
HANDLE_END_PLAY_SIGNAL(execute_gotos());
}

end_turn_enable(true);
while(!end_turn_) {
Expand Down
10 changes: 10 additions & 0 deletions src/preferences.cpp
Expand Up @@ -949,5 +949,15 @@ bool use_twelve_hour_clock_format()
return get("use_twelve_hour_clock_format", false);
}

bool disable_auto_moves()
{
return get("disable_auto_moves", false);
}

void set_disable_auto_moves(bool value)
{
preferences::set("disable_auto_moves", value);
}

} // end namespace preferences

3 changes: 3 additions & 0 deletions src/preferences.hpp
Expand Up @@ -247,6 +247,9 @@ namespace preferences {
bool use_twelve_hour_clock_format();
void set_use_twelve_hour_clock_format(bool value);

bool disable_auto_moves();
void set_disable_auto_moves(bool value);

} // end namespace preferences

#endif

0 comments on commit 826c591

Please sign in to comment.