Author: jhinrichs
Date: Tue Apr 7 22:16:32 2009
New Revision: 34620
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34620&view=rev
Log:
Savegame reorganization Step 1: Providing a simpler interface to saving and
loading.
Removing commented code.
Modified:
trunk/src/gamestatus.cpp
trunk/src/menu_events.cpp
trunk/src/play_controller.cpp
trunk/src/playcampaign.cpp
trunk/src/playmp_controller.cpp
trunk/src/playsingle_controller.cpp
Modified: trunk/src/gamestatus.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gamestatus.cpp?rev=34620&r1=34619&r2=34620&view=diff
==============================================================================
--- trunk/src/gamestatus.cpp (original)
+++ trunk/src/gamestatus.cpp Tue Apr 7 22:16:32 2009
@@ -696,14 +696,6 @@
out.write_child("command", j->second->command);
out.close_child("menu_item");
}
-
- //for(std::map<std::string, player_info>::const_iterator
i=gamestate.players.begin();
- // i!=gamestate.players.end(); ++i) {
- // out.open_child("player");
- // out.write_key_val("save_id", i->first);
- // write_player(out, i->second);
- // out.close_child("player");
- //}
if(mode == WRITE_FULL_GAME) {
if (!gamestate.replay_data.child("replay")) {
Modified: trunk/src/menu_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=34620&r1=34619&r2=34620&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Tue Apr 7 22:16:32 2009
@@ -583,66 +583,6 @@
status_table(selected);
}
- //void menu_handler::save_game(const std::string& message,
gui::DIALOG_TYPE dialog_type,
- // const bool has_exit_button)
- //{
- // std::string label = ::create_filename(gamestate_.label,
status_.turn());
-
- // if(dialog_type == gui::NULL_DIALOG && message != "") {
- // label = message;
- // }
-
- // const int res = dialog_type == gui::NULL_DIALOG ? 0
- // : dialogs::get_save_name(*gui_,message, _("Name: "),
&label,dialog_type, "", has_exit_button);
-
- // if(res == 0) {
- // save_game_internal(label, true, true);
- // } else if(res == 2) {
- // throw end_level_exception(QUIT);
- // }
- //}
-
- //void menu_handler::save_replay(const std::string& message,
gui::DIALOG_TYPE dialog_type,
- // const bool has_exit_button)
- //{
- // std::string label = ::create_replay_filename(gamestate_.label);
-
- // if(dialog_type == gui::NULL_DIALOG && message != "") {
- // label = message;
- // }
-
- // const int res = dialog_type == gui::NULL_DIALOG ? 0
- // : dialogs::get_save_name(*gui_,message, _("Name: "),
&label,dialog_type, "", has_exit_button);
-
- // if(res == 0) {
- // save_game_internal(label, false, true);
- // } else if(res == 2) {
- // throw end_level_exception(QUIT);
- // }
- //}
-
- //void menu_handler::save_game_internal(const std::string& filename,
bool write_snapshot, bool display_message)
- //{
- // config snapshot;
- // if (write_snapshot)
- // write_game_snapshot(snapshot);
-
- // gamestate_.replay_data = recorder.get_replay_data();
- // try {
- // ::save_replay(filename, gamestate_);
-
- // if (display_message) {
- // gui::message_dialog(*gui_,_("Saved"),_("The
game has been saved")).show();
- // }
- // } catch(game::save_game_failed&) {
- // if (display_message){
- // gui::message_dialog
to_show(*gui_,_("Error"),_("The game could not be saved"));
- // to_show.show();
- // //do not bother retrying, since the user can
just try to save the game again
- // }
- // };
- //}
-
void menu_handler::save_map()
{
std::string input_name = get_dir(get_dir(get_user_data_dir() +
"/editor") + "/maps/");
@@ -675,70 +615,6 @@
}
}
}
-
- //void menu_handler::write_game_snapshot(config& start) const
- //{
- // start.merge_attributes(level_);
-
- // start["snapshot"] = "yes";
-
- // std::stringstream buf;
- // buf << gui_->playing_team();
- // start["playing_team"] = buf.str();
-
- // for(std::vector<team>::const_iterator t = teams_.begin(); t !=
teams_.end(); ++t) {
- // const unsigned int side_num = t - teams_.begin() + 1;
-
- // config& side = start.add_child("side");
- // t->write(side);
- // side["no_leader"] = "yes";
- // buf.str(std::string());
- // buf << side_num;
- // side["side"] = buf.str();
-
- // //current visible units
- // for(unit_map::const_iterator i = units_.begin(); i !=
units_.end(); ++i) {
- // if(i->second.side() == side_num) {
- // config& u = side.add_child("unit");
- // i->first.write(u);
- // i->second.write(u);
- // }
- // }
- // //recall list
- // {
- // for(std::map<std::string,
player_info>::const_iterator i=gamestate_.players.begin();
- // i!=gamestate_.players.end(); ++i) {
- // for(std::vector<unit>::const_iterator j
= i->second.available_units.begin();
- // j !=
i->second.available_units.end(); ++j) {
- // if (j->side() == side_num){
- // config& u =
side.add_child("unit");
- // j->write(u);
- // }
- // }
- // }
- // }
- // }
-
- // status_.write(start);
- // game_events::write_events(start);
-
- // // Write terrain_graphics data in snapshot, too
- // const config::child_list& terrains =
level_.get_children("terrain_graphics");
- // for(config::child_list::const_iterator tg = terrains.begin();
- // tg != terrains.end(); ++tg) {
-
- // start.add_child("terrain_graphics", **tg);
- // }
-
- // sound::write_music_play_list(start);
-
- // gamestate_.write_snapshot(start);
-
- // //write out the current state of the map
- // start["map_data"] = map_.write();
-
- // gui_->labels().write(start);
- //}
void menu_handler::autosave() const
{
@@ -2873,12 +2749,10 @@
void console_handler::do_save() {
savegame save(menu_handler_.gamestate_);
save.save_game(get_data());
- //menu_handler_.save_game(get_data(),gui::NULL_DIALOG);
}
void console_handler::do_save_quit() {
savegame save(menu_handler_.gamestate_);
save.save_game(get_data());
- //menu_handler_.save_game(get_data(),gui::NULL_DIALOG);
throw end_level_exception(QUIT);
}
void console_handler::do_quit() {
Modified: trunk/src/play_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/play_controller.cpp?rev=34620&r1=34619&r2=34620&view=diff
==============================================================================
--- trunk/src/play_controller.cpp (original)
+++ trunk/src/play_controller.cpp Tue Apr 7 22:16:32 2009
@@ -291,7 +291,6 @@
save_blocker::save_unblocker unblocker;
game_savegame save(gamestate_, level_, *gui_, teams_, units_,
status_, map_);
save.save_game_interactive(*gui_, "", gui::OK_CANCEL);
- //menu_handler_.save_game("",gui::OK_CANCEL);
} else {
save_blocker::on_unblock(this,&play_controller::save_game);
}
@@ -302,7 +301,6 @@
save_blocker::save_unblocker unblocker;
replay_savegame save(gamestate_);
save.save_game_interactive(*gui_, "", gui::OK_CANCEL);
- //menu_handler_.save_game("", gui::OK_CANCEL, false);
} else {
save_blocker::on_unblock(this,&play_controller::save_replay);
}
Modified: trunk/src/playcampaign.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playcampaign.cpp?rev=34620&r1=34619&r2=34620&view=diff
==============================================================================
--- trunk/src/playcampaign.cpp (original)
+++ trunk/src/playcampaign.cpp Tue Apr 7 22:16:32 2009
@@ -573,7 +573,6 @@
try {
scenariostart_savegame
save(gamestate);
save.save_game();
- //save_game(gamestate);
}
catch(game::save_game_failed&) {
gui::show_error_message(disp, _("The game could not be saved"));
retry = true;
Modified: trunk/src/playmp_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playmp_controller.cpp?rev=34620&r1=34619&r2=34620&view=diff
==============================================================================
--- trunk/src/playmp_controller.cpp (original)
+++ trunk/src/playmp_controller.cpp Tue Apr 7 22:16:32 2009
@@ -541,7 +541,6 @@
game_savegame save(gamestate_, level_, *gui_, teams_, units_, status_,
map_);
save.save_game_interactive(*gui_, temp_buf.str(), gui::YES_NO);
- //menu_handler_.save_game(temp_buf.str(),gui::YES_NO, true);
}
void playmp_controller::handle_generic_event(const std::string& name){
Modified: trunk/src/playsingle_controller.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playsingle_controller.cpp?rev=34620&r1=34619&r2=34620&view=diff
==============================================================================
--- trunk/src/playsingle_controller.cpp (original)
+++ trunk/src/playsingle_controller.cpp Tue Apr 7 22:16:32 2009
@@ -502,7 +502,6 @@
game_savegame save(gamestate_, level_, *gui_, teams_, units_,
status_, map_);
save.save_game_interactive(*gui_, _("A network disconnection
has occurred, and the game cannot continue. Do you want to save the game?"),
gui::YES_NO);
- //menu_handler_.save_game(_("A network disconnection has
occurred, and the game cannot continue. Do you want to save the
game?"),gui::YES_NO);
if(disconnect) {
throw network::error();
} else {
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits