BlockRemovedUpdate.cpp 597 B

123456789101112131415161718192021
  1. #include "BlockRemovedUpdate.h"
  2. #include "Globals.h"
  3. #include "Game.h"
  4. BlockRemovedUpdateType::BlockRemovedUpdateType()
  5. : WorldUpdateType( ID )
  6. {}
  7. void BlockRemovedUpdateType::applyUpdate( Framework::StreamReader* zReader )
  8. {
  9. int dimension = 0;
  10. zReader->lese( (char*)&dimension, 4 );
  11. Framework::Vec3<int> pos;
  12. zReader->lese( (char*)&pos.x, 4 );
  13. zReader->lese( (char*)&pos.y, 4 );
  14. zReader->lese( (char*)&pos.z, 4 );
  15. Dimension* d = currentGame->zDimension( dimension );
  16. Block* b = d->zBlock( pos );
  17. if( b )
  18. d->removeBlock( b );
  19. }