diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-07 17:18:47 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-08-07 17:18:47 -0400 |
| commit | c0c5431800d0306d01814e9902566c9b4fc9220b (patch) | |
| tree | 50d206c31bb7f535c3f2ca0b8d0f735c5a61f9a5 /tools/datapacker/main.cpp | |
| parent | c9da387ede51f207825b63d9f13036a7b661d4b3 (diff) | |
| download | lingo2-archipelago-c0c5431800d0306d01814e9902566c9b4fc9220b.tar.gz lingo2-archipelago-c0c5431800d0306d01814e9902566c9b4fc9220b.tar.bz2 lingo2-archipelago-c0c5431800d0306d01814e9902566c9b4fc9220b.zip | |
Assign AP IDs to doors and panels
Diffstat (limited to 'tools/datapacker/main.cpp')
| -rw-r--r-- | tools/datapacker/main.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
| diff --git a/tools/datapacker/main.cpp b/tools/datapacker/main.cpp index 1dcd109..4b26141 100644 --- a/tools/datapacker/main.cpp +++ b/tools/datapacker/main.cpp | |||
| @@ -42,6 +42,7 @@ class DataPacker { | |||
| 42 | 42 | ||
| 43 | ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt); | 43 | ProcessConnectionsFile(datadir_path / "connections.txtpb", std::nullopt); |
| 44 | ProcessMaps(datadir_path); | 44 | ProcessMaps(datadir_path); |
| 45 | ProcessIdsFile(datadir_path / "ids.txtpb"); | ||
| 45 | 46 | ||
| 46 | { | 47 | { |
| 47 | std::ofstream outputfile(outputpath_); | 48 | std::ofstream outputfile(outputpath_); |
| @@ -389,6 +390,26 @@ class DataPacker { | |||
| 389 | } | 390 | } |
| 390 | } | 391 | } |
| 391 | 392 | ||
| 393 | void ProcessIdsFile(std::filesystem::path path) { | ||
| 394 | auto ids = ReadMessageFromFile<IdMappings>(path.string()); | ||
| 395 | |||
| 396 | for (const auto& [map_name, map] : ids.maps()) { | ||
| 397 | for (const auto& [door_name, ap_id] : map.doors()) { | ||
| 398 | uint64_t door_id = | ||
| 399 | container_.FindOrAddDoor(map_name, door_name, std::nullopt); | ||
| 400 | container_.all_objects().mutable_doors(door_id)->set_ap_id(ap_id); | ||
| 401 | } | ||
| 402 | |||
| 403 | for (const auto& [room_name, room] : map.rooms()) { | ||
| 404 | for (const auto& [panel_name, ap_id] : room.panels()) { | ||
| 405 | uint64_t panel_id = container_.FindOrAddPanel( | ||
| 406 | map_name, room_name, panel_name, std::nullopt, std::nullopt); | ||
| 407 | container_.all_objects().mutable_panels(panel_id)->set_ap_id(ap_id); | ||
| 408 | } | ||
| 409 | } | ||
| 410 | } | ||
| 411 | } | ||
| 412 | |||
| 392 | std::string mapdir_; | 413 | std::string mapdir_; |
| 393 | std::string outputpath_; | 414 | std::string outputpath_; |
| 394 | 415 | ||
