From 4c12c44d651669443f11af28ef9549a538f96d87 Mon Sep 17 00:00:00 2001 From: klingbolt Date: Tue, 10 Sep 2024 20:48:56 -0400 Subject: [PATCH 1/2] Changed render_on_map to _is_hidden_on_map --- xml_converter/doc/rendering/render_on_map.md | 9 ++++++++- .../proto_is_hidden_on_map/input/pack/markers.bin | 3 +++ .../output_proto/markers.bin | 3 +++ .../output_xml/xml_file.xml | 9 +++++++++ .../proto_is_hidden_on_map/testcase.yaml | 5 +++++ .../xml_render_on_map/input/pack/xml_file.xml | 15 +++++++++++++++ .../xml_render_on_map/output_proto/markers.bin | 3 +++ .../xml_render_on_map/output_xml/xml_file.xml | 15 +++++++++++++++ .../test_cases/xml_render_on_map/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_map/input/pack/markers.bin create mode 100644 xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_proto/markers.bin create mode 100644 xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_xml/xml_file.xml create mode 100644 xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/testcase.yaml create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_map/input/pack/xml_file.xml create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_map/output_proto/markers.bin create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_map/output_xml/xml_file.xml create mode 100644 xml_converter/integration_tests/test_cases/xml_render_on_map/testcase.yaml diff --git a/xml_converter/doc/rendering/render_on_map.md b/xml_converter/doc/rendering/render_on_map.md index a5981c7b..375fb135 100644 --- a/xml_converter/doc/rendering/render_on_map.md +++ b/xml_converter/doc/rendering/render_on_map.md @@ -3,7 +3,14 @@ name: Render on Map type: Boolean applies_to: [Icon, Trail] xml_fields: [MapVisibility, BHMapVisibility] -protobuf_field: tentative__render_on_map +protobuf_field: is_hidden_on_map +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 world map. diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/input/pack/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/input/pack/markers.bin new file mode 100644 index 00000000..06a072a0 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/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_map/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_proto/markers.bin new file mode 100644 index 00000000..06a072a0 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/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_map/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_xml/xml_file.xml new file mode 100644 index 00000000..c01df540 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_xml/xml_file.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/testcase.yaml b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/testcase.yaml new file mode 100644 index 00000000..d87f4066 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/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_map/input/pack/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_map/input/pack/xml_file.xml new file mode 100644 index 00000000..f250afbd --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_map/input/pack/xml_file.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_map/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/xml_render_on_map/output_proto/markers.bin new file mode 100644 index 00000000..7f148a4f --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_map/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_map/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_map/output_xml/xml_file.xml new file mode 100644 index 00000000..d9bc1940 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_map/output_xml/xml_file.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_map/testcase.yaml b/xml_converter/integration_tests/test_cases/xml_render_on_map/testcase.yaml new file mode 100644 index 00000000..9510c793 --- /dev/null +++ b/xml_converter/integration_tests/test_cases/xml_render_on_map/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..ddddd635 100644 --- a/xml_converter/proto/waypoint.proto +++ b/xml_converter/proto/waypoint.proto @@ -55,10 +55,10 @@ message Icon { SpecializationFilter specialization_filter = 31; SpeciesFilter species_filter = 32; CullChirality cull_chirality = 33; + bool is_hidden_on_map = 35; 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,9 +87,9 @@ message Trail { SpeciesFilter species_filter = 28; int32 map_display_size = 29; CullChirality cull_chirality = 30; + bool is_hidden_on_map = 32; 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..dbdb4f50 100644 --- a/xml_converter/src/icon_gen.cpp +++ b/xml_converter/src/icon_gen.cpp @@ -188,10 +188,10 @@ bool Icon::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vectorrender_ingame), &(this->render_ingame_is_set)); } else if (attributename == "mapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_map), &(this->render_on_map_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_on_map), &(this->render_on_map_is_set)); } else if (attributename == "bhmapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_map), &(this->render_on_map_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_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)); @@ -367,7 +367,7 @@ vector Icon::as_xml(XMLWriterState* state) const { xml_node_contents.push_back(bool_to_xml_attribute("IngameVisibility", state, &this->render_ingame)); } if (this->render_on_map_is_set) { - xml_node_contents.push_back(bool_to_xml_attribute("MapVisibility", state, &this->render_on_map)); + xml_node_contents.push_back(bool_to_inverted_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)); @@ -544,7 +544,7 @@ waypoint::Icon Icon::as_protobuf(ProtoWriterState* state) const { bool_to_proto(this->render_ingame, state, setter); } if (this->render_on_map_is_set) { - std::function setter = [&proto_icon](bool val) { proto_icon.set_tentative__render_on_map(val); }; + std::function setter = [&proto_icon](bool val) { proto_icon.set_is_hidden_on_map(val); }; bool_to_proto(this->render_on_map, state, setter); } if (this->render_on_minimap_is_set) { @@ -698,8 +698,8 @@ void Icon::parse_protobuf(waypoint::Icon proto_icon, ProtoReaderState* state) { if (proto_icon.tentative__render_ingame() != 0) { proto_to_bool(proto_icon.tentative__render_ingame(), state, &(this->render_ingame), &(this->render_ingame_is_set)); } - 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.is_hidden_on_map() != 0) { + proto_to_bool(proto_icon.is_hidden_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)); diff --git a/xml_converter/src/trail_gen.cpp b/xml_converter/src/trail_gen.cpp index a22ff256..1267fd60 100644 --- a/xml_converter/src/trail_gen.cpp +++ b/xml_converter/src/trail_gen.cpp @@ -110,10 +110,10 @@ bool Trail::init_xml_attribute(rapidxml::xml_attribute<>* attribute, vectorrender_ingame), &(this->render_ingame_is_set)); } else if (attributename == "mapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_map), &(this->render_on_map_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_on_map), &(this->render_on_map_is_set)); } else if (attributename == "bhmapvisibility") { - xml_attribute_to_bool(attribute, errors, state, &(this->render_on_map), &(this->render_on_map_is_set)); + inverted_xml_attribute_to_bool(attribute, errors, state, &(this->render_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)); @@ -217,7 +217,7 @@ vector Trail::as_xml(XMLWriterState* state) const { xml_node_contents.push_back(bool_to_xml_attribute("IngameVisibility", state, &this->render_ingame)); } if (this->render_on_map_is_set) { - xml_node_contents.push_back(bool_to_xml_attribute("MapVisibility", state, &this->render_on_map)); + xml_node_contents.push_back(bool_to_inverted_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)); @@ -318,7 +318,7 @@ waypoint::Trail Trail::as_protobuf(ProtoWriterState* state) const { bool_to_proto(this->render_ingame, state, setter); } if (this->render_on_map_is_set) { - std::function setter = [&proto_trail](bool val) { proto_trail.set_tentative__render_on_map(val); }; + std::function setter = [&proto_trail](bool val) { proto_trail.set_is_hidden_on_map(val); }; bool_to_proto(this->render_on_map, state, setter); } if (this->render_on_minimap_is_set) { @@ -408,8 +408,8 @@ void Trail::parse_protobuf(waypoint::Trail proto_trail, ProtoReaderState* state) if (proto_trail.tentative__render_ingame() != 0) { proto_to_bool(proto_trail.tentative__render_ingame(), state, &(this->render_ingame), &(this->render_ingame_is_set)); } - 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.is_hidden_on_map() != 0) { + proto_to_bool(proto_trail.is_hidden_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)); From 2f823a72ecb61594e05033e064c5b3da3878c4ab Mon Sep 17 00:00:00 2001 From: klingbolt Date: Wed, 11 Sep 2024 23:28:35 -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 ++ .../xml_render_on_map/input/pack/xml_file.xml | 8 ++++++++ .../xml_render_on_map/output_proto/markers.bin | Bin 206 -> 234 bytes .../xml_render_on_map/output_xml/xml_file.xml | 8 ++++++++ 6 files changed, 18 insertions(+) diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/input/pack/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/input/pack/markers.bin index 06a072a0e7fda562e6817193284ebc9503b6640b..af452f483ee159d308a1637c605c49c7e3e31189 100644 GIT binary patch delta 26 hcmZ?sW#aOl$Ydp`#N5EdsKnsJq4DAj+o8#E(*Q{D2M7QF delta 19 acmeZuW8!j|$YjOk#G&!x4BMf}ank@W4+by* diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_proto/markers.bin index 06a072a0e7fda562e6817193284ebc9503b6640b..af452f483ee159d308a1637c605c49c7e3e31189 100644 GIT binary patch delta 26 hcmZ?sW#aOl$Ydp`#N5EdsKnsJq4DAj+o8#E(*Q{D2M7QF delta 19 acmeZuW8!j|$YjOk#G&!x4BMf}ank@W4+by* diff --git a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_xml/xml_file.xml index c01df540..d75bf7c1 100644 --- a/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_xml/xml_file.xml +++ b/xml_converter/integration_tests/test_cases/proto_is_hidden_on_map/output_xml/xml_file.xml @@ -5,5 +5,7 @@ + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_map/input/pack/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_map/input/pack/xml_file.xml index f250afbd..26e0fa9b 100644 --- a/xml_converter/integration_tests/test_cases/xml_render_on_map/input/pack/xml_file.xml +++ b/xml_converter/integration_tests/test_cases/xml_render_on_map/input/pack/xml_file.xml @@ -11,5 +11,13 @@ + + + + + + + + diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_map/output_proto/markers.bin b/xml_converter/integration_tests/test_cases/xml_render_on_map/output_proto/markers.bin index 7f148a4fc5f61858b7abccef49ac0873eaa5fc03..dabc52a20587390ff46756a7afb933d056154242 100644 GIT binary patch delta 49 ocmX@d_==H<>-j{cLuyLQ4NQy>f-0pXLtIWA8ZXYU9hw|B4FFbI2xb5P diff --git a/xml_converter/integration_tests/test_cases/xml_render_on_map/output_xml/xml_file.xml b/xml_converter/integration_tests/test_cases/xml_render_on_map/output_xml/xml_file.xml index d9bc1940..a797e091 100644 --- a/xml_converter/integration_tests/test_cases/xml_render_on_map/output_xml/xml_file.xml +++ b/xml_converter/integration_tests/test_cases/xml_render_on_map/output_xml/xml_file.xml @@ -11,5 +11,13 @@ + + + + + + + +