diff options
Diffstat (limited to 'src/UI/SlotArea.cpp')
-rw-r--r-- | src/UI/SlotArea.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index c6c06b084..c15a34714 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1698,18 +1698,18 @@ void cSlotAreaEnchanting::UpdateResult(cPlayer & a_Player) } // Pseudocode found at: https://minecraft.gamepedia.com/Enchanting_mechanics - const auto Bookshelves = std::min(static_cast<int>(GetBookshelvesCount(*a_Player.GetWorld())), 15); + const auto Bookshelves = std::min(GetBookshelvesCount(*a_Player.GetWorld()), 15U); // 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(1, 8) + (Bookshelves / 2) + Random.RandInt(0, Bookshelves)); - const std::array<short, 3> OptionLevels + const auto Base = (Random.RandInt(1U, 8U) + (Bookshelves / 2) + Random.RandInt(0U, Bookshelves)); + const std::array<unsigned, 3> OptionLevels { - static_cast<short>(std::max(Base / 3, 1)), - static_cast<short>((Base * 2) / 3 + 1), - static_cast<short>(std::max(Base, Bookshelves * 2)) + std::max(Base / 3, 1U), + (Base * 2) / 3 + 1, + std::max(Base, Bookshelves * 2) }; // Properties set according to: https://wiki.vg/Protocol#Window_Property @@ -1728,7 +1728,7 @@ 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, OptionLevels[i]); + m_ParentWindow.SetProperty(i, static_cast<short>(OptionLevels[i])); // Get the first enchantment ID, which must exist: ASSERT(EnchantedItem.m_Enchantments.begin() != EnchantedItem.m_Enchantments.end()); |