Remove exposed parameter and private member for bzip2 compression.

For now, just pull it directly from preferences.
Whether we should emulate compress_saves or make compress_saves work the same way is a different concern.
This commit is contained in:
Alexander van Gessel 2013-05-22 02:23:24 +02:00
parent 00b0352b4e
commit 4121b0780e
3 changed files with 5 additions and 7 deletions

View file

@ -1132,7 +1132,7 @@ void play_controller::expand_autosaves(std::vector<std::string>& items)
std::vector<std::string> newsaves;
for (unsigned int turn = this->turn(); turn != 0; turn--) {
std::string name = gamestate_.classification().label + "-" + _("Auto-Save") + lexical_cast<std::string>(turn);
if (savegame::save_game_exists(name, preferences::compress_saves(), preferences::bzip2_savegame_compression())) {
if (savegame::save_game_exists(name, preferences::compress_saves())) {
if(preferences::compress_saves()) {
newsaves.push_back(name + (preferences::bzip2_savegame_compression() ? ".bz2" : ".gz"));
} else {
@ -1143,7 +1143,7 @@ void play_controller::expand_autosaves(std::vector<std::string>& items)
}
const std::string& start_name = gamestate_.classification().label;
if(savegame::save_game_exists(start_name, preferences::compress_saves(), preferences::bzip2_savegame_compression())) {
if(savegame::save_game_exists(start_name, preferences::compress_saves())) {
if(preferences::compress_saves()) {
newsaves.push_back(start_name + (preferences::bzip2_savegame_compression() ? ".bz2" : ".gz"));
} else {

View file

@ -447,7 +447,7 @@ void read_save_file(const std::string& name, config& cfg, std::string* error_log
}
}
bool save_game_exists(const std::string& name, bool compress_saves, bool bzip2_savegame_compression)
bool save_game_exists(const std::string& name, bool compress_saves)
{
std::string fname = name;
replace_space2underbar(fname);
@ -883,7 +883,7 @@ int savegame::show_save_dialog(CVideo& video, const std::string& message, const
bool savegame::check_overwrite(CVideo& video)
{
std::string filename = filename_;
if (save_game_exists(filename, compress_saves_, bzip2_savegame_compression_)) {
if (save_game_exists(filename, compress_saves_)) {
std::stringstream message;
message << _("Save already exists. Do you want to overwrite it?") << "\n" << _("Name: ") << filename;
int retval = gui2::show_message(video, _("Overwrite?"), message.str(), gui2::tmessage::yes_no_buttons);

View file

@ -64,7 +64,7 @@ std::vector<save_info> get_saves_list(const std::string* dir = NULL, const std::
void read_save_file(const std::string& name, config& cfg, std::string* error_log);
/** Returns true if there is already a savegame with that name. */
bool save_game_exists(const std::string& name, bool compress_saves, bool bzip2_savegame_compression);
bool save_game_exists(const std::string& name, bool compress_saves);
/** Delete all autosaves of a certain scenario. */
void clean_saves(const std::string& label);
@ -224,8 +224,6 @@ private:
bool show_confirmation_; /** Determines if a confirmation of successful saving the game is shown. */
bool compress_saves_; /** Determines, if compression is used for the savegame file */
bool bzip2_savegame_compression_; /** Determines, if bzip2 compression is used for the savegame file */
};
/** Class for "normal" midgame saves. The additional members are needed for creating the snapshot