Author: jhinrichs
Date: Thu Apr  2 02:31:22 2009
New Revision: 34386

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34386&view=rev
Log:
Savegame reorganization Step 1: Providing a simpler interface to saving and 
loading.
Remove savegame stuff from the replay-class.

Modified:
    trunk/src/playcampaign.cpp
    trunk/src/playsingle_controller.cpp
    trunk/src/replay.cpp
    trunk/src/replay.hpp

Modified: trunk/src/playcampaign.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playcampaign.cpp?rev=34386&r1=34385&r2=34386&view=diff
==============================================================================
--- trunk/src/playcampaign.cpp (original)
+++ trunk/src/playcampaign.cpp Thu Apr  2 02:31:22 2009
@@ -78,7 +78,6 @@
                assert(scenario != NULL);
                gamestate.starting_pos = *scenario;
        }
-       recorder.set_save_info(gamestate);
        starting_pos = gamestate.starting_pos;
        scenario = &starting_pos;
 
@@ -208,14 +207,11 @@
        // 'starting_pos' will contain the position we start the game from.
        config starting_pos;
 
-       recorder.set_save_info(gamestate);
-
        // Do we have any snapshot data?
        // yes => this must be a savegame
        // no  => we are starting a fresh scenario
        if(gamestate.snapshot.child("side") == NULL || !recorder.at_end()) {
                gamestate.completion = "running";
-               recorder.set_save_info_completion(gamestate.completion);
                // Campaign or Multiplayer?
                // If the gamestate already contains a starting_pos,
                // then we are starting a fresh multiplayer game.
@@ -599,8 +595,6 @@
                                gamestate.starting_pos = *scenario;
                        }
                }
-
-               recorder.set_save_info(gamestate);
        }
 
        if (!gamestate.scenario.empty() && gamestate.scenario != "null") {

Modified: trunk/src/playsingle_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=34386&r1=34385&r2=34386&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Thu Apr  2 02:31:22 2009
@@ -344,7 +344,6 @@
                }
                if (end_level.result == DEFEAT || end_level.result == VICTORY) {
                        gamestate_.completion = (end_level.result == VICTORY) ? 
"victory" : "defeat";
-                       
recorder.set_save_info_completion(gamestate_.completion);
                        // If we're a player, and the result is victory/defeat, 
then send
                        // a message to notify the server of the reason for the 
game ending.
                        if (!obs) {
@@ -386,7 +385,6 @@
                {
                        gamestate_.completion = (!end_level.linger_mode ?
                                                 "running" : "victory");
-                       
recorder.set_save_info_completion(gamestate_.completion);
                        try {
                                game_events::fire("victory");
                        } catch(end_level_exception&) {

Modified: trunk/src/replay.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.cpp?rev=34386&r1=34385&r2=34386&view=diff
==============================================================================
--- trunk/src/replay.cpp (original)
+++ trunk/src/replay.cpp Thu Apr  2 02:31:22 2009
@@ -143,7 +143,6 @@
        cfg_(),
        pos_(0),
        current_(NULL),
-       saveInfo_(),
        skip_(false),
        message_locations()
 {}
@@ -152,7 +151,6 @@
        cfg_(cfg),
        pos_(0),
        current_(NULL),
-       saveInfo_(),
        skip_(false),
        message_locations()
 {}
@@ -164,26 +162,6 @@
        if (!game_config::ignore_replay_errors) throw replay::error(msg);
 }
 
-void replay::set_save_info(const game_state& save)
-{
-       saveInfo_ = save;
-}
-
-//void replay::set_save_info(const game_state &save, const 
config::const_child_itors &players)
-//{
-//     saveInfo_ = save;
-//     saveInfo_.players.clear();
-//     saveInfo_.load_recall_list(players);
-//}
-
-void replay::set_save_info_completion(const std::string &st)
-// This function is a kluge to get around the fact that replay objects carry
-// around a copy of gamestate rather than a reference to the global gamestate.
-// That is probably a design bug that should be fixed.
-{
-       saveInfo_.completion = st;
-}
-
 void replay::set_skip(bool skip)
 {
        skip_ = skip;
@@ -193,41 +171,6 @@
 {
        return skip_;
 }
-
-//void replay::save_game(const std::string& label, const config& snapshot,
-//                       const config& starting_pos, bool include_replay)
-//{
-//     log_scope("replay::save_game");
-//     saveInfo_.snapshot = snapshot;
-//     saveInfo_.starting_pos = starting_pos;
-//
-//     if(include_replay) {
-//             saveInfo_.replay_data = cfg_;
-//     } else {
-//             saveInfo_.replay_data = config();
-//     }
-//
-//     saveInfo_.label = label;
-//
-//     std::string filename = label;
-//     if(preferences::compress_saves()) {
-//             filename += ".gz";
-//     }
-//
-//     std::stringstream ss;
-//     {
-//             config_writer out(ss, preferences::compress_saves());
-//             ::write_game(out, saveInfo_);
-//             finish_save_game(out, saveInfo_, saveInfo_.label);
-//     }
-//     scoped_ostream os(open_save_game(filename));
-//     (*os) << ss.str();
-//     saveInfo_.replay_data = config();
-//     saveInfo_.snapshot = config();
-//     if (!os->good()) {
-//             throw game::save_game_failed(_("Could not write to file"));
-//     }
-//}
 
 void replay::add_unit_checksum(const map_location& loc,config* const cfg)
 {

Modified: trunk/src/replay.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/replay.hpp?rev=34386&r1=34385&r2=34386&view=diff
==============================================================================
--- trunk/src/replay.hpp (original)
+++ trunk/src/replay.hpp Thu Apr  2 02:31:22 2009
@@ -41,10 +41,6 @@
 public:
        replay();
        explicit replay(const config& cfg);
-
-       void set_save_info(const game_state& save);
-       //void set_save_info(const game_state &save, const 
config::const_child_itors &players);
-       void set_save_info_completion(const std::string &st);
 
        void set_skip(bool skip);
        bool is_skipping() const;
@@ -147,8 +143,6 @@
 
        config* current_;
 
-       game_state saveInfo_;
-
        bool skip_;
 
        std::vector<int> message_locations;


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

Reply via email to