Skip to content

Commit

Permalink
Merge pull request #191 from klingbolt/multiflag
Browse files Browse the repository at this point in the history
Adds a comma inbetween the flags when writing to xml
  • Loading branch information
AsherGlick authored Oct 31, 2023
2 parents 4671c02 + 244a868 commit f38417d
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 135 deletions.
5 changes: 3 additions & 2 deletions xml_converter/generators/cpp_templates/multiflagvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ void xml_attribute_to_{{attribute_name}}(
}

string {{attribute_name}}_to_xml_attribute(const std::string& attribute_name, const {{class_name}}* value) {
string output = "";
vector<string> flag_values;
{% for n, attribute_variable in enumerate(attribute_variables)%}
if (value->{{attribute_variable.attribute_name}} == true) {
output = output + "{{attribute_variable.xml_fields[0]}}";
flag_values.push_back("{{attribute_variable.xml_fields[0]}}");
}
{% endfor %}
string output = join(flag_values, ",");
return " " + attribute_name + "=\"" + output + "\"";
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<OverlayData>
<MarkerCategory Name="mycategory">
</MarkerCategory>

<POIs>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="raptor,springer" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="raptor,springer" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
</POIs>
</OverlayData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<OverlayData>
<MarkerCategory Name="mycategory">
</MarkerCategory>

<POIs>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="raptor" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="raptor,springer" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="raptor,springer" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
<POI Type="mycategory" IconFile="texture.png" MapID="50" Mount="raptor,springer,skimmer,jackal,griffon,rollerbeetle,warclaw,skyscale,skiff,seigeturtle" XPos="169.809998" YPos="210.649994" ZPos="215.830002"/>
</POIs>
</OverlayData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<OverlayData>
<MarkerCategory Name="mycategory">
</MarkerCategory>

<POIs>
<POI Mount="" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
<POI Mount="NotAMount" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
<POI Mount="Raptor,Springer," Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
<POI Mount="Raptor,NotAMount,Springer" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
</POIs>
</OverlayData>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<OverlayData>
<MarkerCategory Name="mycategory">
</MarkerCategory>

<POIs>
<POI Mount="Raptor" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
<POI Mount="Raptor,Springer" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
<POI Mount="Raptor, Springer" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
<POI Mount="Raptor,Springer,Skimmer,Jackal,Griffon,RollerBeetle,Warclaw,Skyscale,Skiff,SeigeTurtle" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>
</POIs>
</OverlayData>
28 changes: 28 additions & 0 deletions xml_converter/intigration_tests/testcases.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,32 @@ class Testcase:
" | ^^^"
]
),
Testcase(
name="mountfilter_valid",
xml_input_paths=["./inputs/xml_mount_filter_valid"],
expected_output_xml_path="./expected_outputs/xml_mount_filter_valid",
),
Testcase(
name="mountfilter_invalid",
xml_input_paths=["./inputs/xml_mount_filter_invalid"],
expected_output_xml_path="./expected_outputs/xml_mount_filter_invalid",
expected_stdout=[
'Error: Invalid Filter for MountFilter. Found ',
'./inputs/xml_mount_filter_invalid/xml_file.xml',
'6 |<POI Mount="" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>',
' | ',
'Error: Invalid Filter for MountFilter. Found NotAMount',
'./inputs/xml_mount_filter_invalid/xml_file.xml',
'7 |<POI Mount="NotAMount" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>',
' | ^^^^^^^^^',
'Error: Invalid Filter for MountFilter. Found ',
'./inputs/xml_mount_filter_invalid/xml_file.xml',
'8 |<POI Mount="Raptor,Springer," Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>',
' | ^^^^^^^^^^^^^^^^',
'Error: Invalid Filter for MountFilter. Found NotAMount',
'./inputs/xml_mount_filter_invalid/xml_file.xml',
'9 |<POI Mount="Raptor,NotAMount,Springer" Type="mycategory" XPos="169.81" YPos="210.65" ZPos="215.83" MapID="50" IconFile="texture.png" Type="mycategory"/>',
' | ^^^^^^^^^^^^^^^^^^^^^^^^^',
]
),
]
17 changes: 9 additions & 8 deletions xml_converter/src/attribute/festival_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,29 @@ void xml_attribute_to_festival_filter(
}

string festival_filter_to_xml_attribute(const std::string& attribute_name, const FestivalFilter* value) {
string output = "";
vector<string> flag_values;
if (value->dragonbash == true) {
output = output + "dragonbash";
flag_values.push_back("dragonbash");
}
if (value->festival_of_the_four_winds == true) {
output = output + "festivalofthefourwinds";
flag_values.push_back("festivalofthefourwinds");
}
if (value->halloween == true) {
output = output + "halloween";
flag_values.push_back("halloween");
}
if (value->lunar_new_year == true) {
output = output + "lunarnewyear";
flag_values.push_back("lunarnewyear");
}
if (value->super_adventure_festival == true) {
output = output + "superadventurefestival";
flag_values.push_back("superadventurefestival");
}
if (value->wintersday == true) {
output = output + "wintersday";
flag_values.push_back("wintersday");
}
if (value->none == true) {
output = output + "none";
flag_values.push_back("none");
}
string output = join(flag_values, ",");
return " " + attribute_name + "=\"" + output + "\"";
}

Expand Down
51 changes: 26 additions & 25 deletions xml_converter/src/attribute/map_type_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,79 +129,80 @@ void xml_attribute_to_map_type_filter(
}

string map_type_filter_to_xml_attribute(const std::string& attribute_name, const MapTypeFilter* value) {
string output = "";
vector<string> flag_values;
if (value->unknown_map == true) {
output = output + "unknown";
flag_values.push_back("unknown");
}
if (value->redirect_map == true) {
output = output + "redirect";
flag_values.push_back("redirect");
}
if (value->character_create_map == true) {
output = output + "charactercreate";
flag_values.push_back("charactercreate");
}
if (value->pvp_map == true) {
output = output + "pvp";
flag_values.push_back("pvp");
}
if (value->gvg_map == true) {
output = output + "gvg";
flag_values.push_back("gvg");
}
if (value->instance_map == true) {
output = output + "instance";
flag_values.push_back("instance");
}
if (value->public_map == true) {
output = output + "public";
flag_values.push_back("public");
}
if (value->tournament_map == true) {
output = output + "tournament";
flag_values.push_back("tournament");
}
if (value->tutorial_map == true) {
output = output + "tutorial";
flag_values.push_back("tutorial");
}
if (value->user_tournament_map == true) {
output = output + "usertournament";
flag_values.push_back("usertournament");
}
if (value->center_map == true) {
output = output + "center";
flag_values.push_back("center");
}
if (value->eternal_battlegrounds_map == true) {
output = output + "eternalbattlegrounds";
flag_values.push_back("eternalbattlegrounds");
}
if (value->bluehome_map == true) {
output = output + "bluehome";
flag_values.push_back("bluehome");
}
if (value->blue_borderlands_map == true) {
output = output + "blueborderlands";
flag_values.push_back("blueborderlands");
}
if (value->green_home_map == true) {
output = output + "greenhome";
flag_values.push_back("greenhome");
}
if (value->green_borderlands_map == true) {
output = output + "greenborderlands";
flag_values.push_back("greenborderlands");
}
if (value->red_home_map == true) {
output = output + "redhome";
flag_values.push_back("redhome");
}
if (value->red_borderlands_map == true) {
output = output + "redborderlands";
flag_values.push_back("redborderlands");
}
if (value->fortunes_vale_map == true) {
output = output + "fortunesvale";
flag_values.push_back("fortunesvale");
}
if (value->jump_puzzle_map == true) {
output = output + "jumppuzzle";
flag_values.push_back("jumppuzzle");
}
if (value->obsidian_sanctum_map == true) {
output = output + "obsidiansanctum";
flag_values.push_back("obsidiansanctum");
}
if (value->edge_of_the_mists_map == true) {
output = output + "edgeofthemists";
flag_values.push_back("edgeofthemists");
}
if (value->public_mini_map == true) {
output = output + "publicmini";
flag_values.push_back("publicmini");
}
if (value->wvw_lounge_map == true) {
output = output + "wvwlounge";
flag_values.push_back("wvwlounge");
}
string output = join(flag_values, ",");
return " " + attribute_name + "=\"" + output + "\"";
}

Expand Down
23 changes: 12 additions & 11 deletions xml_converter/src/attribute/mount_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,37 +73,38 @@ void xml_attribute_to_mount_filter(
}

string mount_filter_to_xml_attribute(const std::string& attribute_name, const MountFilter* value) {
string output = "";
vector<string> flag_values;
if (value->raptor == true) {
output = output + "raptor";
flag_values.push_back("raptor");
}
if (value->springer == true) {
output = output + "springer";
flag_values.push_back("springer");
}
if (value->skimmer == true) {
output = output + "skimmer";
flag_values.push_back("skimmer");
}
if (value->jackal == true) {
output = output + "jackal";
flag_values.push_back("jackal");
}
if (value->griffon == true) {
output = output + "griffon";
flag_values.push_back("griffon");
}
if (value->roller_beetle == true) {
output = output + "rollerbeetle";
flag_values.push_back("rollerbeetle");
}
if (value->warclaw == true) {
output = output + "warclaw";
flag_values.push_back("warclaw");
}
if (value->skyscale == true) {
output = output + "skyscale";
flag_values.push_back("skyscale");
}
if (value->skiff == true) {
output = output + "skiff";
flag_values.push_back("skiff");
}
if (value->seige_turtle == true) {
output = output + "seigeturtle";
flag_values.push_back("seigeturtle");
}
string output = join(flag_values, ",");
return " " + attribute_name + "=\"" + output + "\"";
}

Expand Down
21 changes: 11 additions & 10 deletions xml_converter/src/attribute/profession_filter_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,35 @@ void xml_attribute_to_profession_filter(
}

string profession_filter_to_xml_attribute(const std::string& attribute_name, const ProfessionFilter* value) {
string output = "";
vector<string> flag_values;
if (value->guardian == true) {
output = output + "guardian";
flag_values.push_back("guardian");
}
if (value->warrior == true) {
output = output + "warrior";
flag_values.push_back("warrior");
}
if (value->engineer == true) {
output = output + "engineer";
flag_values.push_back("engineer");
}
if (value->ranger == true) {
output = output + "ranger";
flag_values.push_back("ranger");
}
if (value->thief == true) {
output = output + "thief";
flag_values.push_back("thief");
}
if (value->elementalist == true) {
output = output + "elementalist";
flag_values.push_back("elementalist");
}
if (value->mesmer == true) {
output = output + "mesmer";
flag_values.push_back("mesmer");
}
if (value->necromancer == true) {
output = output + "necromancer";
flag_values.push_back("necromancer");
}
if (value->revenant == true) {
output = output + "revenant";
flag_values.push_back("revenant");
}
string output = join(flag_values, ",");
return " " + attribute_name + "=\"" + output + "\"";
}

Expand Down
Loading

0 comments on commit f38417d

Please sign in to comment.