123456789101112131415161718192021222324252627282930313233 |
- #include "AddEntityUpdate.h"
- #include "Dimension.h"
- #include "EntityType.h"
- #include "StaticRegistry.h"
- AddEntityUpdate::AddEntityUpdate( Entity* entity, int dimension )
- : WorldUpdate( AddEntityUpdateType::ID, dimension, entity->getPosition(), entity->getPosition() ),
- entity( entity )
- {}
- AddEntityUpdate::~AddEntityUpdate()
- {
- entity->release();
- }
- void AddEntityUpdate::onUpdate( Dimension* zDimension )
- {
- zDimension->addEntity( dynamic_cast<Entity*>(entity->getThis()) );
- }
- void AddEntityUpdate::write( Framework::StreamWriter* zWriter )
- {
- int id = entity->zType()->getId();
- zWriter->schreibe( (char*)&id, 4 );
- StaticRegistry<EntityType>::INSTANCE.zElement( id )->saveEntity( entity, zWriter );
- }
- AddEntityUpdateType::AddEntityUpdateType()
- : WorldUpdateType( ID )
- {}
|