Fixes several minor initialization issues that were causing problems with deletion/management of components and entities.

Also makes the ThirdPersonPlayer game object editor selectable again by removing an erroneously set field.
This commit is contained in:
Areloch 2016-05-31 12:51:23 -05:00
parent bbf7865a77
commit 2464b620ba
7 changed files with 46 additions and 9 deletions

View file

@ -405,8 +405,9 @@ U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
//mathWrite( *stream, getScale() );
//stream->writeAffineTransform(mObjToWorld);
//mathWrite(*stream, getPosition());
mathWrite(*stream, mPos);
//mathWrite(*stream, mPos);
stream->writeCompressedPoint(mPos);
mathWrite(*stream, getRotation());
mDelta.move.pack(stream);
@ -500,7 +501,8 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream)
Point3F pos;
mathRead(*stream, &pos);
stream->readCompressedPoint(&pos);
//mathRead(*stream, &pos);
RotationF rot;
@ -893,8 +895,10 @@ void Entity::setMountRotation(EulerF rotOffset)
void Entity::getCameraTransform(F32* pos, MatrixF* mat)
{
Vector<CameraInterface*> updaters = getComponents<CameraInterface>();
for (Vector<CameraInterface*>::iterator it = updaters.begin(); it != updaters.end(); it++) {
if ((*it)->getCameraTransform(pos, mat)) {
for (Vector<CameraInterface*>::iterator it = updaters.begin(); it != updaters.end(); it++)
{
if ((*it)->getCameraTransform(pos, mat))
{
return;
}
}
@ -1210,7 +1214,7 @@ void Entity::removeObject(SimObject* object)
bool Entity::addComponent(Component *comp)
{
if (comp == NULL || !comp->isProperlyAdded())
if (comp == NULL)
return false;
//double-check were not re-adding anything