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: Philippe Plantier
Subject: [Wesnoth-cvs-commits] wesnoth/src multiplayer_connect.cpp
Date: Wed, 22 Sep 2004 15:59:11 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Philippe Plantier <address@hidden>      04/09/22 19:52:51

Modified files:
        src            : multiplayer_connect.cpp 

Log message:
        Fixed bug 10472: errors while selecting random leaders / random 
factions.

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

Patches:
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.71 
wesnoth/src/multiplayer_connect.cpp:1.72
--- wesnoth/src/multiplayer_connect.cpp:1.71    Tue Sep 21 20:35:48 2004
+++ wesnoth/src/multiplayer_connect.cpp Wed Sep 22 19:52:51 2004
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.71 2004/09/21 20:35:48 gruikya Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.72 2004/09/22 19:52:51 gruikya Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -233,6 +233,9 @@
                if(side["music"].empty())
                        side["music"] = (*possible_sides.front())["music"];
 
+               if(side["random_faction"].empty())
+                       side["random_faction"] = 
(*possible_sides.front())["random_faction"];
+
                if(side["terrain_liked"].empty())
                        side["terrain_liked"] = 
(*possible_sides.front())["terrain_liked"];
 
@@ -645,6 +648,7 @@
                old_select = combos_race_[n].selected();
                if(combos_race_[n].process(mousex, mousey, left_button)) {
                        const string_map& values =  
possible_sides[combos_race_[n].selected()]->values;
+                       side["random_faction"] = "";
                        for(string_map::const_iterator i = values.begin(); i != 
values.end(); ++i) {
                                std::cerr << "value: " << i->first << " , " << 
i->second<< std::endl;
                                side[i->first] = i->second;
@@ -726,13 +730,16 @@
 
                for(config::child_iterator side = sides.first; side != 
sides.second; ++side) {
                        int ntry = 0;
+                       //std::cerr << "Checking random faction for " << 
(**side)["name"] << ". Random faction is " << (**side)["random_faction"] << 
"\n";
                        while((**side)["random_faction"] == "yes" && ntry < 
1000) {
                                const int choice = rand()%real_sides.size();
 
                                (**side)["name"] = 
(*real_sides[choice])["name"];
+                               (**side)["random_faction"] = 
(*real_sides[choice])["random_faction"];
 
                                (**side)["type"] = "random";
 
+                               (**side)["leader"] = 
(*real_sides[choice])["leader"];
                                (**side)["recruit"] = 
(*real_sides[choice])["recruit"];
                                (**side)["music"] = 
(*real_sides[choice])["music"];
 
@@ -744,6 +751,7 @@
                        }
 
                        if ((**side)["type"] == "random" || 
(**side)["type"].empty()) {
+                               //std::cerr << "Choosing a random type for " << 
(**side)["name"] << "\n";
                                // Choose a random leader type.  
                                std::vector<std::string> types = 
                                        config::split((**side)["leader"]);
@@ -751,8 +759,10 @@
                                        const int lchoice = rand() % 
types.size();
                                        (**side)["type"] = types[lchoice];
                                } else {
-
+                                       lg::err(lg::config) << "Unable to find 
a type for side " << (**side)["name"] << "!\n";
                                }
+                               //std::cerr << "Leader chosen: " << 
(**side)["type"] << "\n";
+                               level_changed = true;
                        }
                }
 
@@ -988,6 +998,10 @@
                                        pos->first->values["music"] = 
cfg["music"];
                                }
 
+                               if(cfg["random_faction"].empty() == false) {
+                                       pos->first->values["random_faction"] = 
cfg["random_faction"];
+                               }
+
                                if(cfg["terrain_liked"].empty() == false) {
                                        pos->first->values["terrain_liked"] = 
cfg["terrain_liked"];
                                }




reply via email to

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