1
0
Fork 0

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:
madmaxoft 2014-01-24 09:57:12 +01:00
parent ebc3f6aa28
commit b02940209d
2 changed files with 9 additions and 3 deletions

View File

@ -73,7 +73,8 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d
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:

View File

@ -1926,14 +1926,19 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
double Speed[3];
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]);
double Rotation[3];
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.SetRoll(Rotation[1]);