Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't force the .gz suffix on every entry of the save_index (bug #20849)

Quoting the code from savegame::save_index_class::data(const std::string&):

  /*
   * All saves are .gz files now so make sure we use that name when opening
   * a file. If not some parts of the code use the name with and some parts
   * without the .gz suffix.
   */

... A confusing statement that makes absolutely no amount of sense
whatsoever and comes from patch #3125! Not even back then it was true:
saved games could be either compressed (.gz) or uncompressed plain text
files (no extension). Nowadays we also have bzip2-compressed (.bz2)
files to add to the mix.

Most code actually calls the savegame-related functions with an explicit
file extension (if applicable), which is the source of a whole array of
maintainability concerns at this time; thus, I am not really sure what
the "some parts of the code" part refers to.
  • Loading branch information...
commit c9aaaed1399264a9229351e1f8a312b8e250d4e0 1 parent d110cd1
@shikadilord shikadilord authored
Showing with 3 additions and 12 deletions.
  1. +1 −0  changelog
  2. +2 −12 src/savegame.cpp
View
1  changelog
@@ -26,6 +26,7 @@ Version 1.11.8+dev:
cleared on victory.
* Fixed missing log error message for invalid music tracks set with
play_once=yes (bug #21479).
+ * Don't force the .gz suffix on every entry of the save_index (bug #20849).
Version 1.11.8:
* Add-ons client:
View
14 src/savegame.cpp
@@ -202,23 +202,13 @@ class save_index_class
}
private:
config& data(const std::string& name) {
- std::string save = name;
- /*
- * All saves are .gz files now so make sure we use that name when opening
- * a file. If not some parts of the code use the name with and some parts
- * without the .gz suffix.
- */
- if(save.length() < 3 || save.substr(save.length() - 3) != ".gz") {
- save += ".gz";
- }
-
config& cfg = data();
- if (config& sv = cfg.find_child("save", "save", save)) {
+ if (config& sv = cfg.find_child("save", "save", name)) {
return sv;
}
config& res = cfg.add_child("save");
- res["save"] = save;
+ res["save"] = name;
return res;
}
config& data() {
Please sign in to comment.
Something went wrong with that request. Please try again.