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

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

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


From: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src multiplayer_connect.cpp multiplayer...
Date: Sat, 02 Apr 2005 05:36:13 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      05/04/02 10:36:13

Modified files:
        src            : multiplayer_connect.cpp multiplayer_connect.hpp 

Log message:
        Fixed a bug where MP savegames could not be correctly loaded when made 
by the
        game client, because of the host-side era changes (CVS internal.)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.138&tr2=1.139&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.hpp.diff?tr1=1.35&tr2=1.36&r1=text&r2=text

Patches:
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.138 
wesnoth/src/multiplayer_connect.cpp:1.139
--- wesnoth/src/multiplayer_connect.cpp:1.138   Wed Mar 30 20:03:03 2005
+++ wesnoth/src/multiplayer_connect.cpp Sat Apr  2 10:36:12 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.138 2005/03/30 20:03:03 gruikya Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.139 2005/04/02 10:36:12 gruikya Exp $ */
 /*
    Copyright (C) 
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -282,7 +282,7 @@
 
        // If the user is allowed to change type, faction, leader etc, then
        // import their new values in the config.
-       if(enabled_) {
+       if(enabled_ && !parent_->era_sides_.empty()) {
                // Merge the faction data to res
                res.append(*(parent_->era_sides_[faction_]));
        }
@@ -432,6 +432,9 @@
 
 void connect::side::resolve_random()
 {
+       if(!enabled_ || parent_->era_sides_.empty())
+               return;
+
        if((*parent_->era_sides_[faction_])["random_faction"] == "yes") {
 
                // Builds the list of sides which aren't random
@@ -819,19 +822,10 @@
        player_types_.push_back(_("Computer Player"));
        player_types_.push_back(_("Empty"));
 
-       const config* const era_cfg = game_config().find_child("era","id",era_);
-       if(era_cfg == NULL) {
-               throw config::error(_("Era not available: ") + era_);
-       }
-
-       era_sides_ = era_cfg->get_children("multiplayer_side");
-       level_.add_child("era", *era_cfg);
-
        for(std::vector<config*>::const_iterator faction = era_sides_.begin(); 
faction != era_sides_.end(); ++faction) {
                player_factions_.push_back((**faction)["name"]);
        }
 
-
        //Factions
        const config::child_itors sides = level_.child_range("side");
 
@@ -922,28 +916,23 @@
                        level_.clear_children("replay");
                        level_.add_child("replay") = state_.replay_data;
                }
-
-               // Gets the era from the era of the savegame
-               era_ = level_["era"];
-               if(era_.empty())
-                       era_ = params_.era;
-
        } else {
                level_ = params_.scenario_data;
                level_["turns"] = 
lexical_cast_default<std::string>(params_.num_turns, "20");
 
-               era_ = params_.era;
-               level_["era"] = era_;
-       }
-       
-       // Initialize the list of sides available for the current era.
-       const config* const era_cfg = game_config().find_child("era","id",era_);
-       if(era_cfg == NULL) {
-               utils::string_map i18n_symbols;
-               i18n_symbols["era"] = era_;
-               throw config::error(vgettext("Cannot find era $era", 
i18n_symbols));
+               // Gets the era from the era of the savegame
+               const std::string& era = params_.era;
+
+               // Initialize the list of sides available for the current era.
+               const config* const era_cfg = game_config().find_child("era", 
"id", era);
+               if(era_cfg == NULL) {
+                       utils::string_map i18n_symbols;
+                       i18n_symbols["era"] = era;
+                       throw config::error(vgettext("Cannot find era $era", 
i18n_symbols));
+               }
+               era_sides_ = era_cfg->get_children("multiplayer_side");
+               level_.add_child("era", *era_cfg);
        }
-       era_sides_ = era_cfg->get_children("multiplayer_side");
 
        //this will force connecting clients to be using the same version 
number as us.
        level_["version"] = game_config::version;
Index: wesnoth/src/multiplayer_connect.hpp
diff -u wesnoth/src/multiplayer_connect.hpp:1.35 
wesnoth/src/multiplayer_connect.hpp:1.36
--- wesnoth/src/multiplayer_connect.hpp:1.35    Sat Mar 19 17:33:32 2005
+++ wesnoth/src/multiplayer_connect.hpp Sat Apr  2 10:36:12 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.hpp,v 1.35 2005/03/19 17:33:32 gruikya Exp $ */
+/* $Id: multiplayer_connect.hpp,v 1.36 2005/04/02 10:36:12 gruikya Exp $ */
 /*
    Copyright (C) 
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -200,9 +200,6 @@
        // "level" object
        game_state state_;
 
-       // The era used for factions
-       std::string era_;
-
        // The list of available sides for the current era
        config::child_list era_sides_;
 




reply via email to

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