mail[Wesnoth-commits] r37238 - in /trunk: data/ src/


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

Header


Content

Posted by AI0867 on July 26, 2009 - 16:07:
Author: ai0867
Date: Sun Jul 26 16:07:44 2009
New Revision: 37238

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37238&view=rev
Log:
Rewrite [end_turn] to end the turn after the event has finished.

Modified:
    trunk/data/scenario-test.cfg
    trunk/src/game_events.cpp
    trunk/src/menu_events.cpp
    trunk/src/play_controller.hpp
    trunk/src/playmp_controller.cpp
    trunk/src/playsingle_controller.cpp
    trunk/src/playsingle_controller.hpp
    trunk/src/replay_controller.cpp

Modified: trunk/data/scenario-test.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Sun Jul 26 16:07:44 2009
@@ -1274,8 +1274,18 @@
         [filter]
             x,y=7,3
         [/filter]
+        [message]
+            speaker=narrator
+            image=wesnoth-icon.png
+            message="Message 1 of 2: prepare for timeshift"
+        [/message]
         [end_turn]
         [/end_turn]
+        [message]
+            speaker=narrator
+            image=wesnoth-icon.png
+            message="Message 2 of 2: timeshift imminent"
+        [/message]
     [/event]
 
     [event]

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Sun Jul 26 16:07:44 2009
@@ -2667,9 +2667,9 @@
        }
 
 WML_HANDLER_FUNCTION(end_turn, /*event_info*/, /*cfg*/)
-       {
-               throw end_turn_exception();
-       }
+{
+       resources::controller->force_end_turn();
+}
 
 WML_HANDLER_FUNCTION(endlevel, /*event_info*/, cfg)
 {

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Sun Jul 26 16:07:44 2009
@@ -38,6 +38,7 @@
 #include "marked-up_text.hpp"
 #include "menu_events.hpp"
 #include "mouse_events.hpp"
+#include "play_controller.hpp"
 #include "preferences_display.hpp"
 #include "replay.hpp"
 #include "resources.hpp"
@@ -3106,6 +3107,8 @@
        {
                try {
                        add_chat_message(time(NULL), _("ai"), 0, 
ai::manager::evaluate_command(side_num, str));
+               } catch(end_turn_exception) {
+                       resources::controller->force_end_turn();
                } catch(...) {
                        //add_chat_message(time(NULL), _("ai"), 0, "ERROR IN 
FORMULA");
                }

Modified: trunk/src/play_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.hpp?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/src/play_controller.hpp (original)
+++ trunk/src/play_controller.hpp Sun Jul 26 16:07:44 2009
@@ -79,6 +79,8 @@
        virtual void do_init_side(const unsigned int team_index);
        virtual void play_side(const unsigned int team_num, bool save) = 0;
 
+       virtual void force_end_turn(){}
+
        //turn functions
        size_t turn() const {return tod_manager_.turn();}
        int number_of_turns() const {return tod_manager_.number_of_turns();}

Modified: trunk/src/playmp_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playmp_controller.cpp?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/src/playmp_controller.cpp (original)
+++ trunk/src/playmp_controller.cpp Sun Jul 26 16:07:44 2009
@@ -579,6 +579,9 @@
                        gui_->invalidate_theme();
                }
        }
+       if (end_turn_) {
+               throw end_turn_exception();
+       }
 }
 
 bool playmp_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, 
int index) const

Modified: trunk/src/playsingle_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Sun Jul 26 16:07:44 2009
@@ -812,6 +812,9 @@
        if (name == "ai_user_interact"){
                play_slice(false);
        }
+       if (end_turn_){
+               throw end_turn_exception();
+       }
 }
 
 void playsingle_controller::check_time_over(){

Modified: trunk/src/playsingle_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.hpp?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/src/playsingle_controller.hpp (original)
+++ trunk/src/playsingle_controller.hpp Sun Jul 26 16:07:44 2009
@@ -45,6 +45,7 @@
        virtual void toggle_shroud_updates();
        virtual void update_shroud_now();
        virtual void end_turn();
+       virtual void force_end_turn(){ end_turn_ = true; }
        virtual void rename_unit();
        virtual void create_unit();
        virtual void change_side();

Modified: trunk/src/replay_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay_controller.cpp?rev=37238&r1=37237&r2=37238&view=diff
==============================================================================
--- trunk/src/replay_controller.cpp (original)
+++ trunk/src/replay_controller.cpp Sun Jul 26 16:07:44 2009
@@ -340,7 +340,7 @@
                                                throw;
                                        }
                                }
-                       } catch(end_turn_exception) {
+                       } catch(end_turn_exception&) {
                        }
 
                        finish_side_turn();




Related Messages


Powered by MHonArc, Updated Sun Jul 26 16:21:26 2009