Warnings improvements
* Turn off global-constructors warning. These are needed to implement cRoot signal handler functionality
* Add Clang flags based on version lookup instead of a compile test. The CMake config process is single threaded and slow enough already
* Reduced GetStackValue verbosity
+ Clarify EnchantmentLevel, StayCount, AlwaysTicked, ViewDistance signedness
+ Give SettingsRepositoryInterface a move constructor to simplify main.cpp code
- Remove do {} while (false) construction in redstone handler
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user