mail[Wesnoth-commits] r20299 - /trunk/src/playmp_controller.cpp


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

Header


Content

Posted by Soliton on September 11, 2007 - 09:53:
Author: soliton
Date: Tue Sep 11 09:52:55 2007
New Revision: 20299

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20299&view=rev
Log:
clean up linger() and handle the timer

Modified:
    trunk/src/playmp_controller.cpp

Modified: trunk/src/playmp_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playmp_controller.cpp?rev=20299&r1=20298&r2=20299&view=diff
==============================================================================
--- trunk/src/playmp_controller.cpp (original)
+++ trunk/src/playmp_controller.cpp Tue Sep 11 09:52:55 2007
@@ -169,7 +169,7 @@
                }
 
 
-               if (current_team().countdown_time() > 0 &&  ( 
level_["mp_countdown"] == "yes" ) ){
+               if (current_team().countdown_time() > 0 &&  ( 
level_["mp_countdown"] == "yes" ) && !linger_){
                        SDL_Delay(1);
                        const int ticks = SDL_GetTicks();
                        int new_time = 
current_team().countdown_time()-maximum<int>(1,(ticks - cur_ticks));
@@ -227,46 +227,21 @@
         for (unit_map::iterator u = units_.begin(); u != units_.end(); u++) {
                 u->second.set_user_end_turn(true);
         }
+       //current_team().set_countdown_time(0);
+       //halt and cancel the countdown timer
+       if(beep_warning_time_ < 0) {
+               sound::stop_bell();
+       }
+       beep_warning_time_=-1;
         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;
-               }
+
+               play_human_turn();
+               after_human_turn();
+
         } catch(game::load_game_exception&) {
                 // Loading a new game is effectively a quit.
                 log.quit(status_.turn());




Related Messages


Powered by MHonArc, Updated Tue Sep 11 10:20:28 2007