Пример #1
0
void World::deleteBlock(int x,int y,int z) {
    Vec2i chunkLoc = _correctCoords(x,z);
    auto fixedX = (x%Chunk::WIDTH+Chunk::WIDTH)%Chunk::WIDTH,
         fixedZ = (z%Chunk::WIDTH+Chunk::WIDTH)%Chunk::WIDTH;
    if(y >= 0 && y < Chunk::HEIGHT) {
        auto& b = _getChunk(chunkLoc[0],chunkLoc[1]).blocks[fixedX][fixedZ][y];
        b.filled = false;
        _updateBlock(x,y,z);
    }
}
Пример #2
0
void KLineSrv::onTickCome(TickData tick)
{
    if (_isBlockExist()) {
        _updateBlock(tick);
        if (_checkBlockClose(tick)) {
            _closeBlock(tick);
            _initBlock(tick);// 两根K线的开闭共享一个tick
        }
    } else {
        _initBlock(tick);
    }
}