Author: esr
Date: Tue Sep  2 17:20:49 2008
New Revision: 29195

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29195&view=rev
Log:
Yet another try at getting status display right.

Modified:
    trunk/src/menu_events.cpp

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=29195&r1=29194&r2=29195&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Tue Sep  2 17:20:49 2008
@@ -414,6 +414,7 @@
                        const team_data data = 
calculate_team_data(teams_[n],n+1,units_);
 
                        const unit_map::const_iterator leader = 
team_leader(n+1,units_);
+                       std::string leader_name;
                        //output the number of the side first, and this will
                        //cause it to be displayed in the correct colour
                        if(leader != units_.end()) {
@@ -423,10 +424,14 @@
                                if (known || game_config::debug) {
                                        str << IMAGE_PREFIX << 
leader->second.absolute_image();
                                        leader_bools.push_back(true);
+                                       leader_name = leader->second.name();
                                } else {
                                        str << IMAGE_PREFIX << 
std::string("unknown-unit.png");
                                        leader_bools.push_back(false);
-                               }
+                                       leader_name = "Unknown";
+                               }
+                       if (gamestate_.campaign_type == "multiplayer")
+                               leader_name = teams_[n].current_player();
 
 #ifndef LOW_MEM
                                str << "~RC(" << leader->second.team_color() << 
">" << team::get_side_colour_index(n+1) << ")";
@@ -434,13 +439,8 @@
                        } else {
                                leader_bools.push_back(false);
                        }
-                       std::string side_name;
-                       if (gamestate_.campaign_type == "multiplayer")
-                               side_name = teams_[n].current_player();
-                       else
-                               side_name = teams_[n].user_team_name();
                        str << COLUMN_SEPARATOR << team::get_side_highlight(n)
-                           << side_name << COLUMN_SEPARATOR
+                           << leader_name << COLUMN_SEPARATOR
                            << (data.teamname.empty() ? teams_[n].team_name() : 
data.teamname)
                            << COLUMN_SEPARATOR;
 


_______________________________________________
Wesnoth-commits mailing list
Wesnoth-commits@gna.org
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to