Author: euschn
Date: Tue Jun 23 15:34:38 2009
New Revision: 36360

URL: http://svn.gna.org/viewcvs/wesnoth?rev=36360&view=rev
Log:
replaced gamestatus member in class game_savegame by a tod_manager

Modified:
    trunk/src/play_controller.cpp
    trunk/src/playmp_controller.cpp
    trunk/src/playsingle_controller.cpp
    trunk/src/savegame.cpp
    trunk/src/savegame.hpp

Modified: trunk/src/play_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=36360&r1=36359&r2=36360&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Tue Jun 23 15:34:38 2009
@@ -296,7 +296,7 @@
 void play_controller::save_game(){
        if(save_blocker::try_block()) {
                save_blocker::save_unblocker unblocker;
-               game_savegame save(gamestate_, level_, *gui_, teams_, units_, 
status_, map_, preferences::compress_saves());
+               game_savegame save(gamestate_, level_, *gui_, teams_, units_, 
tod_manager_, map_, preferences::compress_saves());
                save.save_game_interactive((*gui_).video(), "", gui::OK_CANCEL);
        } else {
                save_blocker::on_unblock(this,&play_controller::save_game);

Modified: trunk/src/playmp_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playmp_controller.cpp?rev=36360&r1=36359&r2=36360&view=diff
==============================================================================
--- trunk/src/playmp_controller.cpp (original)
+++ trunk/src/playmp_controller.cpp Tue Jun 23 15:34:38 2009
@@ -547,7 +547,7 @@
                temp_buf << " \n";
        }
 
-       oos_savegame save(gamestate_, level_, *gui_, teams_, units_, status_, 
map_, preferences::compress_saves());
+       oos_savegame save(gamestate_, level_, *gui_, teams_, units_, 
tod_manager_, map_, preferences::compress_saves());
        save.save_game_interactive((*gui_).video(), temp_buf.str(), 
gui::YES_NO);
 }
 

Modified: trunk/src/playsingle_controller.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=36360&r1=36359&r2=36360&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Tue Jun 23 15:34:38 2009
@@ -513,7 +513,7 @@
                        disconnect = true;
                }
 
-               game_savegame save(gamestate_, level_, *gui_, teams_, units_, 
status_, map_, preferences::compress_saves());
+               game_savegame save(gamestate_, level_, *gui_, teams_, units_, 
tod_manager_, map_, preferences::compress_saves());
                save.save_game_interactive((*gui_).video(), _("A network 
disconnection has occurred, and the game\ncannot continue. Do you want to save 
the game?"), gui::YES_NO);
                if(disconnect) {
                        throw network::error();
@@ -681,7 +681,7 @@
        gui_->draw(true,true);
 
        if (save) {
-               autosave_savegame save(gamestate_, level_, *gui_, teams_, 
units_, status_, map_, preferences::compress_saves());
+               autosave_savegame save(gamestate_, level_, *gui_, teams_, 
units_, tod_manager_, map_, preferences::compress_saves());
                save.autosave(game_config::disable_autosave, 
preferences::autosavemax(), preferences::INFINITE_AUTO_SAVES);
        }
 

Modified: trunk/src/savegame.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.cpp?rev=36360&r1=36359&r2=36360&view=diff
==============================================================================
--- trunk/src/savegame.cpp (original)
+++ trunk/src/savegame.cpp Tue Jun 23 15:34:38 2009
@@ -865,7 +865,7 @@
 
 autosave_savegame::autosave_savegame(game_state &gamestate, const config& 
level_cfg,
                                                         game_display& gui, 
const std::vector<team>& teams,
-                                                        const unit_map& units, 
const gamestatus& gamestatus,
+                                                        const unit_map& units, 
tod_manager& gamestatus,
                                                         const gamemap& map, 
const bool compress_saves)
        : game_savegame(gamestate, level_cfg, gui, teams, units, gamestatus, 
map, compress_saves)
 {
@@ -888,14 +888,14 @@
        if (gamestate().classification().label.empty())
                filename = _("Auto-Save");
        else
-               filename = gamestate().classification().label + "-" + 
_("Auto-Save") + lexical_cast<std::string>(gamestatus_.turn());
+               filename = gamestate().classification().label + "-" + 
_("Auto-Save") + lexical_cast<std::string>(tod_manager_.turn());
 
        set_filename(filename);
 }
 
 oos_savegame::oos_savegame(game_state &gamestate, const config& level_cfg,
                                                         game_display& gui, 
const std::vector<team>& teams,
-                                                        const unit_map& units, 
const gamestatus& gamestatus,
+                                                        const unit_map& units, 
tod_manager& gamestatus,
                                                         const gamemap& map, 
const bool compress_saves)
        : game_savegame(gamestate, level_cfg, gui, teams, units, gamestatus, 
map, compress_saves)
 {}
@@ -923,12 +923,12 @@
 
 game_savegame::game_savegame(game_state &gamestate, const config& level_cfg,
                                                         game_display& gui, 
const std::vector<team>& teams,
-                                                        const unit_map& units, 
const gamestatus& gamestatus,
+                                                        const unit_map& units, 
tod_manager& gamestatus,
                                                         const gamemap& map, 
const bool compress_saves)
        : savegame(gamestate, compress_saves, _("Save Game")),
        level_cfg_(level_cfg), gui_(gui),
        teams_(teams), units_(units),
-       gamestatus_(gamestatus), map_(map)
+       tod_manager_(gamestatus), map_(map)
 {}
 
 void game_savegame::create_filename()
@@ -937,7 +937,7 @@
 
        const std::string ellipsed_name = 
font::make_text_ellipsis(gamestate().classification().label,
                        font::SIZE_NORMAL, 200);
-       stream << ellipsed_name << " " << _("Turn") << " " << 
gamestatus_.turn();
+       stream << ellipsed_name << " " << _("Turn") << " " << 
tod_manager_.turn();
        set_filename(stream.str());
 }
 
@@ -990,7 +990,7 @@
                }
        }
 
-       gamestatus_.write(snapshot());
+       snapshot().merge_with(tod_manager_.to_config());
        game_events::write_events(snapshot());
 
        // Write terrain_graphics data in snapshot, too

Modified: trunk/src/savegame.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/savegame.hpp?rev=36360&r1=36359&r2=36360&view=diff
==============================================================================
--- trunk/src/savegame.hpp (original)
+++ trunk/src/savegame.hpp Tue Jun 23 15:34:38 2009
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*
-   Copyright (C) 2003 - 2009 by Jörg Hinrichs, refactored from various
+   Copyright (C) 2003 - 2009 by J�rg Hinrichs, refactored from various
    places formerly created by David White <[email protected]>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
 
@@ -19,6 +19,7 @@
 #include "global.hpp"
 #include "filesystem.hpp"
 #include "gamestatus.hpp"
+#include "tod_manager.hpp"
 #include "show_dialog.hpp"
 
 #include <string>
@@ -227,7 +228,7 @@
 public:
        game_savegame(game_state& gamestate, const config& level_cfg,
                game_display& gui, const std::vector<team>& teams,
-               const unit_map& units, const gamestatus& gamestatus,
+               const unit_map& units, tod_manager& gamestatus,
                const gamemap& map, const bool compress_saves);
 
 private:
@@ -245,7 +246,7 @@
        game_display& gui_;
        const std::vector<team>& teams_;
        const unit_map& units_;
-       const gamestatus& gamestatus_;
+       tod_manager& tod_manager_; //FIXME: make to_config() const so we can 
call it on const references
        const gamemap& map_;
 };
 
@@ -266,7 +267,7 @@
 public:
        autosave_savegame(game_state &gamestate, const config& level_cfg,
                                         game_display& gui, const 
std::vector<team>& teams,
-                                        const unit_map& units, const 
gamestatus& gamestatus,
+                                        const unit_map& units, tod_manager& 
gamestatus,
                                         const gamemap& map, const bool 
compress_saves);
 
        void autosave(const bool disable_autosave, const int autosave_max, 
const int infinite_autosaves);
@@ -280,7 +281,7 @@
 public:
        oos_savegame(game_state &gamestate, const config& level_cfg,
                                 game_display& gui, const std::vector<team>& 
teams,
-                                const unit_map& units, const gamestatus& 
gamestatus,
+                                const unit_map& units, tod_manager& gamestatus,
                                 const gamemap& map, const bool compress_saves);
 
 private:


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

Reply via email to