apply patch 1175 new option to prevent ally stoping movemen
This commit is contained in:
parent
ef0d925e4f
commit
b55036cec6
7 changed files with 54 additions and 3 deletions
|
@ -13,7 +13,7 @@ The release team should empty this file after each release.
|
|||
|
||||
***
|
||||
|
||||
REPLACE ME WITH CONTENT...
|
||||
A new option was added to choose whether or not to interupt unit movement when an ally unit is sighted
|
||||
|
||||
***
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ Version 1.7.5+svn:
|
|||
* Add a Description button to the add-ons downloader
|
||||
* For move+attack mouse click, now show the attack dialog before the move.
|
||||
* In sidebar, add current bonus/malus info from alignement.
|
||||
* New option to enable/disable move interruption when an ally is sighted
|
||||
* WML engine:
|
||||
* Fix silent=yes for objectives
|
||||
* Allow [story] [part] blocks to specify the title box alignment
|
||||
|
|
|
@ -879,6 +879,9 @@
|
|||
[entry]
|
||||
name = "Joshua Hudson"
|
||||
[/entry]
|
||||
[entry]
|
||||
name = "Kamil Kaczmarczyk (lampak)"
|
||||
[/entry]
|
||||
[entry]
|
||||
name = "Karl Miller (karlm)"
|
||||
email = "karl_dot_miller_dot_km_at_gmail_dot_com"
|
||||
|
|
|
@ -2153,7 +2153,31 @@ size_t move_unit(move_unit_spectator *move_spectator,
|
|||
const t_translation::t_terrain terrain = map[*step];
|
||||
|
||||
const int cost = ui->second.movement_cost(terrain);
|
||||
if(cost >moves_left || discovered_unit || (continue_move == false && seen_units.empty() == false)) {
|
||||
|
||||
//check whether a unit was sighted and whether it should interrupt move
|
||||
bool sighted_interrupts = false;
|
||||
if (continue_move == false && preferences::interrupt_when_ally_sighted() == false) {
|
||||
//check whether any sighted unit is an enemy
|
||||
for (std::set<map_location>::iterator it = seen_units.begin(); it != seen_units.end(); ++it)
|
||||
{
|
||||
const unit_map::const_iterator u = units.find(*it);
|
||||
|
||||
// Unit may have been removed by an event.
|
||||
if(u == units.end()) {
|
||||
DBG_NG << "was removed\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tm->is_enemy(u->second.side())) {
|
||||
sighted_interrupts = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
sighted_interrupts = seen_units.empty() == false; //interrupt if any unit was sighted
|
||||
|
||||
if(cost >moves_left || discovered_unit || (continue_move == false && sighted_interrupts)) {
|
||||
if ((!is_replay) || (!skirmisher))
|
||||
break; // not enough MP or spotted new enemies
|
||||
}
|
||||
|
|
|
@ -645,6 +645,16 @@ bool ask_delete_saves()
|
|||
return utils::string_bool(preferences::get("ask_delete"), true);
|
||||
}
|
||||
|
||||
void set_interrupt_when_ally_sighted(bool value)
|
||||
{
|
||||
preferences::set("ally_sighted_interrupts", value ? "yes" : "no");
|
||||
}
|
||||
|
||||
bool interrupt_when_ally_sighted()
|
||||
{
|
||||
return utils::string_bool(preferences::get("ally_sighted_interrupts"), true);
|
||||
}
|
||||
|
||||
int autosavemax()
|
||||
{
|
||||
return lexical_cast_default<int>(preferences::get("auto_save_max"), 10);
|
||||
|
|
|
@ -160,6 +160,9 @@ namespace preferences {
|
|||
void set_ask_delete_saves(bool value);
|
||||
bool ask_delete_saves();
|
||||
|
||||
void set_interrupt_when_ally_sighted(bool value);
|
||||
bool interrupt_when_ally_sighted();
|
||||
|
||||
void set_autosavemax(int value);
|
||||
int autosavemax();
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ private:
|
|||
buffer_size_slider_, idle_anim_slider_, autosavemax_slider_, advanced_slider_;
|
||||
gui::list_slider<double> turbo_slider_;
|
||||
gui::button fullscreen_button_, scroll_to_action_button_,turbo_button_, show_ai_moves_button_,
|
||||
interrupt_when_ally_sighted_button_,
|
||||
show_grid_button_, save_replays_button_, delete_saves_button_,
|
||||
show_lobby_joins_button1_,
|
||||
show_lobby_joins_button2_,
|
||||
|
@ -157,6 +158,7 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
|
|||
scroll_to_action_button_(disp.video(), _("Enable scroll tracking of unit actions"), gui::button::TYPE_CHECK),
|
||||
turbo_button_(disp.video(), _("Accelerated Speed"), gui::button::TYPE_CHECK),
|
||||
show_ai_moves_button_(disp.video(), _("Skip AI Moves"), gui::button::TYPE_CHECK),
|
||||
interrupt_when_ally_sighted_button_(disp.video(), _("Interrupt move when an ally is sighted"), gui::button::TYPE_CHECK),
|
||||
show_grid_button_(disp.video(), _("Show Grid"), gui::button::TYPE_CHECK),
|
||||
save_replays_button_(disp.video(), _("Save Replay on SP/MP Victory or MP Defeat"), gui::button::TYPE_CHECK),
|
||||
delete_saves_button_(disp.video(), _("Delete Auto-Saves on SP/MP Victory or MP Defeat"), gui::button::TYPE_CHECK),
|
||||
|
@ -221,7 +223,7 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
|
|||
#ifdef USE_TINY_GUI
|
||||
set_measurements(180, 180); // FIXME: should compute this, but using what data ?
|
||||
#else
|
||||
set_measurements(440, 405);
|
||||
set_measurements(440, 425);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -335,6 +337,9 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
|
|||
show_ai_moves_button_.set_check(!show_ai_moves());
|
||||
show_ai_moves_button_.set_help_string(_("Do not animate AI units moving"));
|
||||
|
||||
interrupt_when_ally_sighted_button_.set_check(interrupt_when_ally_sighted());
|
||||
interrupt_when_ally_sighted_button_.set_help_string(("Sighting an allied unit interrupts your unit's movement"));
|
||||
|
||||
save_replays_button_.set_check(save_replays());
|
||||
save_replays_button_.set_help_string(_("Save Replay on SP/MP Victory or MP Defeat"));
|
||||
|
||||
|
@ -418,6 +423,7 @@ handler_vector preferences_dialog::handler_members()
|
|||
h.push_back(&turbo_button_);
|
||||
h.push_back(&idle_anim_button_);
|
||||
h.push_back(&show_ai_moves_button_);
|
||||
h.push_back(&interrupt_when_ally_sighted_button_);
|
||||
h.push_back(&save_replays_button_);
|
||||
h.push_back(&delete_saves_button_);
|
||||
h.push_back(&show_grid_button_);
|
||||
|
@ -508,6 +514,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; turn_dialog_button_.set_location(rect.x, ypos);
|
||||
ypos += short_interline; interrupt_when_ally_sighted_button_.set_location(rect.x, ypos);
|
||||
ypos += item_interline; show_team_colours_button_.set_location(rect.x, ypos);
|
||||
ypos += short_interline; show_grid_button_.set_location(rect.x, ypos);
|
||||
ypos += item_interline; save_replays_button_.set_location(rect.x, ypos);
|
||||
|
@ -668,6 +675,8 @@ void preferences_dialog::process_event()
|
|||
}
|
||||
if (show_ai_moves_button_.pressed())
|
||||
set_show_ai_moves(!show_ai_moves_button_.checked());
|
||||
if (interrupt_when_ally_sighted_button_.pressed())
|
||||
set_interrupt_when_ally_sighted(interrupt_when_ally_sighted_button_.checked());
|
||||
if (show_grid_button_.pressed())
|
||||
set_grid(show_grid_button_.checked());
|
||||
if (save_replays_button_.pressed())
|
||||
|
@ -1063,6 +1072,7 @@ void preferences_dialog::set_selection(int index)
|
|||
turbo_slider_.enable(turbo());
|
||||
show_ai_moves_button_.hide(hide_general);
|
||||
turn_dialog_button_.hide(hide_general);
|
||||
interrupt_when_ally_sighted_button_.hide(hide_general);
|
||||
hotkeys_button_.hide(hide_general);
|
||||
show_team_colours_button_.hide(hide_general);
|
||||
show_grid_button_.hide(hide_general);
|
||||
|
|
Loading…
Add table
Reference in a new issue