OSDN Git Service

[Refactor] 修正不足で無駄に冗長していたテーブル代入処理を2か所修正。
authorDeskull <sikabane-works@users.noreply.github.com>
Sun, 30 Oct 2022 11:56:23 +0000 (20:56 +0900)
committerDeskull <sikabane-works@users.noreply.github.com>
Sun, 30 Oct 2022 12:13:11 +0000 (21:13 +0900)
src/market/building-initializer.cpp

index 6d43316..9af848c 100644 (file)
@@ -34,21 +34,13 @@ void init_towns(void)
                 continue;
             }
 
-            const auto store_r = store_regular_sale_table.at(sst);
-            for (const auto kind : store_r) {
-                const auto tv = kind.tval;
-                const auto sv = kind.sval;
-                auto k_idx = lookup_kind(tv, sv);
-
+            for (const auto &kind : store_regular_sale_table.at(sst)) {
+                auto k_idx = lookup_kind(kind.tval, kind.sval);
                 store_ptr->regular.push_back(k_idx);
             }
 
-            const auto store = store_sale_table.at(sst);
-            for (const auto kind : store) {
-                auto tv = kind.tval;
-                auto sv = kind.sval;
-                auto k_idx = lookup_kind(tv, sv);
-
+            for (const auto &kind : store_sale_table.at(sst)) {
+                auto k_idx = lookup_kind(kind.tval, kind.sval);
                 store_ptr->table.push_back(k_idx);
             }
         }