Generate operator== for Flags and use presentifdefault
Fixes SavePicture::Flags default behavior
MODIFY
generator/csv/fields.csv
generator/csv/fields.csv
@@ -627,7 +627,7 @@ Start,ship_y,f,Int32,0x17,0,0,0,Integer
Start,airship_map_id,f,Ref<Map>,0x1F,0,0,0,Integer
Start,airship_x,f,Int32,0x20,0,0,0,Integer
Start,airship_y,f,Int32,0x21,0,0,0,Integer
-EventPageCondition,flags,f,EventPageCondition_Flags,0x01,,0,0,Bitflag
+EventPageCondition,flags,f,EventPageCondition_Flags,0x01,,1,0,Bitflag
EventPageCondition,switch_a_id,f,Ref<Switch>,0x02,1,0,0,Integer
EventPageCondition,switch_b_id,f,Ref<Switch>,0x03,1,0,0,Integer
EventPageCondition,variable_id,f,Ref<Variable>,0x04,1,0,0,Integer

MODIFY
generator/templates/rpg_header.tmpl
generator/templates/rpg_header.tmpl
@@ -99,6 +99,21 @@ namespace RPG {
return !(l == r);
}
{%- endif %}
+
+ {%- for field in fields[struct_name]|field_is_used %}
+ {%- if not field.size %}
+ {%- if field.type.endswith("_Flags") %}
+
+ inline bool operator==(const {{ struct_name }}::Flags& l, const {{ struct_name }}::Flags& r) {
+ return l.flags == r.flags;
+ }
+
+ inline bool operator!=(const {{ struct_name }}::Flags& l, const {{ struct_name }}::Flags& r) {
+ return !(l == r);
+ }
+ {%- endif %}
+ {%- endif %}
+ {%- endfor %}
}
#endif

MODIFY
src/generated/lmu_eventpagecondition.cpp
src/generated/lmu_eventpagecondition.cpp
Binary files a/src/generated/lmu_eventpagecondition.cpp and b/src/generated/lmu_eventpagecondition.cpp differ

MODIFY
src/generated/rpg_eventpagecondition.h
src/generated/rpg_eventpagecondition.h
Binary files a/src/generated/rpg_eventpagecondition.h and b/src/generated/rpg_eventpagecondition.h differ

MODIFY
src/generated/rpg_savepicture.h
src/generated/rpg_savepicture.h
Binary files a/src/generated/rpg_savepicture.h and b/src/generated/rpg_savepicture.h differ

MODIFY
src/generated/rpg_terrain.h
src/generated/rpg_terrain.h
Binary files a/src/generated/rpg_terrain.h and b/src/generated/rpg_terrain.h differ

MODIFY
src/generated/rpg_trooppagecondition.h
src/generated/rpg_trooppagecondition.h
Binary files a/src/generated/rpg_trooppagecondition.h and b/src/generated/rpg_trooppagecondition.h differ

MODIFY
src/reader_struct.h
src/reader_struct.h
@@ -354,6 +354,11 @@ struct Compare_Test<RPG::Terrain::Flags> {
static const bool value = true;
};
+template <>
+struct Compare_Test<RPG::SavePicture::Flags> {
+ static const bool value = true;
+};
+
template <class T, bool comparable>
struct Compare_Traits_Impl {};
@@ -378,13 +383,6 @@ struct Compare_Traits_Impl<std::vector<T>, false> {
}
};
-template <>
-struct Compare_Traits_Impl<RPG::Terrain::Flags, true> {
- static bool IsEqual(const RPG::Terrain::Flags& l, const RPG::Terrain::Flags& r) {
- return l.flags == r.flags;
- }
-};
-
template <class T>
struct Compare_Traits {
typedef Compare_Traits_Impl<T, Compare_Test<T>::value> impl_type;
@@ -393,13 +391,6 @@ struct Compare_Traits {
}
};
-template <>
-struct Compare_Traits<RPG::Terrain::Flags> {
- static bool IsEqual(const RPG::Terrain::Flags& a, const RPG::Terrain::Flags& b) {
- return a.flags == b.flags;
- }
-};
-
/**
* TypedField class template.
*/

Generate operator== for Flags and use presentifdefault

Fixes SavePicture::Flags default behavior