From 250b8eb652a57dcbdff4af7b6efb9c2554b45798 Mon Sep 17 00:00:00 2001 From: x12xx12x <44411062+12xx12@users.noreply.github.com> Date: Fri, 26 Nov 2021 00:51:47 +0100 Subject: Fixed Compiler Warnings --- src/UI/BeaconWindow.cpp | 4 ++-- src/UI/SlotArea.cpp | 4 ++-- src/UI/Window.cpp | 16 ++++++++-------- src/UI/Window.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/UI') diff --git a/src/UI/BeaconWindow.cpp b/src/UI/BeaconWindow.cpp index d72eb5603..43addf630 100644 --- a/src/UI/BeaconWindow.cpp +++ b/src/UI/BeaconWindow.cpp @@ -67,8 +67,8 @@ void cBeaconWindow::OpenedByPlayer(cPlayer & a_Player) Super::OpenedByPlayer(a_Player); a_Player.GetClientHandle()->SendWindowProperty(*this, 0, m_Beacon->GetBeaconLevel()); - a_Player.GetClientHandle()->SendWindowProperty(*this, 1, m_Beacon->GetPrimaryEffect()); - a_Player.GetClientHandle()->SendWindowProperty(*this, 2, m_Beacon->GetSecondaryEffect()); + a_Player.GetClientHandle()->SendWindowProperty(*this, 1, static_cast(m_Beacon->GetPrimaryEffect())); + a_Player.GetClientHandle()->SendWindowProperty(*this, 2, static_cast(m_Beacon->GetSecondaryEffect())); } diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 0b060a5e4..bf328154d 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -399,7 +399,7 @@ bool cSlotArea::CollectItemsToHand(cItem & a_Dragging, cPlayer & a_Player, bool { continue; } - int ToMove = a_Dragging.GetMaxStackSize() - a_Dragging.m_ItemCount; + char ToMove = a_Dragging.GetMaxStackSize() - a_Dragging.m_ItemCount; if (ToMove > SlotItem.m_ItemCount) { ToMove = SlotItem.m_ItemCount; @@ -1167,7 +1167,7 @@ void cSlotAreaAnvil::UpdateResult(cPlayer & a_Player) // Repair until out of materials, or fully repaired: while ((DamageDiff > 0) && (NumItemsConsumed < Sacrifice.m_ItemCount)) { - Output.m_ItemDamage -= DamageDiff; + Output.m_ItemDamage -= static_cast(DamageDiff); NeedExp += std::max(1, DamageDiff / 100) + static_cast(Target.m_Enchantments.Count()); DamageDiff = std::min(static_cast(Output.m_ItemDamage), static_cast(Target.GetMaxDamage()) / 4); diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp index 81704d6f0..89f3812d6 100644 --- a/src/UI/Window.cpp +++ b/src/UI/Window.cpp @@ -636,9 +636,9 @@ void cWindow::OnLeftPaintEnd(cPlayer & a_Player) const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots(); cItem ToDistribute(a_Player.GetDraggingItem()); - int ToEachSlot = static_cast(ToDistribute.m_ItemCount) / static_cast(SlotNums.size()); + char ToEachSlot = ToDistribute.m_ItemCount / static_cast(SlotNums.size()); - int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, ToEachSlot, SlotNums); + char NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, ToEachSlot, SlotNums); // Remove the items distributed from the dragging item: a_Player.GetDraggingItem().m_ItemCount -= NumDistributed; @@ -666,7 +666,7 @@ void cWindow::OnRightPaintEnd(cPlayer & a_Player) const cSlotNums & SlotNums = a_Player.GetInventoryPaintSlots(); cItem ToDistribute(a_Player.GetDraggingItem()); - int NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, 1, SlotNums); + char NumDistributed = DistributeItemToSlots(a_Player, ToDistribute, 1, SlotNums); // Remove the items distributed from the dragging item: a_Player.GetDraggingItem().m_ItemCount -= NumDistributed; @@ -710,7 +710,7 @@ void cWindow::OnMiddlePaintEnd(cPlayer & a_Player) -int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int a_NumToEachSlot, const cSlotNums & a_SlotNums, bool a_LimitItems) +char cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, char a_NumToEachSlot, const cSlotNums & a_SlotNums, bool a_LimitItems) { if (a_LimitItems && (static_cast(a_Item.m_ItemCount) < a_SlotNums.size())) { @@ -720,7 +720,7 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int } // Distribute to individual slots, keep track of how many items were actually distributed (full stacks etc.) - int NumDistributed = 0; + char NumDistributed = 0; for (cSlotNums::const_iterator itr = a_SlotNums.begin(), end = a_SlotNums.end(); itr != end; ++itr) { int LocalSlotNum = 0; @@ -733,19 +733,19 @@ int cWindow::DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int // Modify the item at the slot cItem AtSlot(*Area->GetSlot(LocalSlotNum, a_Player)); - int MaxStack = AtSlot.GetMaxStackSize(); + char MaxStack = AtSlot.GetMaxStackSize(); if (AtSlot.IsEmpty()) { // Empty, just move all of it there: cItem ToStore(a_Item); - ToStore.m_ItemCount = static_cast(std::min(a_NumToEachSlot, static_cast(MaxStack))); + ToStore.m_ItemCount = std::min(a_NumToEachSlot, MaxStack); Area->SetSlot(LocalSlotNum, a_Player, ToStore); NumDistributed += ToStore.m_ItemCount; } else if (AtSlot.IsEqual(a_Item)) { // Occupied, add and cap at MaxStack: - int CanStore = std::min(a_NumToEachSlot, static_cast(MaxStack) - AtSlot.m_ItemCount); + char CanStore = std::min(a_NumToEachSlot, MaxStack - AtSlot.m_ItemCount); AtSlot.m_ItemCount += CanStore; Area->SetSlot(LocalSlotNum, a_Player, AtSlot); NumDistributed += CanStore; diff --git a/src/UI/Window.h b/src/UI/Window.h index 46935acef..3b69b2da4 100644 --- a/src/UI/Window.h +++ b/src/UI/Window.h @@ -222,5 +222,5 @@ protected: /** Distributes a_NumToEachSlot items into the slots specified in a_SlotNums; returns the total number of items distributed. @param a_LimitItems if false, no checks are performed on a_Item.m_ItemCount. */ - int DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int a_NumToEachSlot, const cSlotNums & a_SlotNums, bool a_LimitItems = true); + char DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, char a_NumToEachSlot, const cSlotNums & a_SlotNums, bool a_LimitItems = true); } ; // tolua_export -- cgit v1.2.3