void KLineSrv::onTickCome(TickData tick) { if (_isBlockExist()) { _updateBlock(tick); if (_checkBlockClose(tick)) { _closeBlock(tick); _initBlock(tick);// 两根K线的开闭共享一个tick } } else { _initBlock(tick); } }
void Water::Load(const char * source) { DataStreamPtr stream = ResourceManager::Instance()->OpenResource(source); if (stream == NULL) return ; int Magic, Version; stream->Read(&Magic, sizeof(int)); stream->Read(&Version, sizeof(int)); d_assert (Magic == K_Magic); d_assert (Version == 0); if (Version == 0) { int sizeX, sizeZ; stream->Read(&sizeX, sizeof(int)); stream->Read(&sizeZ, sizeof(int)); d_assert (sizeX == mSizeX && sizeZ == mSizeZ); stream->Read(&mHeight, sizeof(float)); stream->Read(mData, sizeX * sizeZ); } _initBlock(); }
void Water::_allocBlock() { Terrain * terrain = Environment::Instance()->GetTerrain(); mBlockCountX = terrain->GetConfig().xSectionCount; mBlockCountZ = terrain->GetConfig().zSectionCount; mBlocks = new WaterBlock[terrain->GetConfig().iSectionCount]; _initBlock(); }