mail[Wesnoth-commits] r33900 - /trunk/src/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on March 20, 2009 - 08:08:
Author: silene
Date: Fri Mar 20 08:08:24 2009
New Revision: 33900

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33900&view=rev
Log:
Removed config::values.

Modified:
    trunk/src/cavegen.cpp
    trunk/src/gamestatus.cpp
    trunk/src/multiplayer_connect.cpp
    trunk/src/multiplayer_create.cpp
    trunk/src/multiplayer_wait.cpp
    trunk/src/network.cpp
    trunk/src/playcampaign.cpp
    trunk/src/playturn.cpp
    trunk/src/preferences.cpp
    trunk/src/replay.cpp
    trunk/src/theme.cpp
    trunk/src/variable.cpp

Modified: trunk/src/cavegen.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/cavegen.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/cavegen.cpp (original)
+++ trunk/src/cavegen.cpp Fri Mar 20 08:08:24 2009
@@ -254,7 +254,7 @@
 
                char xbuf[50];
                snprintf(xbuf,sizeof(xbuf),"%d",loc->x+1);
-               cfg.values["x"] = xbuf;
+               cfg["x"] = xbuf;
                if(filter != NULL) {
                        (*filter)["x"] = xbuf;
                }
@@ -265,7 +265,7 @@
 
                char ybuf[50];
                snprintf(ybuf,sizeof(ybuf),"%d",loc->y+1);
-               cfg.values["y"] = ybuf;
+               cfg["y"] = ybuf;
                if(filter != NULL) {
                        (*filter)["y"] = ybuf;
                }

Modified: trunk/src/gamestatus.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Fri Mar 20 08:08:24 2009
@@ -1218,7 +1218,7 @@
                to_clear.vars->remove_child(to_clear.key, to_clear.index);
        } else {
                to_clear.vars->clear_children(to_clear.key);
-               to_clear.vars->values.erase(to_clear.key);
+               to_clear.vars->remove_attribute(to_clear.key);
        }
 }
 

Modified: trunk/src/multiplayer_connect.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_connect.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/multiplayer_connect.cpp (original)
+++ trunk/src/multiplayer_connect.cpp Fri Mar 20 08:08:24 2009
@@ -1190,7 +1190,7 @@
                const std::string name = data["name"];
                if(name.empty()) {
                        config response;
-                       response.values["failed"] = "yes";
+                       response["failed"] = "yes";
                        network::send_data(response, sock, true);
                        ERR_CF << "ERROR: No username provided with the 
side.\n";
                        return;
@@ -1204,14 +1204,14 @@
                         */
                        if(find_player_side(name) != -1) {
                                config response;
-                               response.values["failed"] = "yes";
+                               response["failed"] = "yes";
                                response["message"] = "The nick '" + name + 
"' is already in use.";
                                network::send_data(response, sock, true);
                                return;
                        } else {
                                users_.erase(player);
                                config observer_quit;
-                               
observer_quit.add_child("observer_quit").values["name"] = name;
+                               
observer_quit.add_child("observer_quit")["name"] = name;
                                network::send_data(observer_quit, 0, true);
                                update_user_combos();
                        }
@@ -1232,7 +1232,7 @@
 
                                if(itor == sides_.end()) {
                                        config response;
-                                       response.values["failed"] = "yes";
+                                       response["failed"] = "yes";
                                        network::send_data(response, sock, 
true);
                                        config kick;
                                        kick["username"] = data["name"];
@@ -1266,7 +1266,7 @@
                } else {
                        ERR_CF << "tried to take illegal side: " << 
side_taken << '\n';
                        config response;
-                       response.values["failed"] = "yes";
+                       response["failed"] = "yes";
                        network::send_data(response, sock, true);
                }
        }

Modified: trunk/src/multiplayer_create.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_create.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/multiplayer_create.cpp (original)
+++ trunk/src/multiplayer_create.cpp Fri Mar 20 08:08:24 2009
@@ -117,8 +117,7 @@
        i = 0;
        for(config::child_list::const_iterator j = levels.begin(); j != 
levels.end(); ++j, ++i)
        {
-               if ( ((*j)->values.find("allow_new_game") == 
(*j)->values.end())
-                       || utils::string_bool((**j)["allow_new_game"],true))
+               if (utils::string_bool((**j)["allow_new_game"], true))
                {
                        menu_help_str = help_sep + ((**j)["name"]);
                        map_options_.push_back(((**j)["name"]) + 
menu_help_str);

Modified: trunk/src/multiplayer_wait.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_wait.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/multiplayer_wait.cpp (original)
+++ trunk/src/multiplayer_wait.cpp Fri Mar 20 08:08:24 2009
@@ -204,7 +204,7 @@
        //if we have got valid side data
        //the first condition is to make sure that we don't have another
        //WML message with a side-tag in it
-       while((level_.values.find("version") == level_.values.end()) || 
(level_.child("side") == NULL)) {
+       while (!level_.has_attribute("version") || !level_.child("side")) {
                network::connection data_res = 
dialogs::network_receive_dialog(disp(),
                                _("Getting game data..."), level_);
                if (!data_res) {

Modified: trunk/src/network.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/network.cpp (original)
+++ trunk/src/network.cpp Fri Mar 20 08:08:24 2009
@@ -766,8 +766,7 @@
        waiting_sockets.insert(result);
        if(!is_server()) {
                const time_t& now = time(NULL);
-               const string_map::const_iterator ping = 
cfg.values.find("ping");
-               if (ping != cfg.values.end()) {
+               if (cfg.has_attribute("ping")) {
                        LOG_NW << "Lag: " << (now - 
lexical_cast<time_t>(cfg["ping"])) << "\n";
                        last_ping = now;
                } else if (last_ping != 0) {

Modified: trunk/src/playcampaign.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playcampaign.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/playcampaign.cpp (original)
+++ trunk/src/playcampaign.cpp Fri Mar 20 08:08:24 2009
@@ -361,7 +361,7 @@
                                // it will not ask for the map to be 
generated again on reload
                                static config new_level;
                                new_level = *scenario;
-                               new_level.values["map_data"] = map_data;
+                               new_level["map_data"] = map_data;
                                scenario = &new_level;
 
                                gamestate.starting_pos = new_level;
@@ -538,7 +538,7 @@
                                        // it will not ask for the map to be 
generated again on reload
                                        static config new_level;
                                        new_level = *scenario;
-                                       new_level.values["map_data"] = 
map_data;
+                                       new_level["map_data"] = map_data;
                                        scenario = &new_level;
 
                                        gamestate.starting_pos = new_level;

Modified: trunk/src/playturn.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playturn.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/playturn.cpp (original)
+++ trunk/src/playturn.cpp Fri Mar 20 08:08:24 2009
@@ -340,9 +340,9 @@
 void turn_info::take_side(const std::string& side, const std::string& 
controller)
 {
        config cfg;
-       cfg.values["side"] = side;
-       cfg.values["controller"] = controller;
-       cfg.values["name"] = controller+side;
+       cfg["side"] = side;
+       cfg["controller"] = controller;
+       cfg["name"] = controller+side;
        network::send_data(cfg, 0, true);
 }
 #endif

Modified: trunk/src/preferences.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/preferences.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/preferences.cpp (original)
+++ trunk/src/preferences.cpp Fri Mar 20 08:08:24 2009
@@ -114,7 +114,7 @@
 }
 
 void erase(const std::string& key) {
-       prefs.values.erase(key);
+       prefs.remove_attribute(key);
 }
 
 std::string get(const std::string& key) {
@@ -186,12 +186,10 @@
 std::pair<int,int> resolution()
 {
        const std::string postfix = fullscreen() ? "resolution" : 
"windowsize";
-       const string_map::const_iterator x = prefs.values.find('x' + postfix);
-       const string_map::const_iterator y = prefs.values.find('y' + postfix);
-       if(x != prefs.values.end() && y != prefs.values.end() &&
-          x->second.empty() == false && y->second.empty() == false) {
-               std::pair<int,int> res 
(std::max(atoi(x->second.c_str()),min_allowed_width()),
-                                       
std::max(atoi(y->second.c_str()),min_allowed_height()));
+       std::string x = prefs['x' + postfix], y = prefs['y' + postfix];
+       if (!x.empty() && !y.empty()) {
+               std::pair<int,int> res(std::max(atoi(x.c_str()), 
min_allowed_width()),
+                                      std::max(atoi(y.c_str()), 
min_allowed_height()));
 
                // Make sure resolutions are always divisible by 4
                //res.first &= ~3;
@@ -592,7 +590,7 @@
        if (alias_list == NULL) {
                alias_list = &(prefs.add_child("alias"));
        }
-       alias_list->values[alias] = command;
+       (*alias_list)[alias] = command;
 }
 
 

Modified: trunk/src/replay.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Fri Mar 20 08:08:24 2009
@@ -322,9 +322,10 @@
        add_pos("attack",a,b);
        char buf[100];
        snprintf(buf,sizeof(buf),"%d",att_weapon);
-       current_->child("attack")->values["weapon"] = buf;
+       config &cfg = *current_->child("attack");
+       cfg["weapon"] = buf;
        snprintf(buf,sizeof(buf),"%d",def_weapon);
-       current_->child("attack")->values["defender_weapon"] = buf;
+       cfg["defender_weapon"] = buf;
        add_unit_checksum(a,current_);
        add_unit_checksum(b,current_);
 }

Modified: trunk/src/theme.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/theme.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/theme.cpp (original)
+++ trunk/src/theme.cpp Fri Mar 20 08:08:24 2009
@@ -183,7 +183,7 @@
                        while(!parent_stack.empty()) {
                                //override attributes
                                for(string_map::const_iterator j = 
parent_stack.back()->values.begin(); j != parent_stack.back()->values.end(); 
++j) {
-                                       res_cfgs_.back().values[j->first] = 
j->second;
+                                       res_cfgs_.back()[j->first] = 
j->second;
                                }
 
                                foreach (const config &rm, 
parent_stack.back()->child_range("remove")) {
@@ -238,7 +238,7 @@
 
                // copy all key/values
                for(string_map::const_iterator j = cfg.values.begin(); j != 
cfg.values.end(); ++j) {
-                       resolved_config.values[j->first] = j->second;
+                       resolved_config[j->first] = j->second;
                }
 
                // override default reference rect with "ref" parameter if any
@@ -261,7 +261,7 @@
                }
                // resolve the rect value to absolute coordinates
                if (!cfg["rect"].empty()) {
-                       resolved_config.values["rect"] = 
resolve_rect(cfg["rect"]);
+                       resolved_config["rect"] = resolve_rect(cfg["rect"]);
                }
        }
 

Modified: trunk/src/variable.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.cpp?rev=33900&r1=33899&r2=33900&view=diff
==============================================================================
--- trunk/src/variable.cpp (original)
+++ trunk/src/variable.cpp Fri Mar 20 08:08:24 2009
@@ -717,7 +717,7 @@
 
 t_string& variable_info::as_scalar() {
        assert(is_valid);
-       return vars->values[key];
+       return (*vars)[key];
 }
 
 config& variable_info::as_container() {




Related Messages


Powered by MHonArc, Updated Fri Mar 20 08:20:30 2009