diff --git a/doc/yaml/sql/item_db_equip.sql b/doc/yaml/sql/item_db_equip.sql new file mode 100644 index 0000000000..9f02662b66 --- /dev/null +++ b/doc/yaml/sql/item_db_equip.sql @@ -0,0 +1,3 @@ +# +# Table data for table `item_db` +# diff --git a/doc/yaml/sql/item_db_etc.sql b/doc/yaml/sql/item_db_etc.sql new file mode 100644 index 0000000000..9f02662b66 --- /dev/null +++ b/doc/yaml/sql/item_db_etc.sql @@ -0,0 +1,3 @@ +# +# Table data for table `item_db` +# diff --git a/doc/yaml/sql/item_db_re_equip.sql b/doc/yaml/sql/item_db_re_equip.sql new file mode 100644 index 0000000000..c5916d98e5 --- /dev/null +++ b/doc/yaml/sql/item_db_re_equip.sql @@ -0,0 +1,3 @@ +# +# Table data for table `item_db_re` +# diff --git a/doc/yaml/sql/item_db_re_etc.sql b/doc/yaml/sql/item_db_re_etc.sql new file mode 100644 index 0000000000..c5916d98e5 --- /dev/null +++ b/doc/yaml/sql/item_db_re_etc.sql @@ -0,0 +1,3 @@ +# +# Table data for table `item_db_re` +# diff --git a/doc/yaml/sql/item_db_re_usable.sql b/doc/yaml/sql/item_db_re_usable.sql new file mode 100644 index 0000000000..c5916d98e5 --- /dev/null +++ b/doc/yaml/sql/item_db_re_usable.sql @@ -0,0 +1,3 @@ +# +# Table data for table `item_db_re` +# diff --git a/doc/yaml/sql/item_db_usable.sql b/doc/yaml/sql/item_db_usable.sql new file mode 100644 index 0000000000..9f02662b66 --- /dev/null +++ b/doc/yaml/sql/item_db_usable.sql @@ -0,0 +1,3 @@ +# +# Table data for table `item_db` +# diff --git a/src/tool/yaml2sql.cpp b/src/tool/yaml2sql.cpp index 62686cd258..3a2440a513 100644 --- a/src/tool/yaml2sql.cpp +++ b/src/tool/yaml2sql.cpp @@ -78,10 +78,11 @@ void prepareHeader(std::ofstream &file, const std::string& name) { } template -bool process( const std::string& type, uint32 version, const std::vector& paths, const std::string& name, const std::string& to, const std::string& table, Func lambda ){ +bool process( const std::string& type, uint32 version, const std::vector& paths, const std::string& name, const std::string& to_table, const std::string& table, Func lambda ){ for( const std::string& path : paths ){ const std::string name_ext = name + ".yml"; const std::string from = path + name_ext; + const std::string to = "sql-files/" + to_table + ".sql"; if( fileExists( from ) ){ if( !askConfirmation( "Found the file \"%s\", which can be converted to sql.\nDo you want to convert it now? (Y/N)\n", from.c_str() ) ){ @@ -114,7 +115,7 @@ bool process( const std::string& type, uint32 version, const std::vector bool { + if (!process("ITEM_DB", 1, { path_db_mode }, "item_db_" + suffix, item_table_name + "_" + suffix, item_table_name, [](const std::string& path, const std::string& name_ext, const std::string& table) -> bool { return item_db_yaml2sql(path + name_ext, table); })) { return 0; } } - if (!process("ITEM_DB", 1, { path_db_import }, "item_db", "sql-files/" + item_import_table_name + ".sql", item_import_table_name, [](const std::string& path, const std::string& name_ext, const std::string& table) -> bool { + if (!process("ITEM_DB", 1, { path_db_import }, "item_db", item_import_table_name, item_import_table_name, [](const std::string& path, const std::string& name_ext, const std::string& table) -> bool { return item_db_yaml2sql(path + name_ext, table); })) { return 0;