AddChunkUpdate.cpp 517 B

123456789101112131415161718192021
  1. #include <Punkt.h>
  2. #include "AddChunkUpdate.h"
  3. #include "Chunk.h"
  4. #include "Globals.h"
  5. AddChunkUpdateType::AddChunkUpdateType()
  6. : WorldUpdateType(ID)
  7. {}
  8. void AddChunkUpdateType::applyUpdate(Framework::StreamReader* zReader)
  9. {
  10. Framework::Punkt center;
  11. zReader->lese((char*)&center.x, 4);
  12. zReader->lese((char*)&center.y, 4);
  13. std::cout << "downloading chunk " << center.x << ", " << center.y << "\n";
  14. Chunk* chunk = new Chunk(center);
  15. chunk->load(zReader);
  16. currentGame->setChunk(chunk);
  17. }