From 93cb8eb75843d6e462ea43002c67094a0bcc540d Mon Sep 17 00:00:00 2001 From: klingbolt Date: Tue, 10 Sep 2024 21:16:47 -0400 Subject: [PATCH 1/2] Changed render_on_minimap to is_hidden_on_minimap --- xml_converter/doc/rendering/render_on_minimap.md | 9 ++++++++- .../input/pack/markers.bin | 3 +++ .../output_proto/markers.bin | 3 +++ .../output_xml/xml_file.xml | 9 +++++++++ .../proto_is_hidden_on_minimap/testcase.yaml | 5 +++++ .../xml_render_on_minimap/input/pack/xml_file.xml | 15 +++++++++++++++ .../output_proto/markers.bin | 3 +++ .../xml_render_on_minimap/output_xml/xml_file.xml | 15 +++++++++++++++ .../xml_render_on_minimap/testcase.yaml | 5 +++++ xml_converter/proto/waypoint.proto | 4 ++-- xml_converter/src/icon_gen.cpp | 12 ++++++------ xml_converter/src/trail_gen.cpp | 12 ++++++------ 12 files changed, 80 insertions(+), 15 deletions(-) create mode 100644 xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/input/pack/markers.bin create mode 100644 xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_proto/markers.bin create mode 100644 xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml create mode 100644 xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/testcase.yaml create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_proto/markers.bin create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_minimap/testcase.yaml diff --git a/xml_converter/doc/rendering/render_on_minimap.md b/xml_converter/doc/rendering/render_on_minimap.md index 674c1ce4..989d89cb 100644 --- a/xml_converter/doc/rendering/render_on_minimap.md +++ b/xml_converter/doc/rendering/render_on_minimap.md @@ -3,7 +3,14 @@ name: Render on Minimap type: Boolean applies_to: [Icon, Trail] xml_fields: [MinimapVisibility, BHMinimapVisibility] -protobuf_field: tentative__render_on_minimap +protobuf_field: is_hidden_on_minimap +custom_functions: + read.xml: + function: inverted_xml_attribute_to_bool + side_effects: [] + write.xml: + function: bool_to_inverted_xml_attribute + side_effects: [] --- Allows or Prevents this object from being rendered on the minimap aka compass. diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/input/pack/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/input/pack/markers.bin new file mode 100644 index 00000000..9ed559cb --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/input/pack/markers.bin @@ -0,0 +1,3 @@ + +D + My Category 2B \Ï)Cf¦RC{ÔWC  2B \Ï)Cf¦RC{ÔWCB(èÌ“^– \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_proto/markers.bin new file mode 100644 index 00000000..9ed559cb --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_proto/markers.bin @@ -0,0 +1,3 @@ + +D + My Category 2B \Ï)Cf¦RC{ÔWC  2B \Ï)Cf¦RC{ÔWCB(èÌ“^– \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml new file mode 100644 index 00000000..6078d5fb --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/testcase.yaml b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/testcase.yaml new file mode 100644 index 00000000..d87f4066 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/testcase.yaml @@ -0,0 +1,5 @@ +input_paths: + "pack": "proto" +expected_stdout: | +expected_stderr: | +expected_returncode: 0 diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml new file mode 100644 index 00000000..9d304131 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_proto/markers.bin new file mode 100644 index 00000000..bc729a68 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_proto/markers.bin @@ -0,0 +1,3 @@ + +Ë + My Category 2B \Ï)Cf¦RC{ÔWC  2B \Ï)Cf¦RC{ÔWC  2B \Ï)Cf¦RC{ÔWC 2B \Ï)Cf¦RC{ÔWC 2B \Ï)Cf¦RC{ÔWC  2B \Ï)Cf¦RC{ÔWC  2B \Ï)Cf¦RC{ÔWC 2B \Ï)Cf¦RC{ÔWCB(èÌ“^– \ No newline at end of file diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml new file mode 100644 index 00000000..3a79c792 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/testcase.yaml b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/testcase.yaml new file mode 100644 index 00000000..9510c793 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/testcase.yaml @@ -0,0 +1,5 @@ +input_paths: + "pack": "xml" +expected_stdout: | +expected_stderr: | +expected_returncode: 0 diff --git a/xml_converter/proto/waypoint.proto b/xml_converter/proto/waypoint.proto index 1a028d79..bd4c7bb5 100644 --- a/xml_converter/proto/waypoint.proto +++ b/xml_converter/proto/waypoint.proto @@ -55,11 +55,11 @@ message Icon { SpecializationFilter specialization_filter = 31; SpeciesFilter species_filter = 32; CullChirality cull_chirality = 33; + bool is_hidden_on_minimap = 36; float tentative__scale = 2048; bool tentative__render_ingame = 2049; bool tentative__render_on_map = 2050; - bool tentative__render_on_minimap = 2051; string bhdraft__schedule = 2052; float bhdraft__schedule_duration = 2053; } @@ -87,10 +87,10 @@ message Trail { SpeciesFilter species_filter = 28; int32 map_display_size = 29; CullChirality cull_chirality = 30; + bool is_hidden_on_minimap = 33; bool tentative__render_ingame = 2049; bool tentative__render_on_map = 2050; - bool tentative__render_on_minimap = 2051; string bhdraft__schedule = 2052; float bhdraft__schedule_duration = 2053; } diff --git a/xml_converter/src/icon_gen.cpp b/xml_converter/src/icon_gen.cpp index 36c87c83..29fd8d2a 100644 --- a/xml_converter/src/icon_gen.cpp +++ b/xml_converter/src/icon_gen.cpp @@ -194,10 +194,10 @@ bool Icon::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vectorrender_on_map), &(this->render_on_map_is_set)); } else if (attributename == "minimapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); } else if (attributename == "bhminimapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); } else if (attributename == "behavior") { xml_attribute_to_reset_behavior(attribute, errors, state, &(this->reset_behavior), &(this->reset_behavior_is_set)); @@ -370,7 +370,7 @@ vector Icon::as_xml(XMLWriterState* state) const { xml_node_contents.push_back(bool_to_xml_attribute("MapVisibility", state, &this->render_on_map)); } if (this->render_on_minimap_is_set) { - xml_node_contents.push_back(bool_to_xml_attribute("MinimapVisibility", state, &this->render_on_minimap)); + xml_node_contents.push_back(bool_to_inverted_xml_attribute("MinimapVisibility", state, &this->render_on_minimap)); } if (this->reset_behavior_is_set) { xml_node_contents.push_back(reset_behavior_to_xml_attribute("Behavior", state, &this->reset_behavior)); @@ -548,7 +548,7 @@ waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const { bool_to_proto(this->render_on_map, state, setter); } if (this->render_on_minimap_is_set) { - std::function setter = [&proto_icon](bool val) { proto_icon.set_tentative__render_on_minimap(val); }; + std::function setter = [&proto_icon](bool val) { proto_icon.set_is_hidden_on_minimap(val); }; bool_to_proto(this->render_on_minimap, state, setter); } if (this->reset_behavior_is_set) { @@ -701,8 +701,8 @@ void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) { if (proto_icon.tentative__render_on_map() != 0) { proto_to_bool(proto_icon.tentative__render_on_map(), state, &(this->render_on_map), &(this->render_on_map_is_set)); } - if (proto_icon.tentative__render_on_minimap() != 0) { - proto_to_bool(proto_icon.tentative__render_on_minimap(), state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); + if (proto_icon.is_hidden_on_minimap() != 0) { + proto_to_bool(proto_icon.is_hidden_on_minimap(), state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); } if (proto_icon.trigger().reset_behavior() != 0) { proto_to_reset_behavior(proto_icon.trigger().reset_behavior(), state, &(this->reset_behavior), &(this->reset_behavior_is_set)); diff --git a/xml_converter/src/trail_gen.cpp b/xml_converter/src/trail_gen.cpp index a22ff256..b7dba038 100644 --- a/xml_converter/src/trail_gen.cpp +++ b/xml_converter/src/trail_gen.cpp @@ -116,10 +116,10 @@ bool Trail::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vectorrender_on_map), &(this->render_on_map_is_set)); } else if (attributename == "minimapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); } else if (attributename == "bhminimapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); } else if (attributename == "schedule") { xml_attribute_to_string(attribute, errors, state, &(this->schedule), &(this->schedule_is_set)); @@ -220,7 +220,7 @@ vector Trail::as_xml(XMLWriterState* state) const { xml_node_contents.push_back(bool_to_xml_attribute("MapVisibility", state, &this->render_on_map)); } if (this->render_on_minimap_is_set) { - xml_node_contents.push_back(bool_to_xml_attribute("MinimapVisibility", state, &this->render_on_minimap)); + xml_node_contents.push_back(bool_to_inverted_xml_attribute("MinimapVisibility", state, &this->render_on_minimap)); } if (this->schedule_is_set) { xml_node_contents.push_back(string_to_xml_attribute("Schedule", state, &this->schedule)); @@ -322,7 +322,7 @@ waypoint::Trail Trail::as_protobuf(ProtoWriterState* state) const { bool_to_proto(this->render_on_map, state, setter); } if (this->render_on_minimap_is_set) { - std::function setter = [&proto_trail](bool val) { proto_trail.set_tentative__render_on_minimap(val); }; + std::function setter = [&proto_trail](bool val) { proto_trail.set_is_hidden_on_minimap(val); }; bool_to_proto(this->render_on_minimap, state, setter); } if (this->schedule_is_set) { @@ -411,8 +411,8 @@ void Trail::parse_protobuf(waypoint::Trail proto_trail, ProtoReaderState* state) if (proto_trail.tentative__render_on_map() != 0) { proto_to_bool(proto_trail.tentative__render_on_map(), state, &(this->render_on_map), &(this->render_on_map_is_set)); } - if (proto_trail.tentative__render_on_minimap() != 0) { - proto_to_bool(proto_trail.tentative__render_on_minimap(), state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); + if (proto_trail.is_hidden_on_minimap() != 0) { + proto_to_bool(proto_trail.is_hidden_on_minimap(), state, &(this->render_on_minimap), &(this->render_on_minimap_is_set)); } if (proto_trail.bhdraft__schedule() != "") { proto_to_string(proto_trail.bhdraft__schedule(), state, &(this->schedule), &(this->schedule_is_set)); From ec2f2e966b66f7921a8965c2ee97df5237090b16 Mon Sep 17 00:00:00 2001 From: klingbolt Date: Wed, 11 Sep 2024 23:38:30 -0400 Subject: [PATCH 2/2] added tests for trail attributues --- .../input/pack/markers.bin | Bin 70 -> 77 bytes .../output_proto/markers.bin | Bin 70 -> 77 bytes .../output_xml/xml_file.xml | 2 ++ .../input/pack/xml_file.xml | 8 ++++++++ .../output_proto/markers.bin | Bin 206 -> 234 bytes .../output_xml/xml_file.xml | 8 ++++++++ 6 files changed, 18 insertions(+) diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/input/pack/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/input/pack/markers.bin index 9ed559cba0fa027b1e3a5694a390ee8aa7d588f6..c2170ee298e194123ea9c368151f82439504c6f7 100644 GIT binary patch delta 26 hcmZ?sW#aOl$Ydp`#N5HesKnsJq4DAj+o8#E(*Q|m2M_=N delta 19 acmeZuW8!j|$YjOk#G&!x4BMf}ank@W4+by* diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_proto/markers.bin index 9ed559cba0fa027b1e3a5694a390ee8aa7d588f6..c2170ee298e194123ea9c368151f82439504c6f7 100644 GIT binary patch delta 26 hcmZ?sW#aOl$Ydp`#N5HesKnsJq4DAj+o8#E(*Q|m2M_=N delta 19 acmeZuW8!j|$YjOk#G&!x4BMf}ank@W4+by* diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml index 6078d5fb..79285a4d 100644 --- a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_minimap/output_xml/xml_file.xml @@ -5,5 +5,7 @@ + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml index 9d304131..091c4bf7 100644 --- a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml +++ b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/input/pack/xml_file.xml @@ -11,5 +11,13 @@ + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_proto/markers.bin index bc729a68695244f11bcfa4240a8710a807f1ce36..d121f97becbc6a69e719ff27cf8d7c2f3b835cc2 100644 GIT binary patch delta 49 ocmX@d_==H<>-j{cLuyLQ9ZZZ6f-0pXLtIWA8ZXYU9hw|B4FFbI2xb5P diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml index 3a79c792..0109447b 100644 --- a/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml +++ b/xml_converter/integration_tests/test_cases/xml_render_on_minimap/output_xml/xml_file.xml @@ -11,5 +11,13 @@ + + + + + + + +