From 2d41e454ee9bf6c2fd727d49ee503077df58bc13 Mon Sep 17 00:00:00 2001 From: Constrat <56174894+Constrat@users.noreply.github.com> Date: Thu, 1 May 2025 14:49:25 +0200 Subject: [PATCH] fix(resourceupdater): change roomType to int for infraststructure gamedata --- tools/ResourceUpdater/main.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/ResourceUpdater/main.cpp b/tools/ResourceUpdater/main.cpp index ca018aca7f..4b32cb8f29 100644 --- a/tools/ResourceUpdater/main.cpp +++ b/tools/ResourceUpdater/main.cpp @@ -586,13 +586,19 @@ bool update_infrast_data(const fs::path& input_dir, const fs::path& output_dir) json::value& root = old_json; std::unordered_set rooms; for (auto& buff_obj : buffs | asst::views::values) { - std::string raw_room_type = static_cast(buff_obj["roomType"]); + int raw_room_type = static_cast(buff_obj["roomType"]); // 为了兼容老版本的字段 orz - static const std::unordered_map RoomTypeMapping = { - { "POWER", "Power" }, { "CONTROL", "Control" }, { "DORMITORY", "Dorm" }, - { "WORKSHOP", "" }, { "MANUFACTURE", "Mfg" }, { "TRADING", "Trade" }, - { "MEETING", "Reception" }, { "HIRE", "Office" }, { "TRAINING", "" }, + // static const std::unordered_map RoomTypeMapping = { + // { "POWER", "Power" }, { "CONTROL", "Control" }, { "DORMITORY", "Dorm" }, + // { "WORKSHOP", "" }, { "MANUFACTURE", "Mfg" }, { "TRADING", "Trade" }, + // { "MEETING", "Reception" }, { "HIRE", "Office" }, { "TRAINING", "" }, + //}; + // 2025-05-01 no longer using strings as roomType + + static const std::unordered_map RoomTypeMapping = { + { 1, "Control" }, { 2, "Power" }, { 4, "Mfg" }, { 16, "Dorm" }, { 32, "Reception" }, + { 64, "Office" }, { 512, "Trade" }, { 1024, "" }, { 2048, "" }, }; std::string room_type = RoomTypeMapping.at(raw_room_type);