From: Habu Date: Thu, 9 Sep 2021 13:18:10 +0000 (+0900) Subject: [Fix] MSVC の警告に対応 X-Git-Tag: vmacos3.0.0-alpha52~107^2~2^2~7 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f761007618b510501c66eb95d23a59ccf41186dc;p=hengbandforosx%2Fhengbandosx.git [Fix] MSVC の警告に対応 以下の警告が出ていたので対応する。 - const な std::vector があるとムーブコンストラクタが暗黙に削除される - 整数型のナローイング --- diff --git a/src/object-enchant/object-smith.cpp b/src/object-enchant/object-smith.cpp index 942fc6c3c..6d035dfa1 100644 --- a/src/object-enchant/object-smith.cpp +++ b/src/object-enchant/object-smith.cpp @@ -160,7 +160,7 @@ const std::unordered_map essence_to_name = { */ struct essence_drain_type { tr_type tr_flag; //!< 抽出する対象アイテムの持つ特性フラグ - const std::vector essences; //!< 抽出されるエッセンスのリスト + std::vector essences; //!< 抽出されるエッセンスのリスト int amount; //! エッセンス抽出量。ただしマイナスのものは抽出時のペナルティ源として扱う }; @@ -338,7 +338,7 @@ struct smith_info_type { SmithEffect effect; //!< 鍛冶で与える効果の種類 concptr name; //!< 鍛冶で与える能力の名称 SmithCategory category; //!< 鍛冶で与える能力が所属するグループ - const std::vector need_essences; //!< 能力を与えるのに必要なエッセンスのリスト + std::vector need_essences; //!< 能力を与えるのに必要なエッセンスのリスト int consumption; //!< 能力を与えるのに必要な消費量(need_essencesに含まれるエッセンスそれぞれについてこの量を消費) TrFlags add_flags; //!< 鍛冶で能力を与えることにより付与されるアイテム特性フラグ }; @@ -850,8 +850,8 @@ bool Smith::add_essence(SmithEffect effect, object_type *o_ptr, int number) } if (effect == SmithEffect::SLAY_GLOVE) { - auto get_to_h = ((number + 1) / 2 + randint0(number / 2 + 1)); - auto get_to_d = ((number + 1) / 2 + randint0(number / 2 + 1)); + HIT_PROB get_to_h = ((number + 1) / 2 + randint0(number / 2 + 1)); + HIT_POINT get_to_d = ((number + 1) / 2 + randint0(number / 2 + 1)); o_ptr->xtra4 = (get_to_h << 8) + get_to_d; o_ptr->to_h += get_to_h; o_ptr->to_d += get_to_d; @@ -862,15 +862,15 @@ bool Smith::add_essence(SmithEffect effect, object_type *o_ptr, int number) if ((o_ptr->to_h >= max_val) && (o_ptr->to_d >= max_val)) { return false; } else { - o_ptr->to_h = std::min(o_ptr->to_h + 1, max_val); - o_ptr->to_d = std::min(o_ptr->to_d + 1, max_val); + o_ptr->to_h = static_cast(std::min(o_ptr->to_h + 1, max_val)); + o_ptr->to_d = static_cast(std::min(o_ptr->to_d + 1, max_val)); } } else if (effect == SmithEffect::AC) { const auto max_val = this->player_ptr->lev / 5 + 5; if (o_ptr->to_a >= max_val) { return false; } else { - o_ptr->to_a = std::min(o_ptr->to_a + 1, max_val); + o_ptr->to_a = static_cast(std::min(o_ptr->to_a + 1, max_val)); } } else if (effect == SmithEffect::SUSTAIN) { o_ptr->art_flags.set(TR_IGNORE_ACID);