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_client.cpp multiplayer_...


From: Isaac Clerencia
Subject: [Wesnoth-cvs-commits] wesnoth/src multiplayer_client.cpp multiplayer_...
Date: Tue, 18 Jan 2005 07:25:22 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Isaac Clerencia <address@hidden>        05/01/18 12:25:22

Modified files:
        src            : multiplayer_client.cpp multiplayer_connect.cpp 
                         multiplayer_connect.hpp 

Log message:
        Commit forcemstr patch #3654,
        http://savannah.nongnu.org/patch/?func=detailitem&item_id=3654

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_client.cpp.diff?tr1=1.82&tr2=1.83&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.96&tr2=1.97&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.hpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text

Patches:
Index: wesnoth/src/multiplayer_client.cpp
diff -u wesnoth/src/multiplayer_client.cpp:1.82 
wesnoth/src/multiplayer_client.cpp:1.83
--- wesnoth/src/multiplayer_client.cpp:1.82     Fri Dec 31 21:01:37 2004
+++ wesnoth/src/multiplayer_client.cpp  Tue Jan 18 12:25:21 2005
@@ -72,11 +72,13 @@
 class wait_for_start : public lobby::dialog
 {
 public:
-       wait_for_start(display& disp, config& cfg, const game_data& data, int 
team_num,
-                       const std::string& team_name, const std::string& 
team_leader)
+       wait_for_start(display& disp, const config& game_config, config& cfg,
+                       const game_data& data, int team_num, const std::string& 
team_name,
+                       const std::string& team_leader)
                : status(START_GAME), got_side(false), team(team_num),
-                 name(team_name), leader(team_leader), disp_(disp), 
sides_(cfg),
-                 units_data_(data), cancel_button_(NULL), menu_(NULL)
+                 name(team_name), leader(team_leader), disp_(disp),
+                 game_config_(game_config), sides_(cfg), units_data_(data),
+                 cancel_button_(NULL), menu_(NULL)
        {
                SDL_Rect empty_rect = {0,0,0,0};
                area_ = empty_rect;
@@ -89,13 +91,14 @@
                }
 
                std::vector<std::string> details;
+               const config* const era_cfg = 
game_config_.find_child("era","id",sides_["era"]);
 
                const config::child_list& sides = sides_.get_children("side");
                for(config::child_list::const_iterator s = sides.begin(); s != 
sides.end(); ++s) {
                        const config& sd = **s;
 
                        std::string description = sd["description"];
-                       std::string side_name = sd["name"];
+                       std::string side_name = 
(*(era_cfg->find_child("multiplayer_side", "id", sd["id"])))["name"];
                        std::string leader_type = sd["type"];
 
                        if(first && (s - sides.begin() == size_t(team-1))) {
@@ -224,7 +227,7 @@
        display& disp_;
        config& sides_;
        const game_data& units_data_;
-
+       const config& game_config_;
        util::scoped_ptr<gui::button> cancel_button_;
        util::scoped_ptr<gui::menu> menu_;
        std::deque<config> data_;
@@ -489,6 +492,7 @@
                        wassert(choice < possible_sides.size());
 
                        const config& chosen_side = *possible_sides[choice];
+                       response["id"] = chosen_side["id"];
                        team_name = response["name"] = chosen_side["name"];
                        if(leader.empty()) {
                                team_leader = response["type"] = 
chosen_side["type"];
@@ -502,7 +506,7 @@
                        network::send_data(response);
                }
     
-               wait_for_start 
waiter(disp,sides,units_data,team_num,team_name,team_leader);
+               wait_for_start 
waiter(disp,cfg,sides,units_data,team_num,team_name,team_leader);
                std::vector<std::string> messages;
                config game_data;
                lobby::RESULT dialog_res = lobby::CONTINUE;
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.96 
wesnoth/src/multiplayer_connect.cpp:1.97
--- wesnoth/src/multiplayer_connect.cpp:1.96    Wed Jan 12 23:03:49 2005
+++ wesnoth/src/multiplayer_connect.cpp Tue Jan 18 12:25:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.96 2005/01/12 23:03:49 silene Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.97 2005/01/18 12:25:21 isaaccp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -218,6 +218,9 @@
                if(side["share_view"].empty())
                        side["share_view"] = share_view ? "yes" : "no";
 
+               if(side["id"].empty())
+                       side["id"] = (*possible_sides.front())["id"];
+
                if(side["name"].empty())
                        side["name"] = (*possible_sides.front())["name"];
 
@@ -282,6 +285,7 @@
 
        for(std::vector<config*>::const_iterator race = possible_sides.begin(); 
race != possible_sides.end(); ++race) {
                player_races_.push_back((**race)["name"]);
+               possible_faction_ids_.push_back((**race)["id"]);
        }
 
        //Teams
@@ -515,6 +519,7 @@
        combos_color_.clear();
        sliders_gold_.clear();
        labels_gold_.clear();
+       possible_faction_ids_.clear();
 
        ai_.hide();
        launch_.hide();
@@ -572,7 +577,7 @@
 
                //Player Faction
                for (size_t m = 0; m != player_races_.size(); ++m) {
-                       if (side["name"] == player_races_[m]) {
+                       if (side["id"] == possible_faction_ids_[m]) {
                                if (combos_race_[n].selected() != m) {
                                        combos_race_[n].set_selected(m);
 
@@ -751,6 +756,7 @@
                        while((**side)["random_faction"] == "yes" && ntry < 
1000) {
                                const int choice = rand()%real_sides.size();
 
+                               (**side)["id"] = (*real_sides[choice])["id"];
                                (**side)["name"] = 
(*real_sides[choice])["name"];
                                (**side)["random_faction"] = 
(*real_sides[choice])["random_faction"];
 
@@ -987,6 +993,10 @@
                                        pos->first->values["description"] = 
cfg["description"];
                                }
 
+                               if(cfg["id"].empty() == false) {
+                                       pos->first->values["id"] = cfg["id"];
+                               }
+
                                if(cfg["name"].empty() == false) {
                                        pos->first->values["name"] = 
cfg["name"];
                                }
Index: wesnoth/src/multiplayer_connect.hpp
diff -u wesnoth/src/multiplayer_connect.hpp:1.22 
wesnoth/src/multiplayer_connect.hpp:1.23
--- wesnoth/src/multiplayer_connect.hpp:1.22    Wed Jan 12 21:08:21 2005
+++ wesnoth/src/multiplayer_connect.hpp Tue Jan 18 12:25:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.hpp,v 1.22 2005/01/12 21:08:21 silene Exp $ */
+/* $Id: multiplayer_connect.hpp,v 1.23 2005/01/18 12:25:21 isaaccp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -91,6 +91,7 @@
 
        //std::vector<std::vector<std::string> > player_leaders_;
        std::vector<leader_list_manager> player_leaders_;
+       std::vector<std::string> possible_faction_ids_;
 
        std::vector<std::string> team_names_;
        std::vector<int> team_indices_;




reply via email to

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