Fixed indentation once and for all.
This commit is contained in:
parent
9926ea58e8
commit
7c12247263
@ -1345,20 +1345,20 @@ AString cPlayer::GetColor(void) const
|
|||||||
void cPlayer::TossEquippedItem(char a_Amount)
|
void cPlayer::TossEquippedItem(char a_Amount)
|
||||||
{
|
{
|
||||||
cItems Drops;
|
cItems Drops;
|
||||||
cItem DroppedItem(GetInventory().GetEquippedItem());
|
cItem DroppedItem(GetInventory().GetEquippedItem());
|
||||||
if (!DroppedItem.IsEmpty())
|
if (!DroppedItem.IsEmpty())
|
||||||
{
|
{
|
||||||
char NewAmount = a_Amount;
|
char NewAmount = a_Amount;
|
||||||
if (NewAmount > GetInventory().GetEquippedItem().m_ItemCount)
|
if (NewAmount > GetInventory().GetEquippedItem().m_ItemCount)
|
||||||
{
|
{
|
||||||
NewAmount = GetInventory().GetEquippedItem().m_ItemCount; // Drop only what's there
|
NewAmount = GetInventory().GetEquippedItem().m_ItemCount; // Drop only what's there
|
||||||
}
|
}
|
||||||
|
|
||||||
GetInventory().GetHotbarGrid().ChangeSlotCount(GetInventory().GetEquippedSlotNum() /* Returns hotbar subslot, which HotbarGrid takes */, -a_Amount);
|
GetInventory().GetHotbarGrid().ChangeSlotCount(GetInventory().GetEquippedSlotNum() /* Returns hotbar subslot, which HotbarGrid takes */, -a_Amount);
|
||||||
|
|
||||||
DroppedItem.m_ItemCount = NewAmount;
|
DroppedItem.m_ItemCount = NewAmount;
|
||||||
Drops.push_back(DroppedItem);
|
Drops.push_back(DroppedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
double vX = 0, vY = 0, vZ = 0;
|
double vX = 0, vY = 0, vZ = 0;
|
||||||
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
|
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
|
||||||
@ -1373,24 +1373,24 @@ void cPlayer::TossEquippedItem(char a_Amount)
|
|||||||
void cPlayer::TossHeldItem(char a_Amount)
|
void cPlayer::TossHeldItem(char a_Amount)
|
||||||
{
|
{
|
||||||
cItems Drops;
|
cItems Drops;
|
||||||
cItem & Item = GetDraggingItem();
|
cItem & Item = GetDraggingItem();
|
||||||
if (!Item.IsEmpty())
|
if (!Item.IsEmpty())
|
||||||
{
|
{
|
||||||
char OriginalItemAmount = Item.m_ItemCount;
|
char OriginalItemAmount = Item.m_ItemCount;
|
||||||
Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount);
|
Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount);
|
||||||
Drops.push_back(Item);
|
Drops.push_back(Item);
|
||||||
if (OriginalItemAmount > a_Amount)
|
if (OriginalItemAmount > a_Amount)
|
||||||
{
|
{
|
||||||
Item.m_ItemCount = OriginalItemAmount - a_Amount;
|
Item.m_ItemCount = OriginalItemAmount - a_Amount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Item.Empty();
|
Item.Empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double vX = 0, vY = 0, vZ = 0;
|
double vX = 0, vY = 0, vZ = 0;
|
||||||
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
|
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
|
||||||
vY = -vY * 2 + 1.f;
|
vY = -vY * 2 + 1.f;
|
||||||
m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player
|
m_World->SpawnItemPickups(Drops, GetPosX(), GetEyeHeight(), GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player
|
||||||
}
|
}
|
||||||
@ -1402,7 +1402,7 @@ void cPlayer::TossHeldItem(char a_Amount)
|
|||||||
void cPlayer::TossPickup(const cItem & a_Item)
|
void cPlayer::TossPickup(const cItem & a_Item)
|
||||||
{
|
{
|
||||||
cItems Drops;
|
cItems Drops;
|
||||||
Drops.push_back(a_Item);
|
Drops.push_back(a_Item);
|
||||||
|
|
||||||
double vX = 0, vY = 0, vZ = 0;
|
double vX = 0, vY = 0, vZ = 0;
|
||||||
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
|
EulerToVector(-GetYaw(), GetPitch(), vZ, vX, vY);
|
||||||
|
@ -181,15 +181,15 @@ void cWindow::Clicked(
|
|||||||
{
|
{
|
||||||
case caRightClickOutside:
|
case caRightClickOutside:
|
||||||
{
|
{
|
||||||
if (PlgMgr->CallHookPlayerTossingItem(a_Player))
|
if (PlgMgr->CallHookPlayerTossingItem(a_Player))
|
||||||
{
|
{
|
||||||
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
|
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (a_Player.IsGameModeCreative())
|
||||||
|
{
|
||||||
|
a_Player.TossPickup(a_ClickedItem);
|
||||||
}
|
}
|
||||||
if (a_Player.IsGameModeCreative())
|
|
||||||
{
|
|
||||||
a_Player.TossPickup(a_ClickedItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Toss one of the dragged items:
|
// Toss one of the dragged items:
|
||||||
a_Player.TossHeldItem();
|
a_Player.TossHeldItem();
|
||||||
@ -199,14 +199,14 @@ void cWindow::Clicked(
|
|||||||
{
|
{
|
||||||
if (PlgMgr->CallHookPlayerTossingItem(a_Player))
|
if (PlgMgr->CallHookPlayerTossingItem(a_Player))
|
||||||
{
|
{
|
||||||
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
|
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a_Player.IsGameModeCreative())
|
if (a_Player.IsGameModeCreative())
|
||||||
{
|
{
|
||||||
a_Player.TossPickup(a_ClickedItem);
|
a_Player.TossPickup(a_ClickedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toss all dragged items:
|
// Toss all dragged items:
|
||||||
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
|
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
|
||||||
@ -285,8 +285,8 @@ bool cWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse)
|
|||||||
// Checks whether the player is still holding an item
|
// Checks whether the player is still holding an item
|
||||||
if (a_Player.IsDraggingItem())
|
if (a_Player.IsDraggingItem())
|
||||||
{
|
{
|
||||||
LOGD("Player holds item! Dropping it...");
|
LOGD("Player holds item! Dropping it...");
|
||||||
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
|
a_Player.TossHeldItem(a_Player.GetDraggingItem().m_ItemCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
cClientHandle * ClientHandle = a_Player.GetClientHandle();
|
cClientHandle * ClientHandle = a_Player.GetClientHandle();
|
||||||
|
Loading…
Reference in New Issue
Block a user