fix(resourceupdater): change roomType to int for infraststructure gamedata

This commit is contained in:
Constrat
2025-05-01 14:49:25 +02:00
parent 30c61c01fd
commit 2d41e454ee

View File

@@ -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<std::string> rooms;
for (auto& buff_obj : buffs | asst::views::values) {
std::string raw_room_type = static_cast<std::string>(buff_obj["roomType"]);
int raw_room_type = static_cast<int>(buff_obj["roomType"]);
// 为了兼容老版本的字段 orz
static const std::unordered_map<std::string, std::string> RoomTypeMapping = {
{ "POWER", "Power" }, { "CONTROL", "Control" }, { "DORMITORY", "Dorm" },
{ "WORKSHOP", "" }, { "MANUFACTURE", "Mfg" }, { "TRADING", "Trade" },
{ "MEETING", "Reception" }, { "HIRE", "Office" }, { "TRAINING", "" },
// static const std::unordered_map<std::string, std::string> 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<int, std::string> 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);