mail[Wesnoth-commits] r13939 - in /branches/1.2/src: menu_events.cpp menu_events.hpp play_controller.cpp replay_controller.cpp replay_controller.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by joerg . hinrichs on October 13, 2006 - 21:33:
Author: jhinrichs
Date: Fri Oct 13 21:33:22 2006
New Revision: 13939

URL: http://svn.gna.org/viewcvs/wesnoth?rev=13939&view=rev
Log:
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.

Modified:
    branches/1.2/src/menu_events.cpp
    branches/1.2/src/menu_events.hpp
    branches/1.2/src/play_controller.cpp
    branches/1.2/src/replay_controller.cpp
    branches/1.2/src/replay_controller.hpp

Modified: branches/1.2/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/menu_events.cpp?rev=13939&r1=13938&r2=13939&view=diff
==============================================================================
--- branches/1.2/src/menu_events.cpp (original)
+++ branches/1.2/src/menu_events.cpp Fri Oct 13 21:33:22 2006
@@ -112,9 +112,9 @@
                teams_[team_num - 1].reset_objectives_changed();
        }
 
-       void menu_handler::show_statistics()
-       {
-               const statistics::stats& stats = 
statistics::calculate_stats(0,gui_->viewing_team()+1);
+       void menu_handler::show_statistics(const unsigned int team_num)
+       {
+               const statistics::stats& stats = 
statistics::calculate_stats(0, team_num);
                std::vector<std::string> items;
 
                {

Modified: branches/1.2/src/menu_events.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/menu_events.hpp?rev=13939&r1=13938&r2=13939&view=diff
==============================================================================
--- branches/1.2/src/menu_events.hpp (original)
+++ branches/1.2/src/menu_events.hpp Fri Oct 13 21:33:22 2006
@@ -68,7 +68,7 @@
        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);

Modified: branches/1.2/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/play_controller.cpp?rev=13939&r1=13938&r2=13939&view=diff
==============================================================================
--- branches/1.2/src/play_controller.cpp (original)
+++ branches/1.2/src/play_controller.cpp Fri Oct 13 21:33:22 2006
@@ -185,7 +185,7 @@
 }
 
 void play_controller::show_statistics(){
-       menu_handler_.show_statistics();
+       menu_handler_.show_statistics(gui_->viewing_team()+1);
 }
 
 void play_controller::unit_list(){

Modified: branches/1.2/src/replay_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/replay_controller.cpp?rev=13939&r1=13938&r2=13939&view=diff
==============================================================================
--- branches/1.2/src/replay_controller.cpp (original)
+++ branches/1.2/src/replay_controller.cpp Fri Oct 13 21:33:22 2006
@@ -84,6 +84,7 @@
 
        fire_prestart(true);
        init_gui();
+       statistics::fresh_stats();
 
        LOG_NG << "first_time..." << (recorder.is_skipping() ? "skipping" : 
"no skip") << "\n";
 
@@ -103,6 +104,7 @@
        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 @@
        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 @@
        {
                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_++;
 
@@ -313,6 +320,10 @@
        play_controller::preferences();
        init_replay_display();
        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

Modified: branches/1.2/src/replay_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/replay_controller.hpp?rev=13939&r1=13938&r2=13939&view=diff
==============================================================================
--- branches/1.2/src/replay_controller.hpp (original)
+++ branches/1.2/src/replay_controller.hpp Fri Oct 13 21:33:22 2006
@@ -50,6 +50,7 @@
 
        //event handlers
        virtual void preferences();
+       virtual void show_statistics();
        void play_replay();
        void reset_replay();
        void stop_replay();




Related Messages


Powered by MHonArc, Updated Fri Oct 13 21:40:19 2006