mail[Wesnoth-commits] r20228 - in /trunk: changelog players_changelog src/playmp_controller.cpp src/playmp_controller.hpp


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

Header


Content

Posted by Soliton on September 09, 2007 - 15:33:
Author: soliton
Date: Sun Sep  9 15:33:11 2007
New Revision: 20228

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20228&view=rev
Log:
implement linger mode in mp
nothing gets saved in linger mode it seems so any chat in linger mode will 
not be replayed

Modified:
    trunk/changelog
    trunk/players_changelog
    trunk/src/playmp_controller.cpp
    trunk/src/playmp_controller.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=20228&r1=20227&r2=20228&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Sep  9 15:33:11 2007
@@ -28,6 +28,7 @@
    * the server sends the game id and not only the game name if a player 
joins
      a game to avoid ambiguity in case of multiple games with the same name
    * show observer team chat messages in the 'Chat Log' window
+   * implement linger mode for multiplayer
  * units:
    * balancing changes:
      * gave the Fugitive the concealment ability (village hiding)

Modified: trunk/players_changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/players_changelog?rev=20228&r1=20227&r2=20228&view=diff
==============================================================================
--- trunk/players_changelog (original)
+++ trunk/players_changelog Sun Sep  9 15:33:11 2007
@@ -26,6 +26,7 @@
   * Multiplayer
     * Revised maps: Charge, Den of Onis, Meteor Lake, Silverhead Crossing,
       Triple Blitz, Clash.
+    * Linger mode now allows chatting.
 
   * Unit changes and balancing
     * Gave the Fugitive the concealment ability. (village hiding)

Modified: trunk/src/playmp_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playmp_controller.cpp?rev=20228&r1=20227&r2=20228&view=diff
==============================================================================
--- trunk/src/playmp_controller.cpp (original)
+++ trunk/src/playmp_controller.cpp Sun Sep  9 15:33:11 2007
@@ -215,6 +215,66 @@
        menu_handler_.clear_undo_stack(player_number_);
 }
 
+void playmp_controller::linger(upload_log& log)
+{
+        LOG_NG << "beginning end-of-scenario linger";
+        browse_ = true;
+        linger_ = true;
+        // this is actually for after linger mode is over -- we don't want to
+        // stay stuck in linger state when the *next* scenario is over.
+        gamestate_.completion = "running";
+        // End all unit moves
+        for (unit_map::iterator u = units_.begin(); u != units_.end(); u++) {
+                u->second.set_user_end_turn(true);
+        }
+        try {
+               // reimplement parts of play_side()
+               //! @todo FIXME: needs cleaning up of unnecessary stuff
+               //               the timer probably needs some handling
+               turn_data_ = new turn_info(gameinfo_,gamestate_,status_,
+                                       
*gui_,map_,teams_,player_number_,units_,replay_sender_, undo_stack_);
+               turn_data_->replay_error().attach_handler(this);
+               gui_->enable_menu("endturn", true);
+               while(!end_turn_) {
+                       config cfg;
+                       const network::connection res = 
network::receive_data(cfg);
+                       std::deque<config> backlog;
+
+                       if(res != network::null_connection) {
+                               try{
+                                       
turn_data_->process_network_data(cfg,res,backlog,skip_replay_);
+                               }
+                               catch (replay::error& e){
+                                       process_oos(e.message);
+                                       throw e;
+                               }
+                       }
+
+                       play_slice();
+//                     } catch(end_level_exception& e) {
+//                             turn_data_->send_data();
+//                             throw e;
+
+                       gui_->draw();
+
+                       turn_data_->send_data();
+               }
+               menu_handler_.clear_undo_stack(player_number_);
+               // send any remaining data
+               turn_data_->send_data();
+               if (turn_data_ != NULL){
+                       turn_data_->replay_error().detach_handler(this);
+                       delete turn_data_;
+                       turn_data_ = NULL;
+               }
+        } catch(game::load_game_exception&) {
+                // Loading a new game is effectively a quit.
+                log.quit(status_.turn());
+                throw;
+        }
+        LOG_NG << "ending end-of-scenario linger";
+}
+
 void playmp_controller::after_human_turn(){
        if ( level_["mp_countdown"] == "yes" ){
                const int action_increment = 
lexical_cast_default<int>(level_["mp_countdown_action_bonus"],0);

Modified: trunk/src/playmp_controller.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playmp_controller.hpp?rev=20228&r1=20227&r2=20228&view=diff
==============================================================================
--- trunk/src/playmp_controller.hpp (original)
+++ trunk/src/playmp_controller.hpp Sun Sep  9 15:33:11 2007
@@ -36,6 +36,7 @@
        bool counting_down();
        void think_about_countdown(int ticks);
        void process(events::pump_info &info);
+       void linger(upload_log&);
 
 protected:
        virtual void handle_generic_event(const std::string& name);




Related Messages


Powered by MHonArc, Updated Sun Sep 09 17:40:30 2007