Merge pull request #1112 from GriffinRichards/add-genwarn

Add warnings to generated map/layout files
This commit is contained in:
GriffinR 2020-07-28 17:47:55 -04:00 committed by GitHub
commit c6b27013cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 0 deletions

View File

@ -1,6 +1,10 @@
#ifndef GUARD_CONSTANTS_LAYOUTS_H #ifndef GUARD_CONSTANTS_LAYOUTS_H
#define GUARD_CONSTANTS_LAYOUTS_H #define GUARD_CONSTANTS_LAYOUTS_H
//
// DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json
//
#define LAYOUT_PETALBURG_CITY 1 #define LAYOUT_PETALBURG_CITY 1
#define LAYOUT_SLATEPORT_CITY 2 #define LAYOUT_SLATEPORT_CITY 2
#define LAYOUT_MAUVILLE_CITY 3 #define LAYOUT_MAUVILLE_CITY 3

View File

@ -1,6 +1,10 @@
#ifndef GUARD_CONSTANTS_MAP_GROUPS_H #ifndef GUARD_CONSTANTS_MAP_GROUPS_H
#define GUARD_CONSTANTS_MAP_GROUPS_H #define GUARD_CONSTANTS_MAP_GROUPS_H
//
// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json
//
// Map Group 0 // Map Group 0
#define MAP_PETALBURG_CITY (0 | (0 << 8)) #define MAP_PETALBURG_CITY (0 | (0 << 8))
#define MAP_SLATEPORT_CITY (1 | (0 << 8)) #define MAP_SLATEPORT_CITY (1 | (0 << 8))

View File

@ -77,6 +77,10 @@ string generate_map_header_text(Json map_data, Json layouts_data, string version
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/"
<< map_data["name"].string_value()
<< "/map.json\n@\n\n";
text << map_data["name"].string_value() << ":\n" text << map_data["name"].string_value() << ":\n"
<< "\t.4byte " << layout["name"].string_value() << "\n"; << "\t.4byte " << layout["name"].string_value() << "\n";
@ -124,6 +128,10 @@ string generate_map_connections_text(Json map_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/"
<< map_data["name"].string_value()
<< "/map.json\n@\n\n";
text << map_data["name"].string_value() << "_MapConnectionsList:\n"; text << map_data["name"].string_value() << "_MapConnectionsList:\n";
for (auto &connection : map_data["connections"].array_items()) { for (auto &connection : map_data["connections"].array_items()) {
@ -146,6 +154,10 @@ string generate_map_events_text(Json map_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/"
<< map_data["name"].string_value()
<< "/map.json\n@\n\n";
string objects_label, warps_label, coords_label, bgs_label; string objects_label, warps_label, coords_label, bgs_label;
if (map_data["object_events"].array_items().size() > 0) { if (map_data["object_events"].array_items().size() > 0) {
@ -286,6 +298,8 @@ void process_map(string map_filepath, string layouts_filepath, string version) {
string generate_groups_text(Json groups_data) { string generate_groups_text(Json groups_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (auto &key : groups_data["group_order"].array_items()) { for (auto &key : groups_data["group_order"].array_items()) {
string group = key.string_value(); string group = key.string_value();
text << group << "::\n"; text << group << "::\n";
@ -325,6 +339,8 @@ string generate_connections_text(Json groups_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (Json map_name : map_names) for (Json map_name : map_names)
text << "\t.include \"data/maps/" << map_name.string_value() << "/connections.inc\"\n"; text << "\t.include \"data/maps/" << map_name.string_value() << "/connections.inc\"\n";
@ -340,6 +356,8 @@ string generate_headers_text(Json groups_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (string map_name : map_names) for (string map_name : map_names)
text << "\t.include \"data/maps/" << map_name << "/header.inc\"\n"; text << "\t.include \"data/maps/" << map_name << "/header.inc\"\n";
@ -355,6 +373,8 @@ string generate_events_text(Json groups_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n@\n\n";
for (string map_name : map_names) for (string map_name : map_names)
text << "\t.include \"data/maps/" << map_name << "/events.inc\"\n"; text << "\t.include \"data/maps/" << map_name << "/events.inc\"\n";
@ -370,6 +390,8 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
text << "#ifndef GUARD_CONSTANTS_MAP_GROUPS_H\n" text << "#ifndef GUARD_CONSTANTS_MAP_GROUPS_H\n"
<< "#define GUARD_CONSTANTS_MAP_GROUPS_H\n\n"; << "#define GUARD_CONSTANTS_MAP_GROUPS_H\n\n";
text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n";
int group_num = 0; int group_num = 0;
for (auto &group : groups_data["group_order"].array_items()) { for (auto &group : groups_data["group_order"].array_items()) {
@ -428,6 +450,8 @@ void process_groups(string groups_filepath) {
string generate_layout_headers_text(Json layouts_data) { string generate_layout_headers_text(Json layouts_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n@\n\n";
for (auto &layout : layouts_data["layouts"].array_items()) { for (auto &layout : layouts_data["layouts"].array_items()) {
string border_label = layout["name"].string_value() + "_Border"; string border_label = layout["name"].string_value() + "_Border";
string blockdata_label = layout["name"].string_value() + "_Blockdata"; string blockdata_label = layout["name"].string_value() + "_Blockdata";
@ -451,6 +475,8 @@ string generate_layout_headers_text(Json layouts_data) {
string generate_layouts_table_text(Json layouts_data) { string generate_layouts_table_text(Json layouts_data) {
ostringstream text; ostringstream text;
text << "@\n@ DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n@\n\n";
text << "\t.align 2\n" text << "\t.align 2\n"
<< layouts_data["layouts_table_label"].string_value() << "::\n"; << layouts_data["layouts_table_label"].string_value() << "::\n";
@ -466,6 +492,8 @@ string generate_layouts_constants_text(Json layouts_data) {
text << "#ifndef GUARD_CONSTANTS_LAYOUTS_H\n" text << "#ifndef GUARD_CONSTANTS_LAYOUTS_H\n"
<< "#define GUARD_CONSTANTS_LAYOUTS_H\n\n"; << "#define GUARD_CONSTANTS_LAYOUTS_H\n\n";
text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/layouts/layouts.json\n//\n\n";
int i = 0; int i = 0;
for (auto &layout : layouts_data["layouts"].array_items()) for (auto &layout : layouts_data["layouts"].array_items())
text << "#define " << layout["id"].string_value() << " " << ++i << "\n"; text << "#define " << layout["id"].string_value() << " " << ++i << "\n";