mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-03 00:49:14 +00:00
fixes bug #7245 (stats in replay counted not from 0) and #6937 (at replay end shows the scenario objectives). Also prevents to be thrown back to the title screen if replay ends with victory or defeat.
This commit is contained in:
parent
57bc655606
commit
707cbd728f
@ -153,9 +153,9 @@ namespace events{
|
||||
teams_[team_num - 1].reset_objectives_changed();
|
||||
}
|
||||
|
||||
void menu_handler::show_statistics()
|
||||
void menu_handler::show_statistics(const unsigned int team_num)
|
||||
{
|
||||
const statistics::stats& stats = statistics::calculate_stats(0,gui_->viewing_team()+1);
|
||||
const statistics::stats& stats = statistics::calculate_stats(0, team_num);
|
||||
std::vector<std::string> items;
|
||||
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
void set_gui(display* gui) { gui_ = gui; }
|
||||
|
||||
void objectives(const unsigned int team_num);
|
||||
void show_statistics();
|
||||
void show_statistics(const unsigned int team_num);
|
||||
void unit_list();
|
||||
void status_table();
|
||||
void save_game(const std::string& message, gui::DIALOG_TYPE dialog_type, const bool has_exit_button=false);
|
||||
|
@ -186,7 +186,7 @@ void play_controller::objectives(){
|
||||
}
|
||||
|
||||
void play_controller::show_statistics(){
|
||||
menu_handler_.show_statistics();
|
||||
menu_handler_.show_statistics(gui_->viewing_team()+1);
|
||||
}
|
||||
|
||||
void play_controller::unit_list(){
|
||||
|
@ -84,6 +84,7 @@ void replay_controller::init(){
|
||||
|
||||
fire_prestart(true);
|
||||
init_gui();
|
||||
statistics::fresh_stats();
|
||||
|
||||
LOG_NG << "first_time..." << (recorder.is_skipping() ? "skipping" : "no skip") << "\n";
|
||||
|
||||
@ -103,6 +104,7 @@ void replay_controller::init_gui(){
|
||||
for(std::vector<team>::iterator t = teams_.begin(); t != teams_.end(); ++t) {
|
||||
t->set_fog(false);
|
||||
t->set_shroud(false);
|
||||
t->reset_objectives_changed();
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,6 +155,7 @@ void replay_controller::reset_replay(){
|
||||
status_ = status_start_;
|
||||
gamestate_ = gamestate_start_;
|
||||
teams_ = team_manager_.clone(teams_start_);
|
||||
statistics::fresh_stats();
|
||||
if (events_manager_ != NULL){
|
||||
delete events_manager_;
|
||||
events_manager_ = new game_events::manager(level_,*gui_,map_,units_,teams_,
|
||||
@ -275,6 +278,10 @@ void replay_controller::play_side(const unsigned int team_index, bool){
|
||||
{
|
||||
is_playing_ = false;
|
||||
}
|
||||
catch(end_level_exception& e){
|
||||
//VICTORY/DEFEAT end_level_exception shall not return to title screen
|
||||
if ((e.result != VICTORY) && (e.result != DEFEAT)) { throw e; }
|
||||
}
|
||||
|
||||
player_number_++;
|
||||
|
||||
@ -315,6 +322,10 @@ void replay_controller::preferences(){
|
||||
update_gui();
|
||||
}
|
||||
|
||||
void replay_controller::show_statistics(){
|
||||
menu_handler_.show_statistics(gui_->playing_team()+1);
|
||||
}
|
||||
|
||||
bool replay_controller::can_execute_command(hotkey::HOTKEY_COMMAND command) const
|
||||
{
|
||||
bool result = play_controller::can_execute_command(command);
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
|
||||
//event handlers
|
||||
virtual void preferences();
|
||||
virtual void show_statistics();
|
||||
void play_replay();
|
||||
void reset_replay();
|
||||
void stop_replay();
|
||||
|
Loading…
x
Reference in New Issue
Block a user