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


From: Jon Daniel
Subject: [Wesnoth-cvs-commits] wesnoth/src multiplayer_connect.cpp
Date: Fri, 04 Feb 2005 18:43:27 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Jon Daniel <address@hidden>     05/02/04 23:43:27

Modified files:
        src            : multiplayer_connect.cpp 

Log message:
        Fixed bug that causes a sides leader info not to be set if a client 
joins with a random leader but a non-random faction and the host doesn't change 
the clients faction throuh a combo.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.100&tr2=1.101&r1=text&r2=text

Patches:
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.100 
wesnoth/src/multiplayer_connect.cpp:1.101
--- wesnoth/src/multiplayer_connect.cpp:1.100   Sun Jan 23 21:40:53 2005
+++ wesnoth/src/multiplayer_connect.cpp Fri Feb  4 23:43:26 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.100 2005/01/23 21:40:53 j_daniel Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.101 2005/02/04 23:43:26 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1009,7 +1009,22 @@
                                }
 
                                if(cfg["id"].empty() == false) {
-                                       pos->first->values["id"] = cfg["id"];
+                                       const config* const era_cfg = 
cfg_->find_child("era","id",era_);
+                                       const config::child_list& 
possible_sides = era_cfg->get_children("multiplayer_side");
+                                       const 
std::vector<std::string>::const_iterator itor = 
+                                               
std::find(possible_faction_ids_.begin(), possible_faction_ids_.end(), cfg["id"] 
);
+                                       if(itor == possible_faction_ids_.end()) 
{
+                                               ERR_CF << "client sent unknown 
faction id: " << cfg["id"] << "\n";
+                                       } else {
+                                               const int index = itor - 
possible_faction_ids_.begin();
+                                               const string_map& values = 
possible_sides[index]->values;
+                                               
pos->first->values["random_faction"] = "";
+                                               for(string_map::const_iterator 
i = values.begin(); i != values.end(); ++i) {
+                                                       LOG_CF << "value: " << 
i->first << " , " << i->second << std::endl;
+                                                       
pos->first->values[i->first] = i->second;
+                                               }
+                                               pos->first->values["id"] = 
cfg["id"];
+                                       }
                                }
 
                                if(cfg["name"].empty() == false) {




reply via email to

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