1234567891011121314151617181920212223242526272829303132333435363738 |
- #include "AddChunkUpdate.h"
- #include "Chunk.h"
- #include "Constants.h"
- #include "Dimension.h"
- AddChunkUpdate::AddChunkUpdate(Chunk* chunk)
- : WorldUpdate(AddChunkUpdateType::ID, chunk->getDimensionId(), Framework::Vec3<int>(chunk->getCenter().x - CHUNK_SIZE / 2, chunk->getCenter().y - CHUNK_SIZE / 2, 0), Framework::Vec3<int>(chunk->getCenter().x + CHUNK_SIZE / 2 - 1, chunk->getCenter().y + CHUNK_SIZE / 2 - 1, WORLD_HEIGHT - 1)),
- chunk(chunk)
- {}
- AddChunkUpdate::~AddChunkUpdate()
- {
- chunk->release();
- }
- void AddChunkUpdate::onUpdate(Dimension* zDimension)
- {
- zDimension->setChunk(dynamic_cast<Chunk*>(chunk->getThis()), chunk->getCenter());
- }
- void AddChunkUpdate::write(Framework::StreamWriter* zWriter)
- {
- Framework::Punkt center = chunk->getCenter();
- zWriter->schreibe((char*)¢er.x, 4);
- zWriter->schreibe((char*)¢er.y, 4);
- chunk->sendToClient(zWriter);
- }
- Chunk* AddChunkUpdate::zChunk() const
- {
- return chunk;
- }
- AddChunkUpdateType::AddChunkUpdateType()
- : WorldUpdateType(ID)
- {}
|