mail[Wesnoth-commits] r37123 - in /trunk/src: gamestatus.cpp gamestatus.hpp playsingle_controller.cpp


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

Header


Content

Posted by e0204097 on July 21, 2009 - 12:01:
Author: euschn
Date: Tue Jul 21 12:01:24 2009
New Revision: 37123

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37123&view=rev
Log:
removed game_state::read_player and game_state::load_recall_list

Modified:
    trunk/src/gamestatus.cpp
    trunk/src/gamestatus.hpp
    trunk/src/playsingle_controller.cpp

Modified: trunk/src/gamestatus.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=37123&r1=37122&r2=37123&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Tue Jul 21 12:01:24 2009
@@ -166,30 +166,6 @@
 }
 #endif
 
-static player_info read_player(const config &cfg)
-{
-       player_info res;
-
-       res.name = cfg["name"];
-
-       res.gold = atoi(cfg["gold"].c_str());
-       res.gold_add = utils::string_bool(cfg["gold_add"]);
-
-       foreach (const config &u, cfg.child_range("unit")) {
-               res.available_units.push_back(unit(u, false));
-       }
-
-       res.can_recruit.clear();
-
-       const std::string &can_recruit_str = cfg["can_recruit"];
-       if (!can_recruit_str.empty()) {
-               const std::vector<std::string> can_recruit = 
utils::split(can_recruit_str);
-               
std::copy(can_recruit.begin(),can_recruit.end(),std::inserter(res.can_recruit,res.can_recruit.end()));
-       }
-
-       return res;
-}
-
 game_state::game_state()  :
                players(),
                scoped_variables(),
@@ -253,19 +229,9 @@
 
                
rng_.seed_random(lexical_cast_default<unsigned>(snapshot["random_calls"]));
 
-               // Midgame saves have the recall list stored in the snapshot.
-               load_recall_list(snapshot.child_range("player"));
-
        } else {
                assert(replay_start != NULL);
 
-               // The player information should no longer be saved to the 
root of the config.
-               // The game now looks for the info in just the snapshot or 
the starting position.
-               // Check if we find some player information in the starting 
position
-               config::const_child_itors cfg_players = 
replay_start.child_range("player");
-
-               if (cfg_players.first != cfg_players.second)
-                       load_recall_list(cfg_players);
        }
 
        LOG_NG << "scenario: '" << classification_.scenario << "'\n";
@@ -509,23 +475,6 @@
        } else {
                to_clear.vars->clear_children(to_clear.key);
                to_clear.vars->remove_attribute(to_clear.key);
-       }
-}
-
-void game_state::load_recall_list(const config::const_child_itors &players)
-{
-       if (players.first == players.second) return;
-
-       foreach (const config &p, players)
-       {
-               const std::string &save_id = p["save_id"];
-
-               if (save_id.empty()) {
-                       ERR_NG << "Corrupted player entry: NULL save_id" << 
std::endl;
-               } else {
-                       player_info player = read_player(p);
-                       this->players.insert(std::make_pair(save_id, player));
-               }
        }
 }
 

Modified: trunk/src/gamestatus.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.hpp?rev=37123&r1=37122&r2=37123&view=diff
==============================================================================
--- trunk/src/gamestatus.hpp (original)
+++ trunk/src/gamestatus.hpp Tue Jul 21 12:01:24 2009
@@ -107,13 +107,6 @@
        /** Return the Nth player, or NULL if no such player exists. */
        player_info* get_player(const std::string& id);
 
-       /**
-        * Loads the recall list.
-        *
-        * @param players      Reference to the players section to load.
-        */
-       void load_recall_list(const config::const_child_itors &players);
-
        std::vector<scoped_wml_variable*> scoped_variables;
        std::map<std::string, wml_menu_item*> wml_menu_items;
 

Modified: trunk/src/playsingle_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=37123&r1=37122&r2=37123&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Tue Jul 21 12:01:24 2009
@@ -875,7 +875,12 @@
                                report << font::BOLD_TEXT << _("You have 
emerged victorious!") << "\n~\n";
                        }
                        
-                       if (gamestate_.players.size() > 0 &&
+                       int persistent_teams = 0;
+                       for(std::vector<team>::iterator j=teams_.begin(); 
j!=teams_.end(); ++j) {
+                               if (j->persistent()) persistent_teams++;
+                       }
+                       
+                       if (persistent_teams > 0 &&
                                         (has_next_scenario ||
                                         
gamestate_.classification().campaign_type == "test")) {
                                const int finishing_bonus_per_turn =
@@ -915,7 +920,7 @@
                                                if (!i->is_human())
                                                        continue;
 
-                                               
if(gamestate_.players.size()>1) {
+                                               if(persistent_teams > 1) {
                                                        if(i!=teams_.begin()) 
{
                                                                report << 
"\n";
                                                        }




Related Messages


Powered by MHonArc, Updated Tue Jul 21 13:01:09 2009