Author: alink
Date: Tue Jul  8 23:11:21 2008
New Revision: 27856

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27856&view=rev
Log:
Simplify some code, I will probably generalize this get_RC_suffix() elsewhere,
seems nicer that using these "#idef LOWMEM" everywhere

Modified:
    trunk/src/leader_list.cpp
    trunk/src/leader_list.hpp

Modified: trunk/src/leader_list.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/leader_list.cpp?rev=27856&r1=27855&r2=27856&view=diff
==============================================================================
--- trunk/src/leader_list.cpp (original)
+++ trunk/src/leader_list.cpp Tue Jul  8 23:11:21 2008
@@ -143,23 +143,14 @@
                        utg = &(ut->get_gender_unit_type(*i));
 
                        // Make the internationalized titles for each gender, 
along with the WML ids
-                       if (*i == unit_race::FEMALE)
-                       {
+                       if (*i == unit_race::FEMALE) {
                                gender_ids_.push_back("female");
-#ifdef LOW_MEM
-                               genders_.push_back(IMAGE_PREFIX + utg->image() 
+ COLUMN_SEPARATOR + _("Female ♀"));
-#else
-                               genders_.push_back(IMAGE_PREFIX + utg->image() 
+ get_RC_string(utg->flag_rgb()) + COLUMN_SEPARATOR + _("Female ♀"));
-#endif
-                       }
-                       else
-                       {
+                               genders_.push_back(IMAGE_PREFIX + utg->image() 
+ get_RC_suffix(utg->flag_rgb()) +
+                                               COLUMN_SEPARATOR + _("Female 
♀"));
+                       } else {
                                gender_ids_.push_back("male");
-#ifdef LOW_MEM
-                               genders_.push_back(IMAGE_PREFIX + utg->image() 
+ COLUMN_SEPARATOR + _("Male ♂"));
-#else
-                               genders_.push_back(IMAGE_PREFIX + utg->image() 
+ get_RC_string(utg->flag_rgb()) + COLUMN_SEPARATOR + _("Male ♂"));
-#endif
+                               genders_.push_back(IMAGE_PREFIX + utg->image() 
+ get_RC_suffix(utg->flag_rgb()) +
+                                               COLUMN_SEPARATOR + _("Male 
♂"));
                        }
                }
                if (gender_combo_ != NULL) {
@@ -198,12 +189,8 @@
                        }
                        const std::string name =  ut->type_name();
                        const std::string image = ut->image();
-
-#ifdef LOW_MEM
-                       leader_strings.push_back(IMAGE_PREFIX + image + 
COLUMN_SEPARATOR + name);
-#else
-                       leader_strings.push_back(IMAGE_PREFIX + image + 
get_RC_string(ut->flag_rgb()) + COLUMN_SEPARATOR + name);
-#endif
+                       leader_strings.push_back(IMAGE_PREFIX + image + 
get_RC_suffix(ut->flag_rgb()) + COLUMN_SEPARATOR + name);
+
                } else {
                        if(*itor == "random") {
                                leader_strings.push_back(IMAGE_PREFIX + 
random_enemy_picture + COLUMN_SEPARATOR + _("Random"));
@@ -272,6 +259,10 @@
        return gender_ids_[gender_combo_->selected()];
 }
 
-std::string leader_list_manager::get_RC_string(const std::string& unit_colour) 
const {
+std::string leader_list_manager::get_RC_suffix(const std::string& unit_colour) 
const {
+#ifdef LOW_MEM
+       return ""
+#else
        return "~RC("+unit_colour+">"+lexical_cast<std::string>(colour_+1) +")";
+#endif
 }

Modified: trunk/src/leader_list.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/leader_list.hpp?rev=27856&r1=27855&r2=27856&view=diff
==============================================================================
--- trunk/src/leader_list.hpp (original)
+++ trunk/src/leader_list.hpp Tue Jul  8 23:11:21 2008
@@ -41,7 +41,7 @@
        void set_leader(const std::string& leader);
        void set_gender(const std::string& gender);
        void set_colour(int colour) {colour_ = colour;};
-       std::string get_RC_string(const std::string& unit_colour) const;
+       std::string get_RC_suffix(const std::string& unit_colour) const;
 
 private:
        void populate_leader_combo(int selected_index);


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to