summaryrefslogtreecommitdiffstats
path: root/source/Entities
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-29 14:47:22 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-29 14:47:22 +0200
commit7056992d0d99fde627e00c5d7f524cad0a70073d (patch)
treed999ba9178beb3d029f409291e85fa69e29ccd42 /source/Entities
parentFixed Minecart spawning issues (diff)
downloadcuberite-7056992d0d99fde627e00c5d7f524cad0a70073d.tar
cuberite-7056992d0d99fde627e00c5d7f524cad0a70073d.tar.gz
cuberite-7056992d0d99fde627e00c5d7f524cad0a70073d.tar.bz2
cuberite-7056992d0d99fde627e00c5d7f524cad0a70073d.tar.lz
cuberite-7056992d0d99fde627e00c5d7f524cad0a70073d.tar.xz
cuberite-7056992d0d99fde627e00c5d7f524cad0a70073d.tar.zst
cuberite-7056992d0d99fde627e00c5d7f524cad0a70073d.zip
Diffstat (limited to '')
-rw-r--r--source/Entities/Entity.h6
-rw-r--r--source/Entities/Minecart.cpp46
2 files changed, 17 insertions, 35 deletions
diff --git a/source/Entities/Entity.h b/source/Entities/Entity.h
index 7ae70b8cf..119cb2fe5 100644
--- a/source/Entities/Entity.h
+++ b/source/Entities/Entity.h
@@ -352,9 +352,6 @@ protected:
bool m_bOnGround;
float m_Gravity;
- // Measured in Kilograms (Kg)
- double m_Mass;
-
// Last Position.
double m_LastPosX, m_LastPosY, m_LastPosZ;
@@ -402,6 +399,9 @@ private:
// Measured in meter / second
Vector3d m_WaterSpeed;
+ // Measured in Kilograms (Kg)
+ double m_Mass;
+
/// Width of the entity, in the XZ plane. Since entities are represented as cylinders, this is more of a diameter.
double m_Width;
diff --git a/source/Entities/Minecart.cpp b/source/Entities/Minecart.cpp
index c484d8763..556454795 100644
--- a/source/Entities/Minecart.cpp
+++ b/source/Entities/Minecart.cpp
@@ -41,50 +41,32 @@ bool cMinecart::Initialize(cWorld * a_World)
void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
{
- char TypeType = 0;
+ char SubType = 0;
switch (m_Payload)
{
- case mpNone: TypeType = 0; break;
- case mpChest: TypeType = 1; break;
- case mpFurnace: TypeType = 2; break;
- case mpTNT: TypeType = 3; break;
- case mpHopper: TypeType = 5; break;
+ case mpNone: SubType = 0; break;
+ case mpChest: SubType = 1; break;
+ case mpFurnace: SubType = 2; break;
+ case mpTNT: SubType = 3; break;
+ case mpHopper: SubType = 5; break;
default:
{
ASSERT(!"Unknown payload, cannot spawn on client");
return;
}
}
- a_ClientHandle.SendSpawnVehicle(*this, 10, TypeType); // 10 = Minecarts, TypeType = What type of Minecart
+ a_ClientHandle.SendSpawnVehicle(*this, 10, SubType); // 10 = Minecarts, TypeType = What type of Minecart
}
-enum ENUM_RAIL_DIRECTIONS
-{
- E_RAIL_NORTH_SOUTH = 0,
- E_RAIL_EAST_WEST = 1,
- E_RAIL_ASCEND_EAST = 2,
- E_RAIL_ASCEND_WEST = 3,
- E_RAIL_ASCEND_NORTH = 4,
- E_RAIL_ASCEND_SOUTH = 5,
- E_RAIL_CURVED_SOUTH_EAST = 6,
- E_RAIL_CURVED_SOUTH_WEST = 7,
- E_RAIL_CURVED_NORTH_WEST = 8,
- E_RAIL_CURVED_NORTH_EAST = 9,
-} ;
-
-
-
-
-
void cMinecart::Tick(float a_Dt, cChunk & a_Chunk)
{
/*
NOTE: Please bear in mind that taking away from negatives make them even more negative,
- adding to negatives make them positive, etc. Also remember that - North is -Z, South +Z, West -X, and East +Z
+ adding to negatives make them positive, etc.
*/
super::Tick(a_Dt, a_Chunk);
@@ -101,7 +83,7 @@ void cMinecart::Tick(float a_Dt, cChunk & a_Chunk)
switch (BelowMeta)
{
- case E_RAIL_NORTH_SOUTH:
+ case E_RAIL_ZM_ZP:
{
SpeedY = 0; // Don't move vertically as on ground
@@ -125,7 +107,7 @@ void cMinecart::Tick(float a_Dt, cChunk & a_Chunk)
break;
}
- case E_RAIL_EAST_WEST:
+ case E_RAIL_XM_XP:
{
SpeedY = 0;
SetPosY(ceil(GetPosY()) + 0.05);
@@ -144,7 +126,7 @@ void cMinecart::Tick(float a_Dt, cChunk & a_Chunk)
break;
}
- case E_RAIL_ASCEND_NORTH:
+ case E_RAIL_ASCEND_ZM:
{
if (SpeedZ >= 0)
{
@@ -169,7 +151,7 @@ void cMinecart::Tick(float a_Dt, cChunk & a_Chunk)
break;
}
- case E_RAIL_ASCEND_SOUTH:
+ case E_RAIL_ASCEND_ZP:
{
if (SpeedX > 0)
{
@@ -194,7 +176,7 @@ void cMinecart::Tick(float a_Dt, cChunk & a_Chunk)
break;
}
- case E_RAIL_ASCEND_WEST:
+ case E_RAIL_ASCEND_XM:
{
if (SpeedX >= 0)
{
@@ -217,7 +199,7 @@ void cMinecart::Tick(float a_Dt, cChunk & a_Chunk)
break;
}
- case E_RAIL_ASCEND_EAST:
+ case E_RAIL_ASCEND_XP:
{
if (SpeedX > 0)
{