summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Horse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Horse.cpp')
-rw-r--r--src/Mobs/Horse.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp
index 24287ecc8..13630b0e3 100644
--- a/src/Mobs/Horse.cpp
+++ b/src/Mobs/Horse.cpp
@@ -132,24 +132,28 @@ void cHorse::OnRightClicked(cPlayer & a_Player)
}
else if (a_Player.GetEquippedItem().IsEmpty())
{
- if (m_Attachee != nullptr)
+ // Check if leashed / unleashed to player before try to ride
+ if (!m_IsLeashActionJustDone)
{
- if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID())
+ if (m_Attachee != nullptr)
{
- a_Player.Detach();
- return;
- }
+ if (m_Attachee->GetUniqueID() == a_Player.GetUniqueID())
+ {
+ a_Player.Detach();
+ return;
+ }
- if (m_Attachee->IsPlayer())
- {
- return;
+ if (m_Attachee->IsPlayer())
+ {
+ return;
+ }
+
+ m_Attachee->Detach();
}
- m_Attachee->Detach();
+ m_TameAttemptTimes++;
+ a_Player.AttachTo(this);
}
-
- m_TameAttemptTimes++;
- a_Player.AttachTo(this);
}
else
{