Fix saveload format negotiation

This commit is contained in:
dP
2021-04-02 15:51:55 +03:00
parent da3cfd2821
commit b0026b697a
4 changed files with 22 additions and 3 deletions
+3 -2
View File
@@ -2514,11 +2514,10 @@ std::optional<SavePreset> FindCompatibleSavePreset(const std::string &server_for
*/
uint8 GetAvailableLoadFormats()
{
return 3;
uint8 res = 0;
for(auto &slf : _saveload_formats) {
if (slf.init_load != nullptr) {
res &= (1 << slf.id);
res |= (1 << slf.id);
}
}
return res;
@@ -2859,6 +2858,8 @@ static SaveOrLoadResult DoLoad(LoadFilter *reader, bool load_check)
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, err_str);
}
DEBUG(sl, 2, "Using saveload format '%s'", fmt->name);
_sl.lf = fmt->init_load(_sl.lf);
_sl.reader = new ReadBuffer(_sl.lf);
_next_offs = 0;