wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src game.cpp multiplayer.cpp multiplaye...


From: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src game.cpp multiplayer.cpp multiplaye...
Date: Sat, 16 Oct 2004 15:05:05 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/10/16 18:57:56

Modified files:
        src            : game.cpp multiplayer.cpp multiplayer_client.cpp 
                         multiplayer_connect.cpp 

Log message:
        An attempt at fixing some multiplayer bugs. Unfortunately I don't 
understand at all the way the multiplayer code is layered; so please revert if 
it resets too much the player state.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.147&tr2=1.148&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.122&tr2=1.123&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_client.cpp.diff?tr1=1.70&tr2=1.71&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.79&tr2=1.80&r1=text&r2=text

Patches:
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.147 wesnoth/src/game.cpp:1.148
--- wesnoth/src/game.cpp:1.147  Thu Oct 14 09:27:22 2004
+++ wesnoth/src/game.cpp        Sat Oct 16 18:57:55 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.147 2004/10/14 09:27:22 gakusho Exp $ */
+/* $Id: game.cpp,v 1.148 2004/10/16 18:57:55 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -888,6 +888,7 @@
 
 void game_controller::set_tutorial()
 {
+       state_ = game_state();
        state_.campaign_type = "tutorial";
        state_.scenario = "tutorial";
        defines_map_["TUTORIAL"] = preproc_define();
@@ -896,7 +897,6 @@
 bool game_controller::new_campaign()
 {
        state_ = game_state();
-
        state_.campaign_type = "scenario";
 
        config::child_list campaigns = game_config_.get_children("campaign");
@@ -1181,8 +1181,8 @@
 
 bool game_controller::play_multiplayer()
 {
+       state_ = game_state();
        state_.campaign_type = "multiplayer";
-       state_.scenario = "";
        state_.campaign_define = "MULTIPLAYER";
 
        std::vector<std::string> host_or_join;
Index: wesnoth/src/multiplayer.cpp
diff -u wesnoth/src/multiplayer.cpp:1.122 wesnoth/src/multiplayer.cpp:1.123
--- wesnoth/src/multiplayer.cpp:1.122   Sat Oct  9 21:14:47 2004
+++ wesnoth/src/multiplayer.cpp Sat Oct 16 18:57:55 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.cpp,v 1.122 2004/10/09 21:14:47 Sirp Exp $ */
+/* $Id: multiplayer.cpp,v 1.123 2004/10/16 18:57:55 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -64,11 +64,7 @@
 {
        std::cerr << "setup dialog ctor\n";
 
-       for(std::map<std::string, player_info>::iterator i = 
state_.players.begin();
-           i != state_.players.end(); ++i) {
-               i->second.available_units.clear();
-               i->second.can_recruit.clear();
-       }
+       state_.players.clear();
        state_.variables.clear();
 
        //build the list of scenarios to play
Index: wesnoth/src/multiplayer_client.cpp
diff -u wesnoth/src/multiplayer_client.cpp:1.70 
wesnoth/src/multiplayer_client.cpp:1.71
--- wesnoth/src/multiplayer_client.cpp:1.70     Mon Oct 11 23:46:39 2004
+++ wesnoth/src/multiplayer_client.cpp  Sat Oct 16 18:57:55 2004
@@ -565,11 +565,7 @@
 
                state.starting_pos = sides;
                state.snapshot = sides;
-
-                for(std::map<std::string, player_info>::iterator 
i=state.players.begin();
-                    i!=state.players.end(); ++i) {
-                  i->second.can_recruit.clear();
-                }
+               state.players.clear();
     
                recorder.set_save_info(state);
     
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.79 
wesnoth/src/multiplayer_connect.cpp:1.80
--- wesnoth/src/multiplayer_connect.cpp:1.79    Sat Oct  9 21:14:47 2004
+++ wesnoth/src/multiplayer_connect.cpp Sat Oct 16 18:57:55 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.79 2004/10/09 21:14:47 Sirp Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.80 2004/10/16 18:57:55 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -85,13 +85,9 @@
 
                log_scope("loading save");
 
+               state_->players.clear();
                load_game(*data_, game, *state_);
 
-               for(std::map<std::string, player_info>::iterator i = 
state_->players.begin(); i != state_->players.end(); ++i) {
-                       i->second.available_units.clear();
-                       i->second.can_recruit.clear();
-               }
-
                if(state_->campaign_type != "multiplayer") {
                        gui::show_dialog(*disp_, NULL, "", 
                                         _("This is not a multiplayer save"),
@@ -160,10 +156,7 @@
 
        level_ = level_ptr;
        state_->label = level_->values["name"];
-
-       for(std::map<std::string, player_info>::iterator i = 
state_->players.begin(); i != state_->players.end(); ++i) {
-               i->second.gold = -10000;
-       }
+       state_->players.clear();
 
        state_->scenario = scenario_data["id"];
 
@@ -857,9 +850,7 @@
        //it was just there to tell clients about the replay data
        level_->clear_children("replay");
        std::vector<config*> story;
-       for(std::map<std::string, player_info>::iterator i = 
state_->players.begin(); i != state_->players.end(); ++i) {
-               i->second.can_recruit.clear();
-       }
+       state_->players.clear();
 
        play_level(*data_, *cfg_, level_, disp_->video(), *state_, story);
        recorder.clear();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]