Fixed crash with failed entity-loading.
This should fix issues reported in: http://forum.mc-server.org/showthread.php?tid=1328 http://forum.mc-server.org/showthread.php?tid=1308
This commit is contained in:
parent
ebc3f6aa28
commit
b02940209d
|
@ -73,7 +73,8 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d
|
||||||
|
|
||||||
cEntity::~cEntity()
|
cEntity::~cEntity()
|
||||||
{
|
{
|
||||||
ASSERT(!m_World->HasEntity(m_UniqueID)); // Before deleting, the entity needs to have been removed from the world
|
// Before deleting, the entity needs to have been removed from the world, if ever added
|
||||||
|
ASSERT((m_World == NULL) || !m_World->HasEntity(m_UniqueID));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// DEBUG:
|
// DEBUG:
|
||||||
|
|
|
@ -1926,14 +1926,19 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
|
||||||
double Speed[3];
|
double Speed[3];
|
||||||
if (!LoadDoublesListFromNBT(Speed, 3, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Motion")))
|
if (!LoadDoublesListFromNBT(Speed, 3, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Motion")))
|
||||||
{
|
{
|
||||||
return false;
|
// Provide default speed:
|
||||||
|
Speed[0] = 0;
|
||||||
|
Speed[1] = 0;
|
||||||
|
Speed[2] = 0;
|
||||||
}
|
}
|
||||||
a_Entity.SetSpeed(Speed[0], Speed[1], Speed[2]);
|
a_Entity.SetSpeed(Speed[0], Speed[1], Speed[2]);
|
||||||
|
|
||||||
double Rotation[3];
|
double Rotation[3];
|
||||||
if (!LoadDoublesListFromNBT(Rotation, 2, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Rotation")))
|
if (!LoadDoublesListFromNBT(Rotation, 2, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Rotation")))
|
||||||
{
|
{
|
||||||
return false;
|
// Provide default rotation:
|
||||||
|
Rotation[0] = 0;
|
||||||
|
Rotation[1] = 0;
|
||||||
}
|
}
|
||||||
a_Entity.SetYaw(Rotation[0]);
|
a_Entity.SetYaw(Rotation[0]);
|
||||||
a_Entity.SetRoll(Rotation[1]);
|
a_Entity.SetRoll(Rotation[1]);
|
||||||
|
|
Loading…
Reference in New Issue