Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug that caused trails to not inherit attributes correctly #353

Merged
merged 4 commits into from
Sep 22, 2024

Conversation

klingbolt
Copy link
Contributor

No description provided.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full Diff
--- xml_converter/integration_tests/test_cases/xml_inheritance/output_proto/markers.bin.textproto._old	2024-09-11 04:39:34.969645373 +0000
+++ xml_converter/integration_tests/test_cases/xml_inheritance/output_proto/markers.bin.textproto._new	2024-09-11 04:39:34.977645420 +0000
@@ -0,0 +1,17 @@
+category {
+  name: "My Category"
+  icon {
+    texture_id: 1
+    map_id: 50
+  }
+  trail {
+    texture_id: 1
+    map_id: 50
+  }
+  id: "(\350\314\006\302\223^\226"
+}
+textures {
+}
+textures {
+  filepath: "texture_one.png"
+}

@@ -168,7 +168,7 @@ vector<Parseable*> parse_pois(rapidxml::xml_node<>* root_node, map<string, Categ
for (size_t category_index = 0; category_index < categories.size(); category_index++) {
for (size_t i = 0; i < categories[category_index]->icon_attributes.size(); i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like more robust tests are needed here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. The test seems to have only worked because the size of the two arrays was the same.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full Diff
--- xml_converter/integration_tests/test_cases/xml_category_inheritance/output_proto/markers.bin.textproto._old	2024-09-12 02:23:33.508679940 +0000
+++ xml_converter/integration_tests/test_cases/xml_category_inheritance/output_proto/markers.bin.textproto._new	2024-09-12 02:23:33.516679920 +0000
@@ -29,6 +29,7 @@
   children {
     children {
       icon {
+        texture_id: 1
         map_id: 50
         position {
           x: 111
@@ -36,9 +37,26 @@
           z: 333
         }
       }
+      trail {
+        texture_id: 1
+        map_id: 50
+        trail_data {
+          points_x: 1
+          points_x: 2
+          points_x: 3
+          points_y: 4
+          points_y: 5
+          points_y: 6
+          points_z: 7
+          points_z: 8
+          points_z: 9
+        }
+        animation_speed: 1
+      }
       id: "p,T\324\205\337\210\244"
     }
     icon {
+      texture_id: 1
       map_id: 50
       position {
         x: 111
@@ -48,6 +66,7 @@
     id: "\270\232\334\270\267xj\317"
   }
   icon {
+    texture_id: 1
     map_id: 50
     position {
       x: 111
@@ -55,3 +74,8 @@
   }
   id: ",\222\247\355j@\016:"
 }
+textures {
+}
+textures {
+  filepath: "texture_one.png"
+}

@@ -1,7 +1,7 @@
<OverlayData>
<MarkerCategory Name="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83"></MarkerCategory>

<MarkerCategory Name="NestedLevel1" XPos="000" MapID="999">
<MarkerCategory Name="NestedLevel1" XPos="000" MapID="999" IconFile="texture_one.png" Texture="texture_one.png" TrailData="trail.trl" AnimationSpeed="1">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about spiting the category into two instead of adding arbitrary arguments that correspond to trails vs icons. This way we wont accidentally run into this issue in the future if new required attributes are added to the schema.

To me it seems like this solution as written is a "if we add these irrelevant fields it happens to test the thing we want".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't considered the required attributes.

My thought in adding them to this category was to ensure that the attributes were sorted correctly into either Icons or Trails.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full Diff
--- xml_converter/integration_tests/test_cases/xml_category_inheritance/output_proto/markers.bin.textproto._old	2024-09-19 23:40:11.478056205 +0000
+++ xml_converter/integration_tests/test_cases/xml_category_inheritance/output_proto/markers.bin.textproto._new	2024-09-19 23:40:11.485056202 +0000
@@ -55,3 +55,30 @@
   }
   id: ",\222\247\355j@\016:"
 }
+category {
+  children {
+    trail {
+      texture_id: 1
+      map_id: 50
+      trail_data {
+        points_x: 1
+        points_x: 2
+        points_x: 3
+        points_y: 4
+        points_y: 5
+        points_y: 6
+        points_z: 7
+        points_z: 8
+        points_z: 9
+      }
+      animation_speed: 1
+    }
+    id: "\361@\242\320/\212\204\001"
+  }
+  id: "s\357U\206f\255\240\345"
+}
+textures {
+}
+textures {
+  filepath: "texture_one.png"
+}

@AsherGlick AsherGlick merged commit 2b6308b into AsherGlick:xml_converter Sep 22, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants