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: Guillaume Melquiond
Subject: [Wesnoth-cvs-commits] wesnoth/src multiplayer_client.cpp multiplayer_...
Date: Fri, 10 Dec 2004 15:13:51 -0500

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Guillaume Melquiond <address@hidden>    04/12/10 20:03:12

Modified files:
        src            : multiplayer_client.cpp multiplayer_lobby.cpp 

Log message:
        Fix some remaining hardcoded commas in the multiplayer code.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_client.cpp.diff?tr1=1.79&tr2=1.80&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.52&tr2=1.53&r1=text&r2=text

Patches:
Index: wesnoth/src/multiplayer_client.cpp
diff -u wesnoth/src/multiplayer_client.cpp:1.79 
wesnoth/src/multiplayer_client.cpp:1.80
--- wesnoth/src/multiplayer_client.cpp:1.79     Thu Nov 25 23:10:08 2004
+++ wesnoth/src/multiplayer_client.cpp  Fri Dec 10 20:03:12 2004
@@ -112,18 +112,19 @@
                                // Dumps the "image" part of the faction name, 
if any,
                                // to replace it by a picture of the actual 
leader
                                if(side_name[0] == font::IMAGE) {
-                                       int p = side_name.find_first_of(",");
+                                       int p = 
side_name.find_first_of(COLUMN_SEPARATOR);
                                        if(p != std::string::npos && p < 
side_name.size()) {
-                                               side_name = "&" + leader_image 
+ "," + side_name.substr(p+1);
+                                               side_name = IMAGE_PREFIX + 
leader_image + COLUMN_SEPARATOR + side_name.substr(p+1);
                                        }
                                }
                        }
 
                        std::stringstream str;
-                       str << description << "," << side_name << ",";
+                       str << description << COLUMN_SEPARATOR << side_name << 
COLUMN_SEPARATOR;
                        if(!leader_name.empty())
                                str << "(" << leader_name << ")";
-                       str << "," << sd["gold"] << " " << 
sgettext("unit^Gold") << "," << sd["team_name"];
+                       str << COLUMN_SEPARATOR << sd["gold"] << ' ' << 
sgettext("unit^Gold")
+                           << COLUMN_SEPARATOR << sd["team_name"];
                        details.push_back(str.str());
                }
 
@@ -651,7 +652,7 @@
                        const std::string name =  
utypes.find(*itor)->second.language_name();
                        const std::string image = 
utypes.find(*itor)->second.image();
 
-                       leader_strings.push_back("&" + image + "," + name);
+                       leader_strings.push_back(IMAGE_PREFIX + image + 
COLUMN_SEPARATOR + name);
                } else {
                        leader_strings.push_back("?");
                }
@@ -659,7 +660,8 @@
 
        leaders_.push_back("random");
        // FIXME: Maybe this should not code into the code.
-       leader_strings.push_back(_("&random-enemy.png,Random"));
+       leader_strings.push_back(IMAGE_PREFIX + std::string("random-enemy.png") 
+
+                                COLUMN_SEPARATOR + _("Random"));
 
        if(combo_ != NULL) {
                combo_->set_items(leader_strings);
@@ -735,7 +737,7 @@
                std::ostringstream recruit_string;
 
                if(faction[0] == font::IMAGE) {
-                       int p = faction.find_first_of(",");
+                       int p = faction.find_first_of(COLUMN_SEPARATOR);
                        if(p != std::string::npos && p < faction.size())
                                faction = faction.substr(p+1);
                }
Index: wesnoth/src/multiplayer_lobby.cpp
diff -u wesnoth/src/multiplayer_lobby.cpp:1.52 
wesnoth/src/multiplayer_lobby.cpp:1.53
--- wesnoth/src/multiplayer_lobby.cpp:1.52      Sat Nov 27 10:53:22 2004
+++ wesnoth/src/multiplayer_lobby.cpp   Fri Dec 10 20:03:12 2004
@@ -12,11 +12,11 @@
 #include "network.hpp"
 #include "preferences.hpp"
 #include "show_dialog.hpp"
-#include "sound.hpp"
 #include "statistics.hpp"
-#include "widgets/textbox.hpp"
+#include "sound.hpp"
 #include "widgets/button.hpp"
 #include "widgets/menu.hpp"
+#include "widgets/textbox.hpp"
 
 #include "SDL.h"
 
@@ -106,7 +106,7 @@
        
                                //if this is the item that should be selected, 
make it selected by default
                                if(game_selection-- == 0) {
-                                       str << "*";
+                                       str << DEFAULT_ITEM;
                                }
        
                                std::string map_data = (**i.first)["map_data"];
@@ -125,12 +125,12 @@
        
                                                image::register_image(buf,mini);
        
-                                               str << "&" << buf << ",";
+                                               str << IMAGE_PREFIX << buf << 
COLUMN_SEPARATOR;
                                        } 
catch(gamemap::incorrect_format_exception& e) {
                                                std::cerr << "illegal map: " << 
e.msg_ << "\n";
                                        }
                                } else {
-                                       str << "(" << _("Shroud") << "),";
+                                       str << '(' << _("Shroud") << ')' << 
COLUMN_SEPARATOR;
                                }
        
                                std::string name = (**i.first)["name"];
@@ -141,10 +141,11 @@
        
                                const std::string& turn = (**i.first)["turn"];
                                const std::string& slots = (**i.first)["slots"];
-                               if(turn != "") {
-                                       str << "," << _("Turn") << " " << turn;
-                               } else if(slots != "") {
-                                       str << "," << slots << " " << 
gettext(slots == "1" ? N_("Vacant Slot") : N_("Vacant Slots"));
+                               if (!turn.empty()) {
+                                       str << COLUMN_SEPARATOR << _("Turn") << 
' ' << turn;
+                               } else if(!slots.empty()) {
+                                       str << COLUMN_SEPARATOR << slots << ' '
+                                           << gettext(slots == "1" ? 
N_("Vacant Slot") : N_("Vacant Slots"));
                                }
        
                                options.push_back(str.str());
@@ -196,7 +197,7 @@
 
                        //if this user should be selected
                        if(user_selection-- == 0) {
-                               name.insert(name.begin(),'*');
+                               name.insert(name.begin(), DEFAULT_ITEM);
                        }
 
                        users.push_back(name);




reply via email to

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