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

Merged
Endevir merged 1 commits from LotRO_Legacy/f/LotroDat-0-DatId-checks into LotRO_Legacy/dev 5 years ago
1 changed files with 11 additions and 0 deletions
  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) {
     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>();
         auto file_id = data.options["fid"].as<long long>();
 
 
         if (single_file) {
         if (single_file) {