diff --git a/CMakeLists.txt b/CMakeLists.txt index e66cb373e..00e880381 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,8 @@ add_library(lcf src/generated/lsd_savevehiclelocation.cpp src/generated/rpg_chipset.cpp src/generated/rpg_enums.cpp + src/generated/rpg_savepartylocation.cpp + src/generated/rpg_state.cpp src/generated/rpg_system.cpp ) diff --git a/Makefile.am b/Makefile.am index b3f170ee8..fee13ba16 100644 --- a/Makefile.am +++ b/Makefile.am @@ -111,6 +111,8 @@ liblcf_la_SOURCES = \ src/generated/lsd_savevehiclelocation.cpp \ src/generated/rpg_chipset.cpp \ src/generated/rpg_enums.cpp \ + src/generated/rpg_savepartylocation.cpp \ + src/generated/rpg_state.cpp \ src/generated/rpg_system.cpp pkginclude_HEADERS = \ src/command_codes.h \ diff --git a/builds/vs2015/liblcf.vcxproj b/builds/vs2015/liblcf.vcxproj index 2c4437d52..f1459f3b6 100644 --- a/builds/vs2015/liblcf.vcxproj +++ b/builds/vs2015/liblcf.vcxproj @@ -264,6 +264,8 @@ + + diff --git a/generator/generate.py b/generator/generate.py index c86976d25..076b3f1f1 100755 --- a/generator/generate.py +++ b/generator/generate.py @@ -339,7 +339,7 @@ def generate(): type=filetype )) - if needs_ctor(struct.name): + if needs_ctor(struct.name) or struct.name in constants: filepath = os.path.join(tmp_dir, 'rpg_%s.cpp' % filename) with open(filepath, 'w') as f: f.write(rpg_source_tmpl.render( diff --git a/generator/templates/rpg_source.tmpl b/generator/templates/rpg_source.tmpl index e6299ec39..4d9e6b269 100644 --- a/generator/templates/rpg_source.tmpl +++ b/generator/templates/rpg_source.tmpl @@ -1,10 +1,16 @@ {% include "copyright.tmpl" %} // Headers #include "rpg_{{ filename }}.h" - +{% if struct_name in constants -%} +{%- for name, type, value, comment in constants[struct_name] %} +constexpr {{ type }} RPG::{{ struct_name }}::{{ name }}; +{%- endfor %} +{%- endif %} +{% if struct_name is needs_ctor -%} /** * Constructor. */ RPG::{{ struct_name }}::{{ struct_name }}() { Init(); } +{%- endif %} diff --git a/src/generated/rpg_savepartylocation.cpp b/src/generated/rpg_savepartylocation.cpp new file mode 100644 index 000000000..4455e329e --- /dev/null +++ b/src/generated/rpg_savepartylocation.cpp @@ -0,0 +1,17 @@ +/* !!!! GENERATED FILE - DO NOT EDIT !!!! + * -------------------------------------- + * + * This file is part of liblcf. Copyright (c) 2018 liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +// Headers +#include "rpg_savepartylocation.h" + +constexpr int RPG::SavePartyLocation::kPanXDefault; +constexpr int RPG::SavePartyLocation::kPanYDefault; + diff --git a/src/generated/rpg_state.cpp b/src/generated/rpg_state.cpp new file mode 100644 index 000000000..c3d53a807 --- /dev/null +++ b/src/generated/rpg_state.cpp @@ -0,0 +1,16 @@ +/* !!!! GENERATED FILE - DO NOT EDIT !!!! + * -------------------------------------- + * + * This file is part of liblcf. Copyright (c) 2018 liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +// Headers +#include "rpg_state.h" + +constexpr int RPG::State::kDeathID; +