OSDN Git Service

[Refactor] #2635 drop_artifact_from_unique() で、forループ内のオブジェクト取得処理がコピーだったのを参照に変え、ウィザード...
authorHourier <66951241+Hourier@users.noreply.github.com>
Fri, 16 Sep 2022 10:13:08 +0000 (19:13 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Fri, 16 Sep 2022 10:13:08 +0000 (19:13 +0900)
src/monster-floor/monster-death.cpp

index a336525..64e0e54 100644 (file)
@@ -157,8 +157,8 @@ static void drop_corpse(PlayerType *player_ptr, monster_death_type *md_ptr)
  */
 static void drop_artifact_from_unique(PlayerType *player_ptr, monster_death_type *md_ptr)
 {
-    for (auto [a_idx, chance] : md_ptr->r_ptr->drop_artifacts) {
-        if ((randint0(100) >= chance) && !w_ptr->wizard) {
+    for (const auto &[a_idx, chance] : md_ptr->r_ptr->drop_artifacts) {
+        if (!w_ptr->wizard && (randint0(100) >= chance)) {
             continue;
         }