From 365cbc6e1cea96741e26c9ce912b003f8fd2c62c Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 29 Sep 2019 14:59:24 +0200 Subject: Refactored more of Entities and BlockEntities to use Vector3. (#4403) --- src/Entities/Minecart.h | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'src/Entities/Minecart.h') diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h index ef5b9e030..79624494c 100644 --- a/src/Entities/Minecart.h +++ b/src/Entities/Minecart.h @@ -20,7 +20,7 @@ class cMinecart : public cEntity { - typedef cEntity super; + using super = cEntity; public: CLASS_PROTODEF(cMinecart) @@ -45,7 +45,9 @@ public: int LastDamage(void) const { return m_LastDamage; } ePayload GetPayload(void) const { return m_Payload; } + protected: + ePayload m_Payload; int m_LastDamage; Vector3i m_DetectorRailPosition; @@ -57,7 +59,7 @@ protected: // Overwrite to enforce speed limit virtual void DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) override; - cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z); + cMinecart(ePayload a_Payload, Vector3d a_Pos); /** Handles physics on normal rails For each tick, slow down on flat rails, speed up or slow down on ascending / descending rails (depending on direction), and turn on curved rails. */ @@ -95,19 +97,23 @@ protected: class cRideableMinecart : public cMinecart { - typedef cMinecart super; + using super = cMinecart; public: + CLASS_PROTODEF(cRideableMinecart) - cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height); + cRideableMinecart(Vector3d a_Pos, const cItem & a_Content, int a_Height); const cItem & GetContent(void) const {return m_Content;} int GetBlockHeight(void) const {return m_Height;} + // cEntity overrides: virtual void OnRightClicked(cPlayer & a_Player) override; + protected: + cItem m_Content; int m_Height; } ; @@ -121,12 +127,13 @@ class cMinecartWithChest : public cItemGrid::cListener, public cEntityWindowOwner { - typedef cMinecart super; + using super = cMinecart; public: + CLASS_PROTODEF(cMinecartWithChest) - cMinecartWithChest(double a_X, double a_Y, double a_Z); + cMinecartWithChest(Vector3d a_Pos); enum { @@ -137,7 +144,9 @@ public: const cItem & GetSlot(int a_Idx) const { return m_Contents.GetSlot(a_Idx); } void SetSlot(int a_Idx, const cItem & a_Item) { m_Contents.SetSlot(a_Idx, a_Item); } + protected: + cItemGrid m_Contents; void OpenNewWindow(void); virtual void Destroyed() override; @@ -169,12 +178,13 @@ protected: class cMinecartWithFurnace : public cMinecart { - typedef cMinecart super; + using super = cMinecart; public: + CLASS_PROTODEF(cMinecartWithFurnace) - cMinecartWithFurnace(double a_X, double a_Y, double a_Z); + cMinecartWithFurnace(Vector3d a_Pos); // cEntity overrides: virtual void OnRightClicked(cPlayer & a_Player) override; @@ -201,12 +211,12 @@ private: class cMinecartWithTNT : public cMinecart { - typedef cMinecart super; + using super = cMinecart; public: CLASS_PROTODEF(cMinecartWithTNT) - cMinecartWithTNT(double a_X, double a_Y, double a_Z); + cMinecartWithTNT(Vector3d a_Pos); } ; @@ -216,10 +226,11 @@ public: class cMinecartWithHopper : public cMinecart { - typedef cMinecart super; + using super = cMinecart; public: + CLASS_PROTODEF(cMinecartWithHopper) - cMinecartWithHopper(double a_X, double a_Y, double a_Z); + cMinecartWithHopper(Vector3d a_Pos); } ; -- cgit v1.2.3