mail[Wesnoth-commits] r37121 - in /trunk/src: gamestatus.cpp gamestatus.hpp playcampaign.cpp savegame.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 - 10:30:
Author: euschn
Date: Tue Jul 21 10:29:42 2009
New Revision: 37121

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37121&view=rev
Log:
removed redundant parameter from game_state::write_players

Modified:
    trunk/src/gamestatus.cpp
    trunk/src/gamestatus.hpp
    trunk/src/playcampaign.cpp
    trunk/src/savegame.cpp

Modified: trunk/src/gamestatus.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=37121&r1=37120&r2=37121&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Tue Jul 21 10:29:42 2009
@@ -258,7 +258,7 @@
        cfg["can_recruit"] = can_recruit_str;
 }
 
-void write_players(game_state& gamestate, config& cfg, const bool 
use_snapshot)
+void write_players(game_state& gamestate, config& cfg)
 {
        // If there is already a player config available it means we are 
loading
        // from a savegame. Don't do anything then, the information is 
already there
@@ -267,25 +267,13 @@
                return;
        
        //take all sides information from the snapshot (assuming it only 
contains carryover information)
-       if (use_snapshot) {
-               //take all side tags and add them as players
-               foreach(const config* snapshot_side, 
gamestate.snapshot.get_children("side")) {
-                       cfg.add_child("player", *snapshot_side);
-               }
-               //add the remaining player tags
-               foreach(const config* snapshot_player, 
gamestate.snapshot.get_children("player")) {
-                       cfg.add_child("player", *snapshot_player);
-               }
-       }
-       else {
-               for(std::map<std::string, player_info>::const_iterator 
i=gamestate.players.begin();
-                       i!=gamestate.players.end(); ++i)
-               {
-                       config new_cfg;
-                       gamestate.write_player(i->first, i->second, new_cfg, 
use_snapshot);
-
-                       cfg.add_child("player", new_cfg);
-               }
+       //take all side tags and add them as players
+       foreach(const config* snapshot_side, 
gamestate.snapshot.get_children("side")) {
+               cfg.add_child("player", *snapshot_side);
+       }
+       //add the remaining player tags
+       foreach(const config* snapshot_player, 
gamestate.snapshot.get_children("player")) {
+               cfg.add_child("player", *snapshot_player);
        }
 }
 

Modified: trunk/src/gamestatus.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.hpp?rev=37121&r1=37120&r2=37121&view=diff
==============================================================================
--- trunk/src/gamestatus.hpp (original)
+++ trunk/src/gamestatus.hpp Tue Jul 21 10:29:42 2009
@@ -188,7 +188,7 @@
 
 std::string generate_game_uuid();
 
-void write_players(game_state& gamestate, config& cfg, const bool 
use_snapshot = false);
+void write_players(game_state& gamestate, config& cfg);
 
 void extract_summary_from_config(config& cfg_save, config& cfg_summary);
 

Modified: trunk/src/playcampaign.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playcampaign.cpp?rev=37121&r1=37120&r2=37121&view=diff
==============================================================================
--- trunk/src/playcampaign.cpp (original)
+++ trunk/src/playcampaign.cpp Tue Jul 21 10:29:42 2009
@@ -519,7 +519,7 @@
                                assert(next_cfg != NULL);
                                gamestate.write_snapshot(next_cfg);
                                assert 
(next_cfg.get_children("player").empty());
-                               write_players(gamestate, next_cfg, true);
+                               write_players(gamestate, next_cfg);
                                network::send_data(cfg, 0, true);
                        }
                }
@@ -570,7 +570,7 @@
                        if (gamestate.classification().campaign_type != 
"multiplayer"){
                                gamestate.starting_pos = *scenario;
                                assert (!gamestate.snapshot.empty());
-                               write_players(gamestate, 
gamestate.starting_pos, true);
+                               write_players(gamestate, 
gamestate.starting_pos);
                        }
                }
                gamestate.snapshot = config();

Modified: trunk/src/savegame.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.cpp?rev=37121&r1=37120&r2=37121&view=diff
==============================================================================
--- trunk/src/savegame.cpp (original)
+++ trunk/src/savegame.cpp Tue Jul 21 10:29:42 2009
@@ -909,7 +909,7 @@
 {
        //Add the player section to the starting position so we can get the 
correct recall list
        //when loading the replay later on
-       write_players(gamestate(), gamestate().starting_pos, true);
+       write_players(gamestate(), gamestate().starting_pos);
 }
 
 replay_savegame::replay_savegame(game_state &gamestate, const bool 
compress_saves)




Related Messages


Powered by MHonArc, Updated Tue Jul 21 11:21:08 2009