1
0

Renamed cEmptyMinecart to cRideableMinecart

This commit is contained in:
STRWarrior 2014-01-12 18:04:41 +01:00
parent c5603ce064
commit f11427e8cd
7 changed files with 18 additions and 17 deletions

View File

@ -45,6 +45,7 @@ void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
}
}
a_ClientHandle.SendSpawnVehicle(*this, 10, SubType); // 10 = Minecarts, SubType = What type of Minecart
a_ClientHandle.SendEntityMetadata(*this);
}
@ -411,9 +412,9 @@ void cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cEmptyMinecart:
// cRideableMinecart:
cEmptyMinecart::cEmptyMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height) :
cRideableMinecart::cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height) :
super(mpNone, a_X, a_Y, a_Z),
m_Content(a_Content),
m_Height(a_Height)
@ -424,7 +425,7 @@ cEmptyMinecart::cEmptyMinecart(double a_X, double a_Y, double a_Z, const cItem &
void cEmptyMinecart::OnRightClicked(cPlayer & a_Player)
void cRideableMinecart::OnRightClicked(cPlayer & a_Player)
{
if (m_Attachee != NULL)
{

View File

@ -69,15 +69,15 @@ protected:
class cEmptyMinecart :
class cRideableMinecart :
public cMinecart
{
typedef cMinecart super;
public:
CLASS_PROTODEF(cEmptyMinecart);
CLASS_PROTODEF(cRideableMinecart);
cEmptyMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height);
cRideableMinecart(double a_X, double a_Y, double a_Z, const cItem & a_Content, int a_Height);
cItem GetContent(void) const {return m_Content;}
int GetBlockHeight(void) const {return m_Height;}

View File

@ -60,7 +60,7 @@ public:
cMinecart * Minecart = NULL;
switch (m_ItemType)
{
case E_ITEM_MINECART: Minecart = new cEmptyMinecart (x, y, z, cItem(), 1); break;
case E_ITEM_MINECART: Minecart = new cRideableMinecart (x, y, z, cItem(), 1); break;
case E_ITEM_CHEST_MINECART: Minecart = new cMinecartWithChest (x, y, z); break;
case E_ITEM_FURNACE_MINECART: Minecart = new cMinecartWithFurnace (x, y, z); break;
case E_ITEM_MINECART_WITH_TNT: Minecart = new cMinecartWithTNT (x, y, z); break;

View File

@ -1784,20 +1784,20 @@ void cProtocol172::cPacketizer::WriteEntityMetadata(const cEntity & a_Entity)
if (((cMinecart &)a_Entity).GetPayload() == cMinecart::mpNone)
{
cEmptyMinecart EmptyMinecart = ((cEmptyMinecart &)a_Entity);
if (!EmptyMinecart.GetContent().IsEmpty())
cRideableMinecart & RideableMinecart = ((cRideableMinecart &)a_Entity);
if (!RideableMinecart.GetContent().IsEmpty())
{
WriteByte(0x54);
int Content = EmptyMinecart.GetContent().m_ItemType;
Content |= EmptyMinecart.GetContent().m_ItemDamage << 8;
int Content = RideableMinecart.GetContent().m_ItemType;
Content |= RideableMinecart.GetContent().m_ItemDamage << 8;
WriteInt(Content);
WriteByte(0x55);
WriteInt(EmptyMinecart.GetBlockHeight());
WriteInt(RideableMinecart.GetBlockHeight());
WriteByte(0x56);
WriteByte(1);
}
}
if (((cMinecart &)a_Entity).GetPayload() == cMinecart::mpFurnace)
else if (((cMinecart &)a_Entity).GetPayload() == cMinecart::mpFurnace)
{
WriteByte(0x10);
WriteByte(((const cMinecartWithFurnace &)a_Entity).IsFueled() ? 1 : 0);

View File

@ -1648,12 +1648,12 @@ int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward)
int cWorld::SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType, cItem a_Content, int a_BlockHeight)
int cWorld::SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType, const cItem & a_Content, int a_BlockHeight)
{
cMinecart * Minecart;
switch (a_MinecartType)
{
case E_ITEM_MINECART: Minecart = new cEmptyMinecart (a_X, a_Y, a_Z, a_Content, a_BlockHeight); break;
case E_ITEM_MINECART: Minecart = new cRideableMinecart (a_X, a_Y, a_Z, a_Content, a_BlockHeight); break;
case E_ITEM_CHEST_MINECART: Minecart = new cMinecartWithChest (a_X, a_Y, a_Z); break;
case E_ITEM_FURNACE_MINECART: Minecart = new cMinecartWithFurnace (a_X, a_Y, a_Z); break;
case E_ITEM_MINECART_WITH_TNT: Minecart = new cMinecartWithTNT (a_X, a_Y, a_Z); break;

View File

@ -364,7 +364,7 @@ public:
int SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE BlockType, NIBBLETYPE BlockMeta);
/// Spawns an minecart at the given coordinates.
int SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType, cItem a_Content = cItem(), int a_BlockHeight = 1);
int SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType, const cItem & a_Content = cItem(), int a_BlockHeight = 1);
/// Spawns an experience orb at the given location with the given reward. It returns the UniqueID of the spawned experience orb.
int SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward);

View File

@ -1150,7 +1150,7 @@ void cWSSAnvil::LoadFallingBlockFromNBT(cEntityList & a_Entities, const cParsedN
void cWSSAnvil::LoadMinecartRFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
std::auto_ptr<cEmptyMinecart> Minecart(new cEmptyMinecart(0, 0, 0, cItem(), 1)); // TODO: Load the block and the height
std::auto_ptr<cRideableMinecart> Minecart(new cRideableMinecart(0, 0, 0, cItem(), 1)); // TODO: Load the block and the height
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;