diff options
Diffstat (limited to 'tools/datapacker')
-rw-r--r-- | tools/datapacker/main.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index c5a90e9..3ddb11f 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp | |||
@@ -68,11 +68,28 @@ class DataPacker { | |||
68 | void ProcessMap(std::filesystem::path path) { | 68 | void ProcessMap(std::filesystem::path path) { |
69 | std::string map_name = path.filename().string(); | 69 | std::string map_name = path.filename().string(); |
70 | 70 | ||
71 | ProcessMapMetadataFile(path / "metadata.txtpb", map_name); | ||
71 | ProcessConnectionsFile(path / "connections.txtpb", map_name); | 72 | ProcessConnectionsFile(path / "connections.txtpb", map_name); |
72 | ProcessDoorsFile(path / "doors.txtpb", map_name); | 73 | ProcessDoorsFile(path / "doors.txtpb", map_name); |
73 | ProcessRooms(path / "rooms", map_name); | 74 | ProcessRooms(path / "rooms", map_name); |
74 | } | 75 | } |
75 | 76 | ||
77 | void ProcessMapMetadataFile(std::filesystem::path path, | ||
78 | const std::string& map_name) { | ||
79 | if (!std::filesystem::exists(path)) { | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | auto metadata = ReadMessageFromFile<HumanMap>(path.string()); | ||
84 | |||
85 | uint64_t map_id = container_.FindOrAddMap(map_name); | ||
86 | Map& map = *container_.all_objects().mutable_maps(map_id); | ||
87 | |||
88 | if (metadata.has_display_name()) { | ||
89 | map.set_display_name(metadata.display_name()); | ||
90 | } | ||
91 | } | ||
92 | |||
76 | void ProcessRooms(std::filesystem::path path, | 93 | void ProcessRooms(std::filesystem::path path, |
77 | const std::string& current_map_name) { | 94 | const std::string& current_map_name) { |
78 | for (auto const& dir_entry : std::filesystem::directory_iterator(path)) { | 95 | for (auto const& dir_entry : std::filesystem::directory_iterator(path)) { |