#13 LotroDat-0: Проверки на DatId

已合并
Endevir 5 年之前 将 1 次代码提交从 LotRO_Legacy/f/LotroDat-0-DatId-checks合并至 LotRO_Legacy/dev
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/DatSubsystems/DatPatcher.cpp

+ 11 - 0
src/DatSubsystems/DatPatcher.cpp

@@ -20,6 +20,17 @@ namespace LOTRO_DAT {
      */
 
     DatOperationResult<> DatPatcher::PatchFile(const SubfileData &data, bool single_file) {
+        if (!data.options["did"]) {
+            // Subfile data does not contain any Dat ID number, so skipping it
+            return DatOperationResult<>();
+        }
+
+        auto dat_id = data.options["did"].as<long long>();
+        if (dat_id != dat->GetDatID()) {
+            // Subfile Dat ID does not match host DAT ID, so we shouldn't patch it
+            return DatOperationResult<>();
+        }
+
         auto file_id = data.options["fid"].as<long long>();
 
         if (single_file) {