From a9031b6bae742b333b1b390192fa590f2ecb07ea Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Mon, 5 Oct 2020 11:27:14 +0100 Subject: Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963) * Fix cmake not adding Werror on clang, and _lots_ of warnings * WIP: Build fixes * Cannot make intermediate blockhandler instance * Tiger's changes * Fix BitIndex check * Handle invalid NextState values in cMultiVersionProtocol Co-authored-by: Tiger Wang --- src/UI/SlotArea.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/UI') diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 53d406e65..a452227f8 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1684,18 +1684,18 @@ void cSlotAreaEnchanting::UpdateResult(cPlayer & a_Player) } // Pseudocode found at: https://minecraft.gamepedia.com/Enchanting_mechanics - const auto Bookshelves = std::min(GetBookshelvesCount(*a_Player.GetWorld()), 15U); + const auto Bookshelves = std::min(static_cast(GetBookshelvesCount(*a_Player.GetWorld())), 15); // A PRNG initialised using the player's enchantment seed. auto Random = a_Player.GetEnchantmentRandomProvider(); // Calculate the levels for the offered enchantment options: - const auto Base = (Random.RandInt(1U, 8U) + (Bookshelves / 2) + Random.RandInt(0U, Bookshelves)); - const std::array OptionLevels + const auto Base = (Random.RandInt(1, 8) + (Bookshelves / 2) + Random.RandInt(0, Bookshelves)); + const std::array OptionLevels { - std::max(Base / 3, 1U), - (Base * 2) / 3 + 1, - std::max(Base, Bookshelves * 2) + static_cast(std::max(Base / 3, 1)), + static_cast((Base * 2) / 3 + 1), + static_cast(std::max(Base, Bookshelves * 2)) }; // Properties set according to: https://wiki.vg/Protocol#Window_Property @@ -1714,16 +1714,16 @@ void cSlotAreaEnchanting::UpdateResult(cPlayer & a_Player) LOGD("Generated enchanted item %d with enchantments: %s", i, EnchantedItem.m_Enchantments.ToString()); // Send the level requirement for the enchantment option: - m_ParentWindow.SetProperty(i, static_cast(OptionLevels[i])); + m_ParentWindow.SetProperty(i, OptionLevels[i]); // Get the first enchantment ID, which must exist: ASSERT(EnchantedItem.m_Enchantments.begin() != EnchantedItem.m_Enchantments.end()); - const short EnchantmentID = static_cast(EnchantedItem.m_Enchantments.begin()->first); + const auto EnchantmentID = static_cast(EnchantedItem.m_Enchantments.begin()->first); // Send the enchantment ID of the first enchantment on our item: m_ParentWindow.SetProperty(4 + i, EnchantmentID); - const short EnchantmentLevel = static_cast(EnchantedItem.m_Enchantments.GetLevel(EnchantmentID)); + const auto EnchantmentLevel = static_cast(EnchantedItem.m_Enchantments.GetLevel(EnchantmentID)); ASSERT(EnchantmentLevel > 0); // Send the level for the first enchantment on our item: -- cgit v1.2.3