From 2439f42de4cdeeb87ee5e574926036707cd0dab6 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 24 Jul 2020 03:43:37 -0400 Subject: [PATCH] Add warnings to generated files --- include/constants/layouts.h | 4 ++++ include/constants/map_groups.h | 4 ++++ tools/mapjson/mapjson.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/include/constants/layouts.h b/include/constants/layouts.h index 3e876f499..500b82cd4 100755 --- a/include/constants/layouts.h +++ b/include/constants/layouts.h @@ -1,6 +1,10 @@ #ifndef 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_SLATEPORT_CITY 2 #define LAYOUT_MAUVILLE_CITY 3 diff --git a/include/constants/map_groups.h b/include/constants/map_groups.h index 17fe7ab53..aef9924fa 100755 --- a/include/constants/map_groups.h +++ b/include/constants/map_groups.h @@ -1,6 +1,10 @@ #ifndef 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 #define MAP_PETALBURG_CITY (0 | (0 << 8)) #define MAP_SLATEPORT_CITY (1 | (0 << 8)) diff --git a/tools/mapjson/mapjson.cpp b/tools/mapjson/mapjson.cpp index 55335e382..5e246ff24 100644 --- a/tools/mapjson/mapjson.cpp +++ b/tools/mapjson/mapjson.cpp @@ -77,6 +77,10 @@ string generate_map_header_text(Json map_data, Json layouts_data, string version 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" << "\t.4byte " << layout["name"].string_value() << "\n"; @@ -124,6 +128,10 @@ string generate_map_connections_text(Json map_data) { 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"; for (auto &connection : map_data["connections"].array_items()) { @@ -146,6 +154,10 @@ string generate_map_events_text(Json map_data) { 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; 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) { 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()) { string group = key.string_value(); text << group << "::\n"; @@ -325,6 +339,8 @@ string generate_connections_text(Json groups_data) { 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) 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; + 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) text << "\t.include \"data/maps/" << map_name << "/header.inc\"\n"; @@ -355,6 +373,8 @@ string generate_events_text(Json groups_data) { 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) 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" << "#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; 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) { 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()) { string border_label = layout["name"].string_value() + "_Border"; 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) { 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" << 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" << "#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; for (auto &layout : layouts_data["layouts"].array_items()) text << "#define " << layout["id"].string_value() << " " << ++i << "\n";