Author: suokko
Date: Thu Apr 16 12:22:19 2009
New Revision: 34964

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34964&view=rev
Log:
backport to stable: Fixed control transfer after player leaves MP game (bug 
#13238)

Modified:
    branches/1.6/changelog
    branches/1.6/src/playturn.cpp

Modified: branches/1.6/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/changelog?rev=34964&r1=34963&r2=34964&view=diff
==============================================================================
--- branches/1.6/changelog (original)
+++ branches/1.6/changelog Thu Apr 16 12:22:19 2009
@@ -40,6 +40,7 @@
      (impacts "submerge" animations and AI settings)
    * Fixed a bug with auto-stored WML variables not being restored correctly
    * Fixed a crash when sighted event killed the attacked unit
+   * Fixed control transfer after player leaves MP game (bug #13238)
    * Limit the maximum length of the mp command dialog as workaround for bug
      #13333 (This workaround is only implemented for Windows and Mac)
 

Modified: branches/1.6/src/playturn.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/playturn.cpp?rev=34964&r1=34963&r2=34964&view=diff
==============================================================================
--- branches/1.6/src/playturn.cpp (original)
+++ branches/1.6/src/playturn.cpp Thu Apr 16 12:22:19 2009
@@ -273,12 +273,20 @@
                                throw end_level_exception(QUIT);
                        default:
                                if (action > 2) {
+                                       
+                                       {
+                                               // Server thinks this side is 
ours now so in case of error transfering side we have to make local state to 
same as what server thinks it is.
+                                               teams_[side_index].make_human();
+                                               
teams_[side_index].set_current_player("human"+side_str);
+                                               if(have_leader) 
leader->second.rename("human"+side_str);
+                                       }
+
                                        const size_t index = 
static_cast<size_t>(action - 3);
                                        if (index < observers.size()) {
                                                
change_side_controller(side_str, observers[index], false /*not our own side*/);
                                        } else if (index < options.size() - 1) {
                                                size_t i = index - 
observers.size();
-                                               
change_side_controller(side_str, allies[i]->save_id(), false /*not our own 
side*/);
+                                               
change_side_controller(side_str, allies[i]->current_player(), false /*not our 
own side*/);
                                        } else {
                                                
teams_[side_index].make_human_ai();
                                                
teams_[side_index].set_current_player("ai"+side_str);


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to