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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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.

<MarkerCategory Name="NestedLevel2" YPos="222">
<MarkerCategory Name="NestedLevel3" ZPos="333"></MarkerCategory>
</MarkerCategory>
Expand All @@ -17,5 +17,6 @@
<POI Type="nestedlevel1" MapID="50" />
<POI Type="nestedlevel1.nestedlevel2" MapID="50" />
<POI Type="nestedlevel1.nestedlevel2.nestedlevel3" MapID="50" />
<Trail Type="nestedlevel1.nestedlevel2.nestedlevel3" />
</POIs>
</OverlayData>

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"
+}

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"
+}

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<POI Type="mycategory" MapID="50" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" MapID="50" XPos="170.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" MapID="50" XPos="169.809998" YPos="211.649994" ZPos="215.830002"/>
<POI Type="nestedlevel1" MapID="50" XPos="111.000000" YPos="0.000000" ZPos="0.000000"/>
<POI Type="nestedlevel1.nestedlevel2" MapID="50" XPos="111.000000" YPos="222.000000" ZPos="0.000000"/>
<POI Type="nestedlevel1.nestedlevel2.nestedlevel3" MapID="50" XPos="111.000000" YPos="222.000000" ZPos="333.000000"/>
<POI Type="nestedlevel1" IconFile="texture_one.png" MapID="50" XPos="111.000000" YPos="0.000000" ZPos="0.000000"/>
<POI Type="nestedlevel1.nestedlevel2" IconFile="texture_one.png" MapID="50" XPos="111.000000" YPos="222.000000" ZPos="0.000000"/>
<POI Type="nestedlevel1.nestedlevel2.nestedlevel3" IconFile="texture_one.png" MapID="50" XPos="111.000000" YPos="222.000000" ZPos="333.000000"/>
<Trail AnimSpeed="1.000000" Type="nestedlevel1.nestedlevel2.nestedlevel3" MapID="50" Texture="texture_one.png" TrailData="037aa160e392f1c8.trl"/>
</POIs>
</OverlayData>

This file was deleted.

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"
+}

Binary file not shown.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion xml_converter/src/packaging_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ vector<Parseable*> parse_pois(rapidxml::xml_node<>* root_node, map<string, Categ
Trail* trail = new Trail();

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++) {
for (size_t i = 0; i < categories[category_index]->trail_attributes.size(); i++) {
trail->init_xml_attribute(
categories[category_index]->trail_attributes[i],
&ignored_errors,
Expand Down
Loading