mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-16 18:31:32 +00:00
Fix bug 6513: we auto-save at start of turn even if loading in middle of turn!
Now we generally suppress autosave on first turn: at best it's redundant. I did not restore the previous MP behaviour of having one (constantly over-written) AutoSave file: that logic still exists in menu_handler::autosave() but is unused.
This commit is contained in:
parent
9b8db33b48
commit
dcf9720224
@ -69,7 +69,7 @@ public:
|
||||
virtual void toggle_grid();
|
||||
virtual void search();
|
||||
|
||||
virtual void play_side(const unsigned int team_num) = 0;
|
||||
virtual void play_side(const unsigned int team_num, bool save) = 0;
|
||||
|
||||
const int get_ticks();
|
||||
|
||||
|
@ -53,14 +53,14 @@ void playmp_controller::speak(){
|
||||
menu_handler_.speak();
|
||||
}
|
||||
|
||||
void playmp_controller::play_side(const unsigned int team_index){
|
||||
void playmp_controller::play_side(const unsigned int team_index, bool save){
|
||||
//goto this label if the type of a team (human/ai/networked) has changed mid-turn
|
||||
redo_turn:
|
||||
bool player_type_changed_ = false;
|
||||
end_turn_ = false;
|
||||
|
||||
if(current_team().is_human() || current_team().is_ai()) {
|
||||
playsingle_controller::play_side(team_index);
|
||||
playsingle_controller::play_side(team_index, save);
|
||||
} else if(current_team().is_network()) {
|
||||
player_type_changed_ = play_network_turn();
|
||||
}
|
||||
@ -68,8 +68,8 @@ redo_turn:
|
||||
if (player_type_changed_) { goto redo_turn; }
|
||||
}
|
||||
|
||||
void playmp_controller::before_human_turn(){
|
||||
playsingle_controller::before_human_turn();
|
||||
void playmp_controller::before_human_turn(bool save){
|
||||
playsingle_controller::before_human_turn(save);
|
||||
|
||||
turn_data_ = new turn_info(gameinfo_,gamestate_,status_,
|
||||
*gui_,map_,teams_,player_number_,units_,replay_sender_, undo_stack_);
|
||||
|
@ -37,8 +37,8 @@ protected:
|
||||
virtual void clear_labels();
|
||||
virtual bool can_execute_command(hotkey::HOTKEY_COMMAND command) const;
|
||||
|
||||
virtual void play_side(const unsigned int team_index);
|
||||
virtual void before_human_turn();
|
||||
virtual void play_side(const unsigned int team_index, bool save);
|
||||
virtual void before_human_turn(bool save);
|
||||
virtual void play_human_turn();
|
||||
virtual void after_human_turn();
|
||||
virtual void finish_side_turn();
|
||||
|
@ -185,8 +185,10 @@ LEVEL_RESULT playsingle_controller::play_scenario(const std::vector<config*>& st
|
||||
}
|
||||
}
|
||||
|
||||
bool save = false;
|
||||
for(; ; first_player_ = 1) {
|
||||
play_turn();
|
||||
play_turn(save);
|
||||
save = true;
|
||||
} //end for loop
|
||||
|
||||
} catch(game::load_game_exception&) {
|
||||
@ -354,7 +356,8 @@ LEVEL_RESULT playsingle_controller::play_scenario(const std::vector<config*>& st
|
||||
return QUIT;
|
||||
}
|
||||
|
||||
void playsingle_controller::play_turn(){
|
||||
void playsingle_controller::play_turn(bool save)
|
||||
{
|
||||
gui_->new_turn();
|
||||
gui_->invalidate_game_status();
|
||||
events::raise_draw_event();
|
||||
@ -380,7 +383,7 @@ void playsingle_controller::play_turn(){
|
||||
LOG_NG << "result of replay: " << (replaying_?"true":"false") << "\n";
|
||||
}
|
||||
else{
|
||||
play_side(player_number_);
|
||||
play_side(player_number_, save);
|
||||
}
|
||||
|
||||
finish_side_turn();
|
||||
@ -394,7 +397,8 @@ void playsingle_controller::play_turn(){
|
||||
finish_turn();
|
||||
}
|
||||
|
||||
void playsingle_controller::play_side(const unsigned int team_index){
|
||||
void playsingle_controller::play_side(const unsigned int team_index, bool save)
|
||||
{
|
||||
//goto this label if the type of a team (human/ai/networked) has changed mid-turn
|
||||
redo_turn:
|
||||
//although this flag is used only in this method it has to be a class member
|
||||
@ -405,7 +409,7 @@ redo_turn:
|
||||
if(current_team().is_human()) {
|
||||
LOG_NG << "is human...\n";
|
||||
try{
|
||||
before_human_turn();
|
||||
before_human_turn(save);
|
||||
play_human_turn();
|
||||
after_human_turn();
|
||||
} catch(end_turn_exception& end_turn) {
|
||||
@ -424,7 +428,8 @@ redo_turn:
|
||||
if (player_type_changed_) { goto redo_turn; }
|
||||
}
|
||||
|
||||
void playsingle_controller::before_human_turn(){
|
||||
void playsingle_controller::before_human_turn(bool save)
|
||||
{
|
||||
log_scope("player turn");
|
||||
browse_ = false;
|
||||
|
||||
@ -434,7 +439,9 @@ void playsingle_controller::before_human_turn(){
|
||||
gui_->draw();
|
||||
gui_->update_display();
|
||||
|
||||
menu_handler_.autosave(gamestate_.label, status_.turn(), gamestate_.starting_pos);
|
||||
if (save) {
|
||||
menu_handler_.autosave(gamestate_.label, status_.turn(), gamestate_.starting_pos);
|
||||
}
|
||||
|
||||
if(preferences::turn_bell()) {
|
||||
sound::play_sound(game_config::sounds::turn_bell);
|
||||
|
@ -55,9 +55,9 @@ public:
|
||||
void playsingle_slice();
|
||||
|
||||
protected:
|
||||
virtual void play_turn();
|
||||
virtual void play_side(const unsigned int team_index);
|
||||
virtual void before_human_turn();
|
||||
virtual void play_turn(bool no_save);
|
||||
virtual void play_side(const unsigned int team_index, bool save);
|
||||
virtual void before_human_turn(bool save);
|
||||
virtual void play_human_turn();
|
||||
virtual void after_human_turn();
|
||||
void play_ai_turn();
|
||||
|
@ -172,7 +172,7 @@ void replay_controller::replay_next_turn(){
|
||||
|
||||
void replay_controller::replay_next_side(){
|
||||
is_playing_ = true;
|
||||
play_side(player_number_ - 1);
|
||||
play_side(player_number_ - 1, false);
|
||||
|
||||
if ((size_t)player_number_ > teams_.size()) {
|
||||
player_number_ = 1;
|
||||
@ -231,14 +231,14 @@ void replay_controller::play_turn(){
|
||||
LOG_NG << "turn: " << current_turn_ << "\n";
|
||||
|
||||
while ( ((size_t)player_number_ <= teams_.size()) && (!recorder.at_end()) ){
|
||||
play_side(player_number_ - 1);
|
||||
play_side(player_number_ - 1, false);
|
||||
}
|
||||
|
||||
player_number_ = 1;
|
||||
current_turn_++;
|
||||
}
|
||||
|
||||
void replay_controller::play_side(const unsigned int team_index){
|
||||
void replay_controller::play_side(const unsigned int team_index, bool){
|
||||
if (recorder.at_end()){
|
||||
return;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ protected:
|
||||
private:
|
||||
void init();
|
||||
virtual void play_turn();
|
||||
virtual void play_side(const unsigned int team_index);
|
||||
virtual void play_side(const unsigned int team_index, bool save);
|
||||
void update_teams();
|
||||
void update_gui();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user