summaryrefslogtreecommitdiffstats
path: root/src/UI
diff options
context:
space:
mode:
Diffstat (limited to 'src/UI')
-rw-r--r--src/UI/BeaconWindow.cpp4
-rw-r--r--src/UI/SlotArea.cpp4
-rw-r--r--src/UI/Window.cpp16
-rw-r--r--src/UI/Window.h2
4 files changed, 13 insertions, 13 deletions
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<short>(m_Beacon->GetPrimaryEffect()));
+ a_Player.GetClientHandle()->SendWindowProperty(*this, 2, static_cast<short>(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<char>(DamageDiff);
NeedExp += std::max(1, DamageDiff / 100) + static_cast<int>(Target.m_Enchantments.Count());
DamageDiff = std::min(static_cast<int>(Output.m_ItemDamage), static_cast<int>(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<int>(ToDistribute.m_ItemCount) / static_cast<int>(SlotNums.size());
+ char ToEachSlot = ToDistribute.m_ItemCount / static_cast<char>(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<size_t>(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<char>(std::min(a_NumToEachSlot, static_cast<int>(MaxStack)));
+ ToStore.m_ItemCount = std::min<char>(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<int>(MaxStack) - AtSlot.m_ItemCount);
+ char CanStore = std::min<char>(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