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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" IconFile="texture_one.png" Texture="texture_one.png" Name="mycategory">
</MarkerCategory>

<POIs>
<POI Type="mycategory" MapID="50" />
<Trail Type="mycategory" MapID="50" />
</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_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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<OverlayData>
<MarkerCategory DisplayName="My Category" ID="KOjMBsKTXpY=" Name="mycategory">
</MarkerCategory>

<POIs>
<POI Type="mycategory" IconFile="texture_one.png" MapID="50"/>
<Trail Type="mycategory" MapID="50" Texture="texture_one.png"/>
</POIs>
</OverlayData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input_paths:
"pack": "xml"
expected_stdout: |
expected_stderr: |
expected_returncode: 0
2 changes: 1 addition & 1 deletion xml_converter/src/packaging_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

trail->init_xml_attribute(
categories[category_index]->icon_attributes[i],
categories[category_index]->trail_attributes[i],
&ignored_errors,
state);
}
Expand Down
Loading