Add definitions for all RPG::* EnumTags
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -113,6 +113,7 @@ add_library(lcf
src/generated/lsd_savevehiclelocation.cpp
src/generated/rpg_chipset.cpp
src/generated/rpg_mapinfo.cpp
+ src/generated/rpg_enums.cpp
)
# C++11 is required

MODIFY
Makefile.am
Makefile.am
@@ -109,6 +109,7 @@ liblcf_la_SOURCES = \
src/generated/lsd_savevehiclelocation.cpp \
src/generated/rpg_chipset.cpp \
src/generated/rpg_mapinfo.cpp \
+ src/generated/rpg_enums.cpp \
src/boost/preprocessor/cat.hpp \
src/boost/preprocessor/stringize.hpp \
src/boost/preprocessor/config/config.hpp

MODIFY
generator/generate.py
generator/generate.py
@@ -317,6 +317,11 @@ def generate():
type=filetype
))
+ filepath = os.path.join(tmp_dir, 'rpg_enums.cpp')
+
+ with open(filepath, 'w') as f:
+ f.write(enums_tmpl.render())
+
for tmp_file in os.listdir(tmp_dir):
tmp_path = os.path.join(tmp_dir, tmp_file)
dest_path = os.path.join(dest_dir, tmp_file)
@@ -330,7 +335,7 @@ def main(argv):
os.mkdir(dest_dir)
global structs, sfields, enums, flags, setup, headers
- global chunk_tmpl, lcf_struct_tmpl, rpg_header_tmpl, rpg_source_tmpl, flags_tmpl
+ global chunk_tmpl, lcf_struct_tmpl, rpg_header_tmpl, rpg_source_tmpl, flags_tmpl, enums_tmpl
structs = get_structs()
sfields = get_fields()
@@ -362,6 +367,7 @@ def main(argv):
rpg_header_tmpl = env.get_template('rpg_header.tmpl', globals=globals)
rpg_source_tmpl = env.get_template('rpg_source.tmpl', globals=globals)
flags_tmpl = env.get_template('flag_reader.tmpl', globals=globals)
+ enums_tmpl = env.get_template('rpg_enums.tmpl', globals=globals)
generate()

ADD
generator/templates/rpg_enums.tmpl
+{% include "copyright.tmpl" %}
+{%- for ftype, structlist in structs.items() %}
+ {%- for struct in structlist %}
+ {%- if enums[struct.name] %}
+#include "rpg_{{ struct.name|lower }}.h"
+ {%- endif %}
+ {%- endfor %}
+{%- endfor %}
+
+namespace RPG {
+
+{%- for ftype, structlist in structs.items() %}
+ {%- for struct in structlist %}
+ {%- for enum_name in enums[struct.name] %}
+constexpr decltype({{ struct.name }}::k{{ enum_name }}Tags) {{ struct.name }}::k{{ enum_name }}Tags;
+ {%- endfor %}
+ {%- endfor %}
+{%- endfor %}
+
+}

ADD
src/generated/rpg_enums.cpp
src/generated/rpg_enums.cpp
Binary files /dev/null and b/src/generated/rpg_enums.cpp differ

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

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

Add definitions for all RPG::* EnumTags