Exemplo n.º 1
0
Chunk::~Chunk()
{
    logger.info() << "Unloading chunk" << *this;

    unsigned int index = 0;
    BlockCoord chunk_x, chunk_y, chunk_z;

    while (index < CHUNK_INDEX_MAX)
    {
        Chunk::getBlockPositionByIndex(index, &chunk_x, &chunk_y, &chunk_z);

        if (chunk_x > 0 && chunk_x < CHUNK_SIZE_XZ - 1 && chunk_z > 0 && chunk_z < CHUNK_SIZE_XZ - 1)
        {
            index++;
            continue;
        }

        BlockInWorld block_pos(*this, chunk_x, chunk_y, chunk_z);
        Chunk *temp_chunk;
        unsigned int temp_index;
        if (findBlock(block_pos.getSide(RIGHT), temp_chunk, temp_index)) temp_chunk->hideTile(temp_index, LEFT);
        if (findBlock(block_pos.getSide(LEFT), temp_chunk, temp_index)) temp_chunk->hideTile(temp_index, RIGHT);
        if (findBlock(block_pos.getSide(BACK), temp_chunk, temp_index)) temp_chunk->hideTile(temp_index, FRONT);
        if (findBlock(block_pos.getSide(FRONT), temp_chunk, temp_index)) temp_chunk->hideTile(temp_index, BACK);
        index++;
    }

    if (m_NeedSave)
    {
        save();
    }

    delete[] m_pBlocks;
    delete[] m_SkyLight;
    delete[] m_TorchLight;

    delete[] m_pDisplayedTiles;
    delete[] m_pDisplayedWaterTiles;

    glDeleteLists(m_RenderList, 2);
}
Exemplo n.º 2
0
	block_pos
	sphere_selection::max ()
	{
		return block_pos (this->cp.x + this->rad, this->cp.y + this->rad,
			this->cp.z + this->rad);
	}
Exemplo n.º 3
0
	/* 
	 * Returns the minimum and maximum points of this selection.
	 */
	block_pos
	sphere_selection::min ()
	{
		return block_pos (this->cp.x - this->rad, this->cp.y - this->rad,
			this->cp.z - this->rad);
	}