diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-10-21 18:56:09 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2017-10-21 18:56:09 +0200 |
commit | 0bacda32692729e4b9743f91d92cd329e198d73a (patch) | |
tree | 6d5780aafb44679125145f3bc255a200a840c3c2 /src/Mobs/Horse.h | |
parent | Fixed some small passive mob issues (#4057) (diff) | |
download | cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.gz cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.bz2 cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.lz cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.xz cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.tar.zst cuberite-0bacda32692729e4b9743f91d92cd329e198d73a.zip |
Diffstat (limited to 'src/Mobs/Horse.h')
-rw-r--r-- | src/Mobs/Horse.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/Mobs/Horse.h b/src/Mobs/Horse.h index 82026a0ee..38625001e 100644 --- a/src/Mobs/Horse.h +++ b/src/Mobs/Horse.h @@ -2,18 +2,21 @@ #pragma once #include "PassiveMonster.h" +#include "UI/WindowOwner.h" class cHorse : - public cPassiveMonster + public cPassiveMonster, + public cEntityWindowOwner { typedef cPassiveMonster super; public: cHorse(int Type, int Color, int Style, int TameTimes); + virtual ~cHorse() override; CLASS_PROTODEF(cHorse) @@ -23,7 +26,7 @@ public: virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; virtual void OnRightClicked(cPlayer & a_Player) override; - bool IsSaddled (void) const {return m_bIsSaddled; } + bool IsSaddled (void) const {return !m_Saddle.IsEmpty(); } bool IsChested (void) const {return m_bHasChest; } bool IsEating (void) const {return m_bIsEating; } bool IsRearing (void) const {return m_bIsRearing; } @@ -32,7 +35,18 @@ public: int GetHorseType (void) const {return m_Type; } int GetHorseColor (void) const {return m_Color; } int GetHorseStyle (void) const {return m_Style; } - int GetHorseArmour (void) const {return m_Armour;} + int GetHorseArmour (void) const; + + /** Set the horse's saddle to the given item. + @param a_SaddleItem should be either a saddle or empty. */ + void SetHorseSaddle(cItem a_SaddleItem); + + /** Set the horse's armor slot to the given item. + @param a_SaddleItem should be either a type of horse armor or empty. */ + void SetHorseArmor(cItem a_ArmorItem); + + const cItem & GetHorseSaddle() const { return m_Saddle; } + const cItem & GetHorseArmorItem() const { return m_Armor; } virtual void GetBreedingItems(cItems & a_Items) override { @@ -40,11 +54,15 @@ public: a_Items.Add(E_ITEM_GOLDEN_APPLE); } + void PlayerOpenWindow(cPlayer & a_Player); + private: - bool m_bHasChest, m_bIsEating, m_bIsRearing, m_bIsMouthOpen, m_bIsTame, m_bIsSaddled; - int m_Type, m_Color, m_Style, m_Armour, m_TimesToTame, m_TameAttemptTimes, m_RearTickCount; + bool m_bHasChest, m_bIsEating, m_bIsRearing, m_bIsMouthOpen, m_bIsTame; + int m_Type, m_Color, m_Style, m_TimesToTame, m_TameAttemptTimes, m_RearTickCount; float m_MaxSpeed; + cItem m_Saddle; + cItem m_Armor; } ; |